forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/master' into work
Change-Id: I2235a55a599aaeca5d2b5377300a044b66c17da9
This commit is contained in:
@@ -164,37 +164,14 @@ endif()
|
|||||||
|
|
||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
|
|
||||||
find_package(Python3 COMPONENTS Interpreter)
|
setup_dependencies_component()
|
||||||
if (NOT Python3_Interpreter_FOUND)
|
|
||||||
message("No python interpreter found, skipping \"Dependencies\" install component.")
|
|
||||||
else()
|
|
||||||
get_target_property(_qmake_binary Qt5::qmake IMPORTED_LOCATION)
|
|
||||||
set(_llvm_arg)
|
|
||||||
if (LLVM_INSTALL_PREFIX)
|
|
||||||
set(_llvm_arg "--llvm \"${LLVM_INSTALL_PREFIX}\"")
|
|
||||||
endif()
|
|
||||||
set(_elfutils_arg)
|
|
||||||
if (ELFUTILS_INCLUDE_DIR)
|
|
||||||
get_filename_component(_elfutils_path ${ELFUTILS_INCLUDE_DIR} DIRECTORY)
|
|
||||||
set(_elfutils_arg "--elfutils \"${_elfutils_path}\"")
|
|
||||||
endif()
|
|
||||||
install(CODE "
|
|
||||||
execute_process(COMMAND
|
|
||||||
\"${Python3_EXECUTABLE}\"
|
|
||||||
\"${CMAKE_CURRENT_LIST_DIR}/scripts/deployqt.py\"
|
|
||||||
${_llvm_arg}
|
|
||||||
${_elfutils_arg}
|
|
||||||
\"\${CMAKE_INSTALL_PREFIX}/${IDE_APP_PATH}/${IDE_APP_TARGET}\"
|
|
||||||
\"${_qmake_binary}\"
|
|
||||||
COMMAND_ECHO STDOUT
|
|
||||||
)
|
|
||||||
"
|
|
||||||
COMPONENT Dependencies
|
|
||||||
EXCLUDE_FROM_ALL
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
feature_summary(INCLUDE_QUIET_PACKAGES WHAT
|
feature_summary(INCLUDE_QUIET_PACKAGES WHAT
|
||||||
PACKAGES_FOUND PACKAGES_NOT_FOUND
|
PACKAGES_FOUND PACKAGES_NOT_FOUND
|
||||||
ENABLED_FEATURES DISABLED_FEATURES
|
ENABLED_FEATURES DISABLED_FEATURES
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||||
|
# Only for non super repo builds
|
||||||
|
add_subdirectory(packaging)
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -5,3 +5,46 @@ function (env_with_default envName varToSet default)
|
|||||||
set(${varToSet} ${default} PARENT_SCOPE)
|
set(${varToSet} ${default} PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
function(setup_dependencies_component)
|
||||||
|
find_package(Python3 COMPONENTS Interpreter)
|
||||||
|
if (NOT Python3_Interpreter_FOUND)
|
||||||
|
message("No python interpreter found, skipping \"Dependencies\" install component.")
|
||||||
|
else()
|
||||||
|
get_target_property(_qmake_binary Qt5::qmake IMPORTED_LOCATION)
|
||||||
|
set(_llvm_arg)
|
||||||
|
if (LLVM_INSTALL_PREFIX)
|
||||||
|
set(_llvm_arg "--llvm \"${LLVM_INSTALL_PREFIX}\"")
|
||||||
|
endif()
|
||||||
|
set(_elfutils_arg)
|
||||||
|
if (ELFUTILS_INCLUDE_DIR)
|
||||||
|
get_filename_component(_elfutils_path ${ELFUTILS_INCLUDE_DIR} DIRECTORY)
|
||||||
|
set(_elfutils_arg "--elfutils \"${_elfutils_path}\"")
|
||||||
|
endif()
|
||||||
|
install(CODE "
|
||||||
|
set(_ide_app_target \"\${CMAKE_INSTALL_PREFIX}/${IDE_APP_PATH}/${IDE_APP_TARGET}${CMAKE_EXECUTABLE_SUFFIX}\")
|
||||||
|
if (NOT EXISTS \"\${_ide_app_target}\")
|
||||||
|
# The component CPack generators (WIX, NSIS64, IFW) install every component with their own CMAKE_INSTALL_PREFIX
|
||||||
|
# directory and since deployqt.py needs the path to IDE_APP_TARGET the line below is needeed
|
||||||
|
string(REPLACE \"Dependencies\" \"${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}\" _ide_app_target \"\${_ide_app_target}\")
|
||||||
|
endif()
|
||||||
|
if (NOT EXISTS \"\${_ide_app_target}\")
|
||||||
|
# On Linux with the DEB generator the CMAKE_INSTALL_PREFIX is relative and the DESTDIR environment variable is needed
|
||||||
|
# to point out to the IDE_APP_TARGET binary
|
||||||
|
set(_ide_app_target \"\$ENV{DESTDIR}/\${CMAKE_INSTALL_PREFIX}/${IDE_APP_PATH}/${IDE_APP_TARGET}${CMAKE_EXECUTABLE_SUFFIX}\")
|
||||||
|
endif()
|
||||||
|
execute_process(COMMAND
|
||||||
|
\"${Python3_EXECUTABLE}\"
|
||||||
|
\"${CMAKE_CURRENT_LIST_DIR}/scripts/deployqt.py\"
|
||||||
|
${_llvm_arg}
|
||||||
|
${_elfutils_arg}
|
||||||
|
\"\${_ide_app_target}\"
|
||||||
|
\"${_qmake_binary}\"
|
||||||
|
COMMAND_ECHO STDOUT
|
||||||
|
)
|
||||||
|
"
|
||||||
|
COMPONENT Dependencies
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|||||||
70
packaging/CMakeLists.txt
Normal file
70
packaging/CMakeLists.txt
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/QtCreatorIDEBranding.cmake)
|
||||||
|
|
||||||
|
set(CPACK_PACKAGE_NAME ${IDE_CASED_ID})
|
||||||
|
set(CPACK_PACKAGE_VENDOR "The Qt Company Ltd")
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${IDE_DISPLAY_NAME})
|
||||||
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${IDE_ID})
|
||||||
|
set(CPACK_VERBATIM_VARIABLES YES)
|
||||||
|
|
||||||
|
#set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_LIST_DIR}/Description.txt)
|
||||||
|
#set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_CURRENT_LIST_DIR}/Welcome.txt)
|
||||||
|
#set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_LIST_DIR}/Readme.txt)
|
||||||
|
|
||||||
|
# WIX needs a license file ending with .txt
|
||||||
|
file(CREATE_LINK
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}/../LICENSE.GPL3-EXCEPT
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/LICENSE.GPL3-EXCEPT.txt
|
||||||
|
COPY_ON_ERROR)
|
||||||
|
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_BINARY_DIR}/LICENSE.GPL3-EXCEPT.txt)
|
||||||
|
|
||||||
|
set(CPACK_PACKAGE_CONTACT "None")
|
||||||
|
set(CPACK_THREADS 4)
|
||||||
|
set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
|
||||||
|
set(CPACK_DEBIAN_COMPRESSION_TYPE lzma)
|
||||||
|
|
||||||
|
# Make CMAKE_INSTALL_DEFAULT_COMPONENT_NAME the first component to install
|
||||||
|
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
|
||||||
|
list(REMOVE_ITEM CPACK_COMPONENTS_ALL ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
|
||||||
|
list(REMOVE_ITEM CPACK_COMPONENTS_ALL libraries) # empty component, breaks WIX
|
||||||
|
list(PREPEND CPACK_COMPONENTS_ALL ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
|
||||||
|
|
||||||
|
set(CPACK_COMPONENT_Dependencies_HIDDEN TRUE)
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
set(CPACK_INSTALL_PREFIX "/")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${IDE_ID}-${CMAKE_PROJECT_VERSION})
|
||||||
|
else()
|
||||||
|
set(CPACK_SET_DESTDIR ON)
|
||||||
|
set(CPACK_STRIP_FILES ON)
|
||||||
|
|
||||||
|
if (NOT APPLE)
|
||||||
|
set(CPACK_INSTALL_CMAKE_PROJECTS
|
||||||
|
"${CMAKE_BINARY_DIR};${IDE_CASED_ID};ALL;/"
|
||||||
|
"${CMAKE_BINARY_DIR};Dependencies;Dependencies;/"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# NSIS-specific configuration
|
||||||
|
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_LIST_DIR}/../src/app/qtcreator.ico")
|
||||||
|
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_LIST_DIR}/../src/app/qtcreator.ico")
|
||||||
|
set(CPACK_NSIS_INSTALLED_ICON_NAME "${IDE_APP_PATH}\\${IDE_APP_TARGET}.exe")
|
||||||
|
set(CPACK_NSIS_DISPLAY_NAME "${IDE_DISPLAY_NAME} ${CMAKE_PROJECT_VERSION}")
|
||||||
|
set(CPACK_NSIS_PACKAGE_NAME "${IDE_DISPLAY_NAME} ${CMAKE_PROJECT_VERSION}")
|
||||||
|
set(CPACK_NSIS_COMPRESSOR "/SOLID lzma\n SetCompressorDictSize 64")
|
||||||
|
set(CPACK_NSIS_INSTALL_ROOT "C:\\Qt")
|
||||||
|
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "${IDE_APP_TARGET}")
|
||||||
|
set(CPACK_NSIS_CREATE_ICONS_EXTRA
|
||||||
|
"CreateShortCut '$SMPROGRAMS\\$STARTMENU_FOLDER\\${IDE_DISPLAY_NAME} ${CMAKE_PROJECT_VERSION}.lnk' '$INSTDIR\\${IDE_APP_PATH}\\${IDE_APP_TARGET}.exe' "
|
||||||
|
)
|
||||||
|
set(CPACK_NSIS_MANIFEST_DPI_AWARE ON)
|
||||||
|
|
||||||
|
# WIX-specific configuration
|
||||||
|
set(CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_LIST_DIR}/../src/app/qtcreator.ico")
|
||||||
|
set(CPACK_WIX_UPGRADE_GUID "E6A093A5-83DE-47FA-B669-1DE0102BE92A")
|
||||||
|
set(CPACK_WIX_LIGHT_EXTRA_FLAGS "-dcl:high") # set high compression
|
||||||
|
|
||||||
|
include(CPack)
|
||||||
@@ -12,6 +12,7 @@ import argparse
|
|||||||
import pathlib
|
import pathlib
|
||||||
import sys
|
import sys
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from enum import Enum, auto
|
||||||
|
|
||||||
def rewriteLines(input, scrubbedContext, tsFilePath):
|
def rewriteLines(input, scrubbedContext, tsFilePath):
|
||||||
result = []
|
result = []
|
||||||
@@ -94,19 +95,46 @@ def findDistinctDuplicates(input, scrubbedContext, tsFilePath):
|
|||||||
continue
|
continue
|
||||||
if inContext:
|
if inContext:
|
||||||
sourceXml = []
|
sourceXml = []
|
||||||
lineNr = inputLineNr
|
|
||||||
for sourceLine in lineIter: # <source>..</source> (possibly multi-line)
|
|
||||||
inputLineNr += 1
|
|
||||||
sourceXml.append(sourceLine)
|
|
||||||
if sourceLine.count(r"</source>") == 1:
|
|
||||||
break
|
|
||||||
sourceXmlHash = hash(str(sourceXml))
|
|
||||||
translationXml = []
|
translationXml = []
|
||||||
for translationLine in lineIter: # <translation>..</translation> (possibly multi-line)
|
lineNr = inputLineNr
|
||||||
|
|
||||||
|
class Position(Enum):
|
||||||
|
MESSAGESTART = auto()
|
||||||
|
LOCATION = auto()
|
||||||
|
SOURCE = auto()
|
||||||
|
COMMENT = auto()
|
||||||
|
EXTRACOMMENT = auto()
|
||||||
|
TRANSLATORCOMMENT = auto()
|
||||||
|
TRANSLATION = auto()
|
||||||
|
MESSAGEOVER = auto()
|
||||||
|
|
||||||
|
pos = Position.MESSAGESTART
|
||||||
|
|
||||||
|
for messageLine in lineIter:
|
||||||
inputLineNr += 1
|
inputLineNr += 1
|
||||||
translationXml.append(translationLine)
|
if messageLine.count(r"<location") == 1:
|
||||||
if translationLine.count(r"</translation>") == 1:
|
pos = Position.LOCATION
|
||||||
|
elif messageLine.count(r"<source") == 1:
|
||||||
|
pos = Position.SOURCE
|
||||||
|
elif messageLine.count(r"<comment") == 1:
|
||||||
|
pos = Position.COMMENT
|
||||||
|
elif messageLine.count(r"<extracomment") == 1:
|
||||||
|
pos = Position.EXTRACOMMENT
|
||||||
|
elif messageLine.count(r"<translatorcomment") == 1:
|
||||||
|
pos = Position.TRANSLATORCOMMENT
|
||||||
|
elif messageLine.count(r"<translation") == 1:
|
||||||
|
pos = Position.TRANSLATION
|
||||||
|
elif messageLine.count(r"</message>") == 1:
|
||||||
|
pos = Position.MESSAGEOVER
|
||||||
|
|
||||||
|
if pos == Position.SOURCE or pos == Position.COMMENT:
|
||||||
|
sourceXml.append(messageLine)
|
||||||
|
elif pos == Position.TRANSLATION or pos == Position.EXTRACOMMENT or pos == Position.TRANSLATORCOMMENT:
|
||||||
|
translationXml.append(messageLine)
|
||||||
|
elif pos == Position.MESSAGEOVER:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
sourceXmlHash = hash(str(sourceXml))
|
||||||
translation = Translation(lineNr, translationXml)
|
translation = Translation(lineNr, translationXml)
|
||||||
if sourceXmlHash in messages:
|
if sourceXmlHash in messages:
|
||||||
messages[sourceXmlHash].translations.append(translation)
|
messages[sourceXmlHash].translations.append(translation)
|
||||||
@@ -117,13 +145,14 @@ def findDistinctDuplicates(input, scrubbedContext, tsFilePath):
|
|||||||
source = messages[sourceId]
|
source = messages[sourceId]
|
||||||
translationsCount = len(source.translations)
|
translationsCount = len(source.translations)
|
||||||
if translationsCount > 1:
|
if translationsCount > 1:
|
||||||
|
print (f"\n==========================================")
|
||||||
print (f"\n{translationsCount} duplicates for source:")
|
print (f"\n{translationsCount} duplicates for source:")
|
||||||
for sourceXmlLine in source.sourceXml:
|
for sourceXmlLine in source.sourceXml:
|
||||||
print (sourceXmlLine.rstrip())
|
print (sourceXmlLine.rstrip())
|
||||||
for translation in source.translations:
|
for translation in source.translations:
|
||||||
print (f"\n{tsFilePath}:{translation.lineNr}")
|
print (f"\n{tsFilePath}:{translation.lineNr}")
|
||||||
for translationXmlLine in translation.translationXml:
|
for translationXmlLine in translation.translationXml:
|
||||||
print (translationXmlLine.rstrip())
|
print (translationXmlLine.rstrip())
|
||||||
|
|
||||||
|
|
||||||
def processTsFile(tsFilePath, scrubbedContext):
|
def processTsFile(tsFilePath, scrubbedContext):
|
||||||
|
|||||||
@@ -162,13 +162,11 @@ class Dumper(DumperBase):
|
|||||||
return self.createArrayType(targetType, nativeType.arrayElements())
|
return self.createArrayType(targetType, nativeType.arrayElements())
|
||||||
code = TypeCode.Struct
|
code = TypeCode.Struct
|
||||||
|
|
||||||
tdata = self.TypeData(self)
|
tdata = self.TypeData(self, typeId)
|
||||||
tdata.name = nativeType.name()
|
tdata.name = nativeType.name()
|
||||||
tdata.typeId = typeId
|
|
||||||
tdata.lbitsize = nativeType.bitsize()
|
tdata.lbitsize = nativeType.bitsize()
|
||||||
tdata.code = code
|
tdata.code = code
|
||||||
tdata.moduleName = nativeType.module()
|
tdata.moduleName = nativeType.module()
|
||||||
self.registerType(typeId, tdata) # Prevent recursion in fields.
|
|
||||||
if code == TypeCode.Struct:
|
if code == TypeCode.Struct:
|
||||||
tdata.lfields = lambda value: \
|
tdata.lfields = lambda value: \
|
||||||
self.listFields(nativeType, value)
|
self.listFields(nativeType, value)
|
||||||
@@ -179,7 +177,6 @@ class Dumper(DumperBase):
|
|||||||
self.nativeTypeEnumDisplay(nativeType, intval, form)
|
self.nativeTypeEnumDisplay(nativeType, intval, form)
|
||||||
tdata.templateArguments = lambda: \
|
tdata.templateArguments = lambda: \
|
||||||
self.listTemplateParameters(nativeType.name())
|
self.listTemplateParameters(nativeType.name())
|
||||||
self.registerType(typeId, tdata) # Fix up fields and template args
|
|
||||||
return self.Type(self, typeId)
|
return self.Type(self, typeId)
|
||||||
|
|
||||||
def listFields(self, nativeType, value):
|
def listFields(self, nativeType, value):
|
||||||
@@ -388,8 +385,8 @@ class Dumper(DumperBase):
|
|||||||
if nativeType is None:
|
if nativeType is None:
|
||||||
return None
|
return None
|
||||||
_type = self.fromNativeType(nativeType)
|
_type = self.fromNativeType(nativeType)
|
||||||
if _type.name != typeName:
|
if _type.typeId != typeName:
|
||||||
self.registerType(typeName, _type.tdata)
|
self.registerTypeAlias(_type.typeId, typeName)
|
||||||
return _type
|
return _type
|
||||||
return self.Type(self, typeName)
|
return self.Type(self, typeName)
|
||||||
|
|
||||||
|
|||||||
@@ -422,24 +422,18 @@ class DumperBase():
|
|||||||
return None if nativeType is None else self.fromNativeType(nativeType)
|
return None if nativeType is None else self.fromNativeType(nativeType)
|
||||||
|
|
||||||
def registerKnownTypes(self):
|
def registerKnownTypes(self):
|
||||||
typeId = 'unsigned short'
|
tdata = self.TypeData(self, 'unsigned short')
|
||||||
tdata = self.TypeData(self)
|
|
||||||
tdata.name = typeId
|
|
||||||
tdata.typeId = typeId
|
|
||||||
tdata.lbitsize = 16
|
tdata.lbitsize = 16
|
||||||
|
tdata.lalignment = 2
|
||||||
tdata.code = TypeCode.Integral
|
tdata.code = TypeCode.Integral
|
||||||
self.registerType(typeId, tdata)
|
|
||||||
|
|
||||||
typeId = 'QChar'
|
tdata = self.TypeData(self, 'QChar')
|
||||||
tdata = self.TypeData(self)
|
|
||||||
tdata.name = typeId
|
|
||||||
tdata.typeId = typeId
|
|
||||||
tdata.lbitsize = 16
|
tdata.lbitsize = 16
|
||||||
|
tdata.lalignment = 2
|
||||||
tdata.code = TypeCode.Struct
|
tdata.code = TypeCode.Struct
|
||||||
tdata.lfields = [self.Field(dumper=self, name='ucs',
|
tdata.lfields = [self.Field(dumper=self, name='ucs',
|
||||||
type='unsigned short', bitsize=16, bitpos=0)]
|
type='unsigned short', bitsize=16, bitpos=0)]
|
||||||
tdata.lalignment = 2
|
tdata.templateArguments = lambda: []
|
||||||
self.registerType(typeId, tdata)
|
|
||||||
|
|
||||||
def nativeDynamicType(self, address, baseType):
|
def nativeDynamicType(self, address, baseType):
|
||||||
return baseType # Override in backends.
|
return baseType # Override in backends.
|
||||||
@@ -3462,19 +3456,12 @@ class DumperBase():
|
|||||||
item_count = type_name[pos1 + 1:pos2]
|
item_count = type_name[pos1 + 1:pos2]
|
||||||
return (type_name[0:pos1].strip(), type_name[pos2 + 1:].strip(), int(item_count))
|
return (type_name[0:pos1].strip(), type_name[pos2 + 1:].strip(), int(item_count))
|
||||||
|
|
||||||
def registerType(self, typeId, tdata):
|
|
||||||
#DumperBase.warn('REGISTER TYPE: %s' % typeId)
|
|
||||||
self.typeData[typeId] = tdata
|
|
||||||
#typeId = typeId.replace(' ', '')
|
|
||||||
#self.typeData[typeId] = tdata
|
|
||||||
#DumperBase.warn('REGISTERED: %s' % self.typeData)
|
|
||||||
|
|
||||||
def registerTypeAlias(self, existingTypeId, aliasId):
|
def registerTypeAlias(self, existingTypeId, aliasId):
|
||||||
#DumperBase.warn('REGISTER ALIAS %s FOR %s' % (aliasId, existingTypeId))
|
#DumperBase.warn('REGISTER ALIAS %s FOR %s' % (aliasId, existingTypeId))
|
||||||
self.typeData[aliasId] = self.typeData[existingTypeId]
|
self.typeData[aliasId] = self.typeData[existingTypeId]
|
||||||
|
|
||||||
class TypeData():
|
class TypeData():
|
||||||
def __init__(self, dumper):
|
def __init__(self, dumper, type_id):
|
||||||
self.dumper = dumper
|
self.dumper = dumper
|
||||||
self.lfields = None # None or Value -> list of member Values
|
self.lfields = None # None or Value -> list of member Values
|
||||||
self.lalignment = None # Function returning alignment of this struct
|
self.lalignment = None # Function returning alignment of this struct
|
||||||
@@ -3482,13 +3469,15 @@ class DumperBase():
|
|||||||
self.ltarget = None # Inner type for arrays
|
self.ltarget = None # Inner type for arrays
|
||||||
self.templateArguments = None
|
self.templateArguments = None
|
||||||
self.code = None
|
self.code = None
|
||||||
self.name = None
|
self.name = type_id
|
||||||
self.typeId = None
|
self.typeId = type_id
|
||||||
self.enumDisplay = None
|
self.enumDisplay = None
|
||||||
self.moduleName = None
|
self.moduleName = None
|
||||||
|
#DumperBase.warn('REGISTER TYPE: %s' % type_id)
|
||||||
|
dumper.typeData[type_id] = self
|
||||||
|
|
||||||
def copy(self):
|
def copy(self):
|
||||||
tdata = self.dumper.TypeData(self.dumper)
|
tdata = self.dumper.TypeData(self.dumper, self.typeId)
|
||||||
tdata.dumper = self.dumper
|
tdata.dumper = self.dumper
|
||||||
tdata.lfields = self.lfields
|
tdata.lfields = self.lfields
|
||||||
tdata.lalignment = self.lalignment
|
tdata.lalignment = self.lalignment
|
||||||
@@ -3791,13 +3780,11 @@ class DumperBase():
|
|||||||
raise RuntimeError('Expected type in createPointerType(), got %s'
|
raise RuntimeError('Expected type in createPointerType(), got %s'
|
||||||
% type(targetType))
|
% type(targetType))
|
||||||
typeId = targetType.typeId + ' *'
|
typeId = targetType.typeId + ' *'
|
||||||
tdata = self.TypeData(self)
|
tdata = self.TypeData(self, typeId)
|
||||||
tdata.name = targetType.name + '*'
|
tdata.name = targetType.name + '*'
|
||||||
tdata.typeId = typeId
|
|
||||||
tdata.lbitsize = 8 * self.ptrSize()
|
tdata.lbitsize = 8 * self.ptrSize()
|
||||||
tdata.code = TypeCode.Pointer
|
tdata.code = TypeCode.Pointer
|
||||||
tdata.ltarget = targetType
|
tdata.ltarget = targetType
|
||||||
self.registerType(typeId, tdata)
|
|
||||||
return self.Type(self, typeId)
|
return self.Type(self, typeId)
|
||||||
|
|
||||||
def createReferenceType(self, targetType):
|
def createReferenceType(self, targetType):
|
||||||
@@ -3805,14 +3792,12 @@ class DumperBase():
|
|||||||
raise RuntimeError('Expected type in createReferenceType(), got %s'
|
raise RuntimeError('Expected type in createReferenceType(), got %s'
|
||||||
% type(targetType))
|
% type(targetType))
|
||||||
typeId = targetType.typeId + ' &'
|
typeId = targetType.typeId + ' &'
|
||||||
tdata = self.TypeData(self)
|
tdata = self.TypeData(self, typeId)
|
||||||
tdata.name = targetType.name + ' &'
|
tdata.name = targetType.name + ' &'
|
||||||
tdata.typeId = typeId
|
|
||||||
tdata.code = TypeCode.Reference
|
tdata.code = TypeCode.Reference
|
||||||
tdata.ltarget = targetType
|
tdata.ltarget = targetType
|
||||||
tdata.lbitsize = 8 * self.ptrSize() # Needed for Gdb13393 test.
|
tdata.lbitsize = 8 * self.ptrSize() # Needed for Gdb13393 test.
|
||||||
#tdata.lbitsize = None
|
#tdata.lbitsize = None
|
||||||
self.registerType(typeId, tdata)
|
|
||||||
return self.Type(self, typeId)
|
return self.Type(self, typeId)
|
||||||
|
|
||||||
def createRValueReferenceType(self, targetType):
|
def createRValueReferenceType(self, targetType):
|
||||||
@@ -3820,13 +3805,11 @@ class DumperBase():
|
|||||||
raise RuntimeError('Expected type in createRValueReferenceType(), got %s'
|
raise RuntimeError('Expected type in createRValueReferenceType(), got %s'
|
||||||
% type(targetType))
|
% type(targetType))
|
||||||
typeId = targetType.typeId + ' &&'
|
typeId = targetType.typeId + ' &&'
|
||||||
tdata = self.TypeData(self)
|
tdata = self.TypeData(self, typeId)
|
||||||
tdata.name = targetType.name + ' &&'
|
tdata.name = targetType.name + ' &&'
|
||||||
tdata.typeId = typeId
|
|
||||||
tdata.code = TypeCode.RValueReference
|
tdata.code = TypeCode.RValueReference
|
||||||
tdata.ltarget = targetType
|
tdata.ltarget = targetType
|
||||||
tdata.lbitsize = None
|
tdata.lbitsize = None
|
||||||
self.registerType(typeId, tdata)
|
|
||||||
return self.Type(self, typeId)
|
return self.Type(self, typeId)
|
||||||
|
|
||||||
def createArrayType(self, targetType, count):
|
def createArrayType(self, targetType, count):
|
||||||
@@ -3843,13 +3826,11 @@ class DumperBase():
|
|||||||
type_id = '%s[%d]' % (targetTypeId, count)
|
type_id = '%s[%d]' % (targetTypeId, count)
|
||||||
type_name = '%s[%d]' % (targetType.name, count)
|
type_name = '%s[%d]' % (targetType.name, count)
|
||||||
|
|
||||||
tdata = self.TypeData(self)
|
tdata = self.TypeData(self, type_id)
|
||||||
tdata.name = type_name
|
tdata.name = type_name
|
||||||
tdata.typeId = type_id
|
|
||||||
tdata.code = TypeCode.Array
|
tdata.code = TypeCode.Array
|
||||||
tdata.ltarget = targetType
|
tdata.ltarget = targetType
|
||||||
tdata.lbitsize = targetType.lbitsize * count
|
tdata.lbitsize = targetType.lbitsize * count
|
||||||
self.registerType(type_id, tdata)
|
|
||||||
return self.Type(self, type_id)
|
return self.Type(self, type_id)
|
||||||
|
|
||||||
def createBitfieldType(self, targetType, bitsize):
|
def createBitfieldType(self, targetType, bitsize):
|
||||||
@@ -3857,13 +3838,11 @@ class DumperBase():
|
|||||||
raise RuntimeError('Expected type in createBitfieldType(), got %s'
|
raise RuntimeError('Expected type in createBitfieldType(), got %s'
|
||||||
% type(targetType))
|
% type(targetType))
|
||||||
typeId = '%s:%d' % (targetType.typeId, bitsize)
|
typeId = '%s:%d' % (targetType.typeId, bitsize)
|
||||||
tdata = self.TypeData(self)
|
tdata = self.TypeData(self, typeId)
|
||||||
tdata.name = '%s : %d' % (targetType.typeId, bitsize)
|
tdata.name = '%s : %d' % (targetType.typeId, bitsize)
|
||||||
tdata.typeId = typeId
|
|
||||||
tdata.code = TypeCode.Bitfield
|
tdata.code = TypeCode.Bitfield
|
||||||
tdata.ltarget = targetType
|
tdata.ltarget = targetType
|
||||||
tdata.lbitsize = bitsize
|
tdata.lbitsize = bitsize
|
||||||
self.registerType(typeId, tdata)
|
|
||||||
return self.Type(self, typeId)
|
return self.Type(self, typeId)
|
||||||
|
|
||||||
def createTypedefedType(self, targetType, typeName, typeId=None):
|
def createTypedefedType(self, targetType, typeName, typeId=None):
|
||||||
@@ -3875,15 +3854,13 @@ class DumperBase():
|
|||||||
# Happens for C-style struct in GDB: typedef { int x; } struct S1;
|
# Happens for C-style struct in GDB: typedef { int x; } struct S1;
|
||||||
if targetType.typeId == typeId:
|
if targetType.typeId == typeId:
|
||||||
return targetType
|
return targetType
|
||||||
tdata = self.TypeData(self)
|
tdata = self.TypeData(self, typeId)
|
||||||
tdata.name = typeName
|
tdata.name = typeName
|
||||||
tdata.typeId = typeId
|
|
||||||
tdata.code = TypeCode.Typedef
|
tdata.code = TypeCode.Typedef
|
||||||
tdata.ltarget = targetType
|
tdata.ltarget = targetType
|
||||||
tdata.lbitsize = targetType.lbitsize
|
tdata.lbitsize = targetType.lbitsize
|
||||||
#tdata.lfields = targetType.lfields
|
#tdata.lfields = targetType.lfields
|
||||||
tdata.lbitsize = targetType.lbitsize
|
tdata.lbitsize = targetType.lbitsize
|
||||||
self.registerType(typeId, tdata)
|
|
||||||
return self.Type(self, typeId)
|
return self.Type(self, typeId)
|
||||||
|
|
||||||
def knownArrayTypeSize(self):
|
def knownArrayTypeSize(self):
|
||||||
@@ -3939,9 +3916,7 @@ class DumperBase():
|
|||||||
return knownType
|
return knownType
|
||||||
|
|
||||||
#DumperBase.warn('FAKING: %s SIZE: %s' % (typish, size))
|
#DumperBase.warn('FAKING: %s SIZE: %s' % (typish, size))
|
||||||
tdata = self.TypeData(self)
|
tdata = self.TypeData(self, typish)
|
||||||
tdata.name = typish
|
|
||||||
tdata.typeId = typish
|
|
||||||
tdata.templateArguments = lambda: self.listTemplateParameters(typish)
|
tdata.templateArguments = lambda: self.listTemplateParameters(typish)
|
||||||
if size is not None:
|
if size is not None:
|
||||||
tdata.lbitsize = 8 * size
|
tdata.lbitsize = 8 * size
|
||||||
@@ -3950,8 +3925,7 @@ class DumperBase():
|
|||||||
tdata.lbitsize = 8 * self.ptrSize()
|
tdata.lbitsize = 8 * self.ptrSize()
|
||||||
tdata.ltarget = self.createType(typish[:-1].strip())
|
tdata.ltarget = self.createType(typish[:-1].strip())
|
||||||
|
|
||||||
self.registerType(typish, tdata)
|
typeobj = self.Type(self, tdata.typeId)
|
||||||
typeobj = self.Type(self, typish)
|
|
||||||
#DumperBase.warn('CREATE TYPE: %s' % typeobj.stringify())
|
#DumperBase.warn('CREATE TYPE: %s' % typeobj.stringify())
|
||||||
typeobj.check()
|
typeobj.check()
|
||||||
return typeobj
|
return typeobj
|
||||||
@@ -3979,11 +3953,8 @@ class DumperBase():
|
|||||||
raise RuntimeError('EXPECTING ADDRESS OR BYTES, GOT %s' % type(datish))
|
raise RuntimeError('EXPECTING ADDRESS OR BYTES, GOT %s' % type(datish))
|
||||||
|
|
||||||
def createProxyValue(self, proxy_data, type_name):
|
def createProxyValue(self, proxy_data, type_name):
|
||||||
tdata = self.TypeData(self)
|
tdata = self.TypeData(self, type_name)
|
||||||
tdata.name = type_name
|
|
||||||
tdata.typeId = type_name
|
|
||||||
tdata.code = TypeCode.Struct
|
tdata.code = TypeCode.Struct
|
||||||
self.registerType(type_name, tdata)
|
|
||||||
val = self.Value(self)
|
val = self.Value(self)
|
||||||
val._type = self.Type(self, type_name)
|
val._type = self.Type(self, type_name)
|
||||||
val.ldata = proxy_data
|
val.ldata = proxy_data
|
||||||
|
|||||||
@@ -367,9 +367,8 @@ class Dumper(DumperBase):
|
|||||||
typeId = self.nativeTypeId(nativeType)
|
typeId = self.nativeTypeId(nativeType)
|
||||||
res = self.typeData.get(typeId, None)
|
res = self.typeData.get(typeId, None)
|
||||||
if res is None:
|
if res is None:
|
||||||
tdata = self.TypeData(self)
|
tdata = self.TypeData(self, typeId)
|
||||||
tdata.name = str(nativeType)
|
tdata.name = str(nativeType)
|
||||||
tdata.typeId = typeId
|
|
||||||
tdata.lbitsize = nativeType.sizeof * 8
|
tdata.lbitsize = nativeType.sizeof * 8
|
||||||
tdata.code = {
|
tdata.code = {
|
||||||
#gdb.TYPE_CODE_TYPEDEF : TypeCode.Typedef, # Handled above.
|
#gdb.TYPE_CODE_TYPEDEF : TypeCode.Typedef, # Handled above.
|
||||||
@@ -401,7 +400,6 @@ class Dumper(DumperBase):
|
|||||||
self.listMembers(value, nativeType)
|
self.listMembers(value, nativeType)
|
||||||
tdata.templateArguments = lambda: \
|
tdata.templateArguments = lambda: \
|
||||||
self.listTemplateParameters(nativeType)
|
self.listTemplateParameters(nativeType)
|
||||||
self.registerType(typeId, tdata) # Fix up fields and template args
|
|
||||||
# warn('CREATE TYPE: %s' % typeId)
|
# warn('CREATE TYPE: %s' % typeId)
|
||||||
#else:
|
#else:
|
||||||
# warn('REUSE TYPE: %s' % typeId)
|
# warn('REUSE TYPE: %s' % typeId)
|
||||||
|
|||||||
@@ -434,8 +434,7 @@ class Dumper(DumperBase):
|
|||||||
if res is None:
|
if res is None:
|
||||||
# # This strips typedefs for pointers. We don't want that.
|
# # This strips typedefs for pointers. We don't want that.
|
||||||
# typeobj.nativeType = nativeType.GetUnqualifiedType()
|
# typeobj.nativeType = nativeType.GetUnqualifiedType()
|
||||||
tdata = self.TypeData(self)
|
tdata = self.TypeData(self, typeId)
|
||||||
tdata.typeId = typeId
|
|
||||||
tdata.name = typeName
|
tdata.name = typeName
|
||||||
tdata.lbitsize = nativeType.GetByteSize() * 8
|
tdata.lbitsize = nativeType.GetByteSize() * 8
|
||||||
if code == lldb.eTypeClassBuiltin:
|
if code == lldb.eTypeClassBuiltin:
|
||||||
@@ -471,8 +470,6 @@ class Dumper(DumperBase):
|
|||||||
tdata.code = TypeCode.Function
|
tdata.code = TypeCode.Function
|
||||||
elif code == lldb.eTypeClassMemberPointer:
|
elif code == lldb.eTypeClassMemberPointer:
|
||||||
tdata.code = TypeCode.MemberPointer
|
tdata.code = TypeCode.MemberPointer
|
||||||
|
|
||||||
self.registerType(typeId, tdata) # Fix up fields and template args
|
|
||||||
# warn('CREATE TYPE: %s' % typeId)
|
# warn('CREATE TYPE: %s' % typeId)
|
||||||
#else:
|
#else:
|
||||||
# warn('REUSE TYPE: %s' % typeId)
|
# warn('REUSE TYPE: %s' % typeId)
|
||||||
|
|||||||
@@ -234,14 +234,14 @@ def qdump__QStandardItem(d, value):
|
|||||||
vtable, dptr = value.split('pp')
|
vtable, dptr = value.split('pp')
|
||||||
if d.qtVersion() >= 0x060000:
|
if d.qtVersion() >= 0x060000:
|
||||||
model, parent, values, children, rows, cols, item = \
|
model, parent, values, children, rows, cols, item = \
|
||||||
d.split('pp{@QList<@QStandardItemData>}{@QList<@QStandardItem*>}IIp', dptr)
|
d.split('pp{@QList<@QStandardItemData>}{@QList<@QStandardItem *>}IIp', dptr)
|
||||||
else:
|
else:
|
||||||
# There used to be a virtual destructor that got removed in
|
# There used to be a virtual destructor that got removed in
|
||||||
# 88b6abcebf29b455438 on Apr 18 17:01:22 2017
|
# 88b6abcebf29b455438 on Apr 18 17:01:22 2017
|
||||||
if d.qtVersion() < 0x050900 and not d.isMsvcTarget():
|
if d.qtVersion() < 0x050900 and not d.isMsvcTarget():
|
||||||
dptr += d.ptrSize();
|
dptr += d.ptrSize();
|
||||||
model, parent, values, children, rows, cols, item = \
|
model, parent, values, children, rows, cols, item = \
|
||||||
d.split('pp{@QVector<@QStandardItemData>}{@QVector<@QStandardItem*>}IIp', dptr)
|
d.split('pp{@QVector<@QStandardItemData>}{@QVector<@QStandardItem *>}IIp', dptr)
|
||||||
|
|
||||||
d.putEmptyValue()
|
d.putEmptyValue()
|
||||||
d.putExpandable()
|
d.putExpandable()
|
||||||
|
|||||||
@@ -48,16 +48,15 @@ QAbstractFileEngine *FSEngineHandler::create(const QString &fileName) const
|
|||||||
return new FixedListFSEngine(rootFilePath.pathAppended(scheme), filteredRoots);
|
return new FixedListFSEngine(rootFilePath.pathAppended(scheme), filteredRoots);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FilePath filePath = FilePath::fromString(fixedFileName);
|
||||||
|
if (filePath.needsDevice())
|
||||||
|
return new FSEngineImpl(filePath);
|
||||||
|
|
||||||
|
if (fixedFileName.compare(QDir::rootPath(), Qt::CaseInsensitive) == 0)
|
||||||
|
return new RootInjectFSEngine(fixedFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePath filePath = FilePath::fromString(fixedFileName);
|
|
||||||
if (filePath.needsDevice())
|
|
||||||
return new FSEngineImpl(filePath);
|
|
||||||
|
|
||||||
|
|
||||||
if (fixedFileName.compare(QDir::rootPath(), Qt::CaseInsensitive) == 0)
|
|
||||||
return new RootInjectFSEngine(fixedFileName);
|
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,12 +72,12 @@ public:
|
|||||||
: OsSpecificAspects::fileNameCaseSensitivity(hostOs());
|
: OsSpecificAspects::fileNameCaseSensitivity(hostOs());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QChar pathListSeparator()
|
static constexpr QChar pathListSeparator()
|
||||||
{
|
{
|
||||||
return OsSpecificAspects::pathListSeparator(hostOs());
|
return OsSpecificAspects::pathListSeparator(hostOs());
|
||||||
}
|
}
|
||||||
|
|
||||||
static Qt::KeyboardModifier controlModifier()
|
static constexpr Qt::KeyboardModifier controlModifier()
|
||||||
{
|
{
|
||||||
return OsSpecificAspects::controlModifier(hostOs());
|
return OsSpecificAspects::controlModifier(hostOs());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,22 +24,22 @@ inline QString withExecutableSuffix(OsType osType, const QString &executable)
|
|||||||
return finalName;
|
return finalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Qt::CaseSensitivity fileNameCaseSensitivity(OsType osType)
|
constexpr Qt::CaseSensitivity fileNameCaseSensitivity(OsType osType)
|
||||||
{
|
{
|
||||||
return osType == OsTypeWindows || osType == OsTypeMac ? Qt::CaseInsensitive : Qt::CaseSensitive;
|
return osType == OsTypeWindows || osType == OsTypeMac ? Qt::CaseInsensitive : Qt::CaseSensitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Qt::CaseSensitivity envVarCaseSensitivity(OsType osType)
|
constexpr Qt::CaseSensitivity envVarCaseSensitivity(OsType osType)
|
||||||
{
|
{
|
||||||
return fileNameCaseSensitivity(osType);
|
return fileNameCaseSensitivity(osType);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QChar pathListSeparator(OsType osType)
|
constexpr QChar pathListSeparator(OsType osType)
|
||||||
{
|
{
|
||||||
return QLatin1Char(osType == OsTypeWindows ? ';' : ':');
|
return QLatin1Char(osType == OsTypeWindows ? ';' : ':');
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Qt::KeyboardModifier controlModifier(OsType osType)
|
constexpr Qt::KeyboardModifier controlModifier(OsType osType)
|
||||||
{
|
{
|
||||||
return osType == OsTypeMac ? Qt::MetaModifier : Qt::ControlModifier;
|
return osType == OsTypeMac ? Qt::MetaModifier : Qt::ControlModifier;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,6 @@
|
|||||||
#include <qtsupport/qtoutputformatter.h>
|
#include <qtsupport/qtoutputformatter.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QDir>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <new>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@@ -839,7 +840,7 @@ void ClangdClient::followSymbol(TextDocument *document,
|
|||||||
d->followSymbol = nullptr;
|
d->followSymbol = nullptr;
|
||||||
|
|
||||||
const QTextCursor adjustedCursor = d->adjustedCursor(cursor, document);
|
const QTextCursor adjustedCursor = d->adjustedCursor(cursor, document);
|
||||||
if (!resolveTarget) {
|
if (followTo == FollowTo::SymbolDef && !resolveTarget) {
|
||||||
symbolSupport().findLinkAt(document, adjustedCursor, callback, false);
|
symbolSupport().findLinkAt(document, adjustedCursor, callback, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1356,8 +1357,13 @@ void ClangdClient::Private::handleSemanticTokens(TextDocument *doc,
|
|||||||
doc = QPointer(doc), rev = doc->document()->revision(),
|
doc = QPointer(doc), rev = doc->document()->revision(),
|
||||||
clangdVersion = q->versionNumber(),
|
clangdVersion = q->versionNumber(),
|
||||||
this] {
|
this] {
|
||||||
return Utils::runAsync(doSemanticHighlighting, filePath, tokens, text, ast, doc, rev,
|
try {
|
||||||
clangdVersion, highlightingTimer);
|
return Utils::runAsync(doSemanticHighlighting, filePath, tokens, text, ast, doc,
|
||||||
|
rev, clangdVersion, highlightingTimer);
|
||||||
|
} catch (const std::exception &e) {
|
||||||
|
qWarning() << "caught" << e.what() << "in main highlighting thread";
|
||||||
|
return QFuture<HighlightingResult>();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isTesting) {
|
if (isTesting) {
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
|
|
||||||
|
#include <new>
|
||||||
|
|
||||||
using namespace LanguageClient;
|
using namespace LanguageClient;
|
||||||
using namespace LanguageServerProtocol;
|
using namespace LanguageServerProtocol;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
@@ -345,7 +347,15 @@ void doSemanticHighlighting(
|
|||||||
return HighlightingResult(token.line, token.column, token.length, styles);
|
return HighlightingResult(token.line, token.column, token.length, styles);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto results = QtConcurrent::blockingMapped<HighlightingResults>(tokens, toResult);
|
const auto safeToResult = [&toResult](const ExpandedSemanticToken &token) {
|
||||||
|
try {
|
||||||
|
return toResult(token);
|
||||||
|
} catch (const std::exception &e) {
|
||||||
|
qWarning() << "caught" << e.what() << "in toResult()";
|
||||||
|
return HighlightingResult();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
auto results = QtConcurrent::blockingMapped<HighlightingResults>(tokens, safeToResult);
|
||||||
const QList<BlockRange> ifdefedOutBlocks = cleanupDisabledCode(results, &doc, docContents);
|
const QList<BlockRange> ifdefedOutBlocks = cleanupDisabledCode(results, &doc, docContents);
|
||||||
ExtraHighlightingResultsCollector(future, results, filePath, ast, &doc, docContents,
|
ExtraHighlightingResultsCollector(future, results, filePath, ast, &doc, docContents,
|
||||||
clangdVersion).collect();
|
clangdVersion).collect();
|
||||||
|
|||||||
@@ -270,6 +270,19 @@ void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &dat
|
|||||||
CppModelManager::Backend::Builtin);
|
CppModelManager::Backend::Builtin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClangModelManagerSupport::followSymbolToType(const CppEditor::CursorInEditor &data,
|
||||||
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
|
bool inNextSplit)
|
||||||
|
{
|
||||||
|
if (ClangdClient * const client = clientForFile(data.filePath())) {
|
||||||
|
client->followSymbol(data.textDocument(), data.cursor(), data.editorWidget(),
|
||||||
|
processLinkCallback, false, FollowTo::SymbolType, inNextSplit);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CppModelManager::followSymbolToType(data, processLinkCallback, inNextSplit,
|
||||||
|
CppModelManager::Backend::Builtin);
|
||||||
|
}
|
||||||
|
|
||||||
void ClangModelManagerSupport::switchDeclDef(const CppEditor::CursorInEditor &data,
|
void ClangModelManagerSupport::switchDeclDef(const CppEditor::CursorInEditor &data,
|
||||||
const Utils::LinkHandler &processLinkCallback)
|
const Utils::LinkHandler &processLinkCallback)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ private:
|
|||||||
void followSymbol(const CppEditor::CursorInEditor &data,
|
void followSymbol(const CppEditor::CursorInEditor &data,
|
||||||
const Utils::LinkHandler &processLinkCallback, bool resolveTarget,
|
const Utils::LinkHandler &processLinkCallback, bool resolveTarget,
|
||||||
bool inNextSplit) override;
|
bool inNextSplit) override;
|
||||||
|
void followSymbolToType(const CppEditor::CursorInEditor &data,
|
||||||
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
|
bool inNextSplit) override;
|
||||||
void switchDeclDef(const CppEditor::CursorInEditor &data,
|
void switchDeclDef(const CppEditor::CursorInEditor &data,
|
||||||
const Utils::LinkHandler &processLinkCallback) override;
|
const Utils::LinkHandler &processLinkCallback) override;
|
||||||
void startLocalRenaming(const CppEditor::CursorInEditor &data,
|
void startLocalRenaming(const CppEditor::CursorInEditor &data,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.5)
|
|||||||
project(clangtools LANGUAGES CXX)
|
project(clangtools LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
||||||
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
set(CMAKE_AUTOUIC ON)
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
@@ -17,8 +16,6 @@ find_package(Qt5 COMPONENTS Widgets REQUIRED)
|
|||||||
add_executable(clangtools
|
add_executable(clangtools
|
||||||
main.cpp
|
main.cpp
|
||||||
clang-analyzer.dividezero.cpp
|
clang-analyzer.dividezero.cpp
|
||||||
clang.unused-parameter.cpp
|
|
||||||
clang.unused-parameter.h
|
|
||||||
clazy.qgetenv.cpp
|
clazy.qgetenv.cpp
|
||||||
tidy.modernize-use-nullptr.cpp
|
tidy.modernize-use-nullptr.cpp
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1301,8 +1301,8 @@ static void addCMakeConfigurePresetToInitialArguments(QStringList &initialArgume
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Utils::EnvironmentItems getEnvironmentItemsFromCMakePreset(const CMakeProject *project,
|
static Utils::EnvironmentItems getEnvironmentItemsFromCMakeConfigurePreset(
|
||||||
const Kit *k)
|
const CMakeProject *project, const Kit *k)
|
||||||
|
|
||||||
{
|
{
|
||||||
Utils::EnvironmentItems envItems;
|
Utils::EnvironmentItems envItems;
|
||||||
@@ -1324,6 +1324,27 @@ static Utils::EnvironmentItems getEnvironmentItemsFromCMakePreset(const CMakePro
|
|||||||
return envItems;
|
return envItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Utils::EnvironmentItems getEnvironmentItemsFromCMakeBuildPreset(
|
||||||
|
const CMakeProject *project, const Kit *k, const QString &buildPresetName)
|
||||||
|
|
||||||
|
{
|
||||||
|
Utils::EnvironmentItems envItems;
|
||||||
|
|
||||||
|
const CMakeConfigItem presetItem = CMakeConfigurationKitAspect::cmakePresetConfigItem(k);
|
||||||
|
if (presetItem.isNull())
|
||||||
|
return envItems;
|
||||||
|
|
||||||
|
PresetsDetails::BuildPreset buildPreset
|
||||||
|
= Utils::findOrDefault(project->presetsData().buildPresets,
|
||||||
|
[buildPresetName](const PresetsDetails::BuildPreset &preset) {
|
||||||
|
return preset.name == buildPresetName;
|
||||||
|
});
|
||||||
|
|
||||||
|
CMakePresets::Macros::expand(buildPreset, envItems, project->projectDirectory());
|
||||||
|
|
||||||
|
return envItems;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// CMakeBuildConfigurationPrivate:
|
// CMakeBuildConfigurationPrivate:
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -1423,8 +1444,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
|||||||
addAspect<BuildTypeAspect>();
|
addAspect<BuildTypeAspect>();
|
||||||
addAspect<QtSupport::QmlDebuggingAspect>(this);
|
addAspect<QtSupport::QmlDebuggingAspect>(this);
|
||||||
|
|
||||||
appendInitialBuildStep(Constants::CMAKE_BUILD_STEP_ID);
|
setInitialBuildAndCleanSteps(target);
|
||||||
appendInitialCleanStep(Constants::CMAKE_BUILD_STEP_ID);
|
|
||||||
|
|
||||||
setInitializer([this, target](const BuildInfo &info) {
|
setInitializer([this, target](const BuildInfo &info) {
|
||||||
const Kit *k = target->kit();
|
const Kit *k = target->kit();
|
||||||
@@ -1527,7 +1547,7 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
|||||||
cmd.addArg("-DCMAKE_CXX_FLAGS_INIT:STRING=%{" + QLatin1String(QT_QML_DEBUG_FLAG) + "}");
|
cmd.addArg("-DCMAKE_CXX_FLAGS_INIT:STRING=%{" + QLatin1String(QT_QML_DEBUG_FLAG) + "}");
|
||||||
|
|
||||||
CMakeProject *cmakeProject = static_cast<CMakeProject *>(target->project());
|
CMakeProject *cmakeProject = static_cast<CMakeProject *>(target->project());
|
||||||
setUserConfigureEnvironmentChanges(getEnvironmentItemsFromCMakePreset(cmakeProject, k));
|
setUserConfigureEnvironmentChanges(getEnvironmentItemsFromCMakeConfigurePreset(cmakeProject, k));
|
||||||
|
|
||||||
QStringList initialCMakeArguments = cmd.splitArguments();
|
QStringList initialCMakeArguments = cmd.splitArguments();
|
||||||
addCMakeConfigurePresetToInitialArguments(initialCMakeArguments,
|
addCMakeConfigurePresetToInitialArguments(initialCMakeArguments,
|
||||||
@@ -1537,6 +1557,8 @@ CMakeBuildConfiguration::CMakeBuildConfiguration(Target *target, Id id)
|
|||||||
m_buildSystem->setInitialCMakeArguments(initialCMakeArguments);
|
m_buildSystem->setInitialCMakeArguments(initialCMakeArguments);
|
||||||
m_buildSystem->setCMakeBuildType(buildType);
|
m_buildSystem->setCMakeBuildType(buildType);
|
||||||
updateAndEmitConfigureEnvironmentChanged();
|
updateAndEmitConfigureEnvironmentChanged();
|
||||||
|
|
||||||
|
setBuildPresetToBuildSteps(target);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1799,6 +1821,104 @@ CMakeConfig CMakeBuildConfiguration::signingFlags() const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMakeBuildConfiguration::setInitialBuildAndCleanSteps(const ProjectExplorer::Target *target)
|
||||||
|
{
|
||||||
|
const CMakeConfigItem presetItem = CMakeConfigurationKitAspect::cmakePresetConfigItem(
|
||||||
|
target->kit());
|
||||||
|
|
||||||
|
if (!presetItem.isNull()) {
|
||||||
|
const QString presetName = presetItem.expandedValue(target->kit());
|
||||||
|
const CMakeProject *project = static_cast<const CMakeProject *>(target->project());
|
||||||
|
|
||||||
|
const auto buildPresets = project->presetsData().buildPresets;
|
||||||
|
const int count = std::count_if(buildPresets.begin(),
|
||||||
|
buildPresets.end(),
|
||||||
|
[presetName](const PresetsDetails::BuildPreset &preset) {
|
||||||
|
return preset.configurePreset == presetName
|
||||||
|
&& !preset.hidden.value();
|
||||||
|
});
|
||||||
|
|
||||||
|
for (int i = 0; i < count; ++i)
|
||||||
|
appendInitialBuildStep(Constants::CMAKE_BUILD_STEP_ID);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
appendInitialBuildStep(Constants::CMAKE_BUILD_STEP_ID);
|
||||||
|
}
|
||||||
|
appendInitialCleanStep(Constants::CMAKE_BUILD_STEP_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeBuildConfiguration::setBuildPresetToBuildSteps(const ProjectExplorer::Target *target)
|
||||||
|
{
|
||||||
|
const CMakeConfigItem presetItem = CMakeConfigurationKitAspect::cmakePresetConfigItem(
|
||||||
|
target->kit());
|
||||||
|
|
||||||
|
if (presetItem.isNull())
|
||||||
|
return;
|
||||||
|
|
||||||
|
const QString presetName = presetItem.expandedValue(target->kit());
|
||||||
|
const CMakeProject *project = static_cast<const CMakeProject *>(target->project());
|
||||||
|
|
||||||
|
const auto allBuildPresets = project->presetsData().buildPresets;
|
||||||
|
const auto buildPresets
|
||||||
|
= Utils::filtered(allBuildPresets, [presetName](const PresetsDetails::BuildPreset &preset) {
|
||||||
|
return preset.configurePreset == presetName && !preset.hidden.value();
|
||||||
|
});
|
||||||
|
|
||||||
|
const QList<BuildStep *> buildStepList
|
||||||
|
= Utils::filtered(buildSteps()->steps(), [](const BuildStep *bs) {
|
||||||
|
return bs->id() == Constants::CMAKE_BUILD_STEP_ID;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (buildPresets.size() != buildStepList.size())
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (qsizetype i = 0; i < buildStepList.size(); ++i) {
|
||||||
|
CMakeBuildStep *cbs = qobject_cast<CMakeBuildStep *>(buildStepList[i]);
|
||||||
|
cbs->setBuildPreset(buildPresets[i].name);
|
||||||
|
cbs->setUserEnvironmentChanges(
|
||||||
|
getEnvironmentItemsFromCMakeBuildPreset(project, target->kit(), buildPresets[i].name));
|
||||||
|
|
||||||
|
if (buildPresets[i].targets) {
|
||||||
|
QString targets = buildPresets[i].targets.value().join(" ");
|
||||||
|
|
||||||
|
CMakePresets::Macros::expand(buildPresets[i],
|
||||||
|
cbs->environment(),
|
||||||
|
project->projectDirectory(),
|
||||||
|
targets);
|
||||||
|
|
||||||
|
cbs->setBuildTargets(targets.split(" "));
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList cmakeArguments;
|
||||||
|
if (buildPresets[i].jobs)
|
||||||
|
cmakeArguments.append(QString("-j %1").arg(buildPresets[i].jobs.value()));
|
||||||
|
if (buildPresets[i].verbose && buildPresets[i].verbose.value())
|
||||||
|
cmakeArguments.append("--verbose");
|
||||||
|
if (buildPresets[i].cleanFirst && buildPresets[i].cleanFirst.value())
|
||||||
|
cmakeArguments.append("--clean-first");
|
||||||
|
if (!cmakeArguments.isEmpty())
|
||||||
|
cbs->setCMakeArguments(cmakeArguments);
|
||||||
|
|
||||||
|
if (buildPresets[i].nativeToolOptions) {
|
||||||
|
QString nativeToolOptions = buildPresets[i].nativeToolOptions.value().join(" ");
|
||||||
|
|
||||||
|
CMakePresets::Macros::expand(buildPresets[i],
|
||||||
|
cbs->environment(),
|
||||||
|
project->projectDirectory(),
|
||||||
|
nativeToolOptions);
|
||||||
|
|
||||||
|
cbs->setToolArguments(nativeToolOptions.split(" "));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buildPresets[i].configuration)
|
||||||
|
cbs->setConfiguration(buildPresets[i].configuration.value());
|
||||||
|
|
||||||
|
// Leave only the first build step enabled
|
||||||
|
if (i > 0)
|
||||||
|
cbs->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class CMakeBuildConfigurationFactory
|
\class CMakeBuildConfigurationFactory
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -69,6 +69,9 @@ private:
|
|||||||
|
|
||||||
virtual CMakeConfig signingFlags() const;
|
virtual CMakeConfig signingFlags() const;
|
||||||
|
|
||||||
|
void setInitialBuildAndCleanSteps(const ProjectExplorer::Target *target);
|
||||||
|
void setBuildPresetToBuildSteps(const ProjectExplorer::Target *target);
|
||||||
|
|
||||||
Internal::CMakeBuildSystem *m_buildSystem = nullptr;
|
Internal::CMakeBuildSystem *m_buildSystem = nullptr;
|
||||||
|
|
||||||
friend class Internal::CMakeBuildSettingsWidget;
|
friend class Internal::CMakeBuildSettingsWidget;
|
||||||
|
|||||||
@@ -7,11 +7,14 @@
|
|||||||
#include "cmakebuildsystem.h"
|
#include "cmakebuildsystem.h"
|
||||||
#include "cmakekitinformation.h"
|
#include "cmakekitinformation.h"
|
||||||
#include "cmakeparser.h"
|
#include "cmakeparser.h"
|
||||||
|
#include "cmakeproject.h"
|
||||||
#include "cmakeprojectconstants.h"
|
#include "cmakeprojectconstants.h"
|
||||||
#include "cmaketool.h"
|
#include "cmaketool.h"
|
||||||
|
|
||||||
#include <coreplugin/find/itemviewfind.h>
|
#include <coreplugin/find/itemviewfind.h>
|
||||||
#include <projectexplorer/buildsteplist.h>
|
#include <projectexplorer/buildsteplist.h>
|
||||||
|
#include <projectexplorer/devicesupport/idevice.h>
|
||||||
|
#include <projectexplorer/environmentwidget.h>
|
||||||
#include <projectexplorer/gnumakeparser.h>
|
#include <projectexplorer/gnumakeparser.h>
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
#include <projectexplorer/processparameters.h>
|
#include <projectexplorer/processparameters.h>
|
||||||
@@ -29,6 +32,7 @@
|
|||||||
#include <QListWidget>
|
#include <QListWidget>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
#include <QCheckBox>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -42,6 +46,9 @@ const char CMAKE_ARGUMENTS_KEY[] = "CMakeProjectManager.MakeStep.CMakeArguments"
|
|||||||
const char TOOL_ARGUMENTS_KEY[] = "CMakeProjectManager.MakeStep.AdditionalArguments";
|
const char TOOL_ARGUMENTS_KEY[] = "CMakeProjectManager.MakeStep.AdditionalArguments";
|
||||||
const char IOS_AUTOMATIC_PROVISIONG_UPDATES_ARGUMENTS_KEY[] =
|
const char IOS_AUTOMATIC_PROVISIONG_UPDATES_ARGUMENTS_KEY[] =
|
||||||
"CMakeProjectManager.MakeStep.iOSAutomaticProvisioningUpdates";
|
"CMakeProjectManager.MakeStep.iOSAutomaticProvisioningUpdates";
|
||||||
|
const char CLEAR_SYSTEM_ENVIRONMENT_KEY[] = "CMakeProjectManager.MakeStep.ClearSystemEnvironment";
|
||||||
|
const char USER_ENVIRONMENT_CHANGES_KEY[] = "CMakeProjectManager.MakeStep.UserEnvironmentChanges";
|
||||||
|
const char BUILD_PRESET_KEY[] = "CMakeProjectManager.MakeStep.BuildPreset";
|
||||||
|
|
||||||
// CmakeProgressParser
|
// CmakeProgressParser
|
||||||
|
|
||||||
@@ -186,11 +193,12 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Utils::Id id) :
|
|||||||
|
|
||||||
setCommandLineProvider([this] { return cmakeCommand(); });
|
setCommandLineProvider([this] { return cmakeCommand(); });
|
||||||
|
|
||||||
setEnvironmentModifier([](Environment &env) {
|
setEnvironmentModifier([this](Environment &env) {
|
||||||
const QString ninjaProgressString = "[%f/%t "; // ninja: [33/100
|
const QString ninjaProgressString = "[%f/%t "; // ninja: [33/100
|
||||||
env.setupEnglishOutput();
|
env.setupEnglishOutput();
|
||||||
if (!env.expandedValueForKey("NINJA_STATUS").startsWith(ninjaProgressString))
|
if (!env.expandedValueForKey("NINJA_STATUS").startsWith(ninjaProgressString))
|
||||||
env.set("NINJA_STATUS", ninjaProgressString + "%o/sec] ");
|
env.set("NINJA_STATUS", ninjaProgressString + "%o/sec] ");
|
||||||
|
env.modify(m_userEnvironmentChanges);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(target(), &Target::parsingFinished, this, [this](bool success) {
|
connect(target(), &Target::parsingFinished, this, [this](bool success) {
|
||||||
@@ -207,12 +215,26 @@ QVariantMap CMakeBuildStep::toMap() const
|
|||||||
{
|
{
|
||||||
QVariantMap map(AbstractProcessStep::toMap());
|
QVariantMap map(AbstractProcessStep::toMap());
|
||||||
map.insert(BUILD_TARGETS_KEY, m_buildTargets);
|
map.insert(BUILD_TARGETS_KEY, m_buildTargets);
|
||||||
|
map.insert(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY), m_clearSystemEnvironment);
|
||||||
|
map.insert(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY), EnvironmentItem::toStringList(m_userEnvironmentChanges));
|
||||||
|
map.insert(QLatin1String(BUILD_PRESET_KEY), m_buildPreset);
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeBuildStep::fromMap(const QVariantMap &map)
|
bool CMakeBuildStep::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
setBuildTargets(map.value(BUILD_TARGETS_KEY).toStringList());
|
setBuildTargets(map.value(BUILD_TARGETS_KEY).toStringList());
|
||||||
|
|
||||||
|
m_clearSystemEnvironment = map.value(QLatin1String(CLEAR_SYSTEM_ENVIRONMENT_KEY))
|
||||||
|
.toBool();
|
||||||
|
m_userEnvironmentChanges = EnvironmentItem::fromStringList(
|
||||||
|
map.value(QLatin1String(USER_ENVIRONMENT_CHANGES_KEY)).toStringList());
|
||||||
|
|
||||||
|
updateAndEmitEnvironmentChanged();
|
||||||
|
|
||||||
|
m_buildPreset = map.value(QLatin1String(BUILD_PRESET_KEY)).toString();
|
||||||
|
|
||||||
return BuildStep::fromMap(map);
|
return BuildStep::fromMap(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,6 +370,14 @@ QString CMakeBuildStep::defaultBuildTarget() const
|
|||||||
return allTarget();
|
return allTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CMakeBuildStep::isCleanStep() const
|
||||||
|
{
|
||||||
|
const BuildStepList *const bsl = stepList();
|
||||||
|
QTC_ASSERT(bsl, return false);
|
||||||
|
const Utils::Id parentId = bsl->id();
|
||||||
|
return parentId == ProjectExplorer::Constants::BUILDSTEPS_CLEAN;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList CMakeBuildStep::buildTargets() const
|
QStringList CMakeBuildStep::buildTargets() const
|
||||||
{
|
{
|
||||||
return m_buildTargets;
|
return m_buildTargets;
|
||||||
@@ -401,7 +431,10 @@ CommandLine CMakeBuildStep::cmakeCommand() const
|
|||||||
auto bs = qobject_cast<CMakeBuildSystem*>(buildSystem());
|
auto bs = qobject_cast<CMakeBuildSystem*>(buildSystem());
|
||||||
if (bs && bs->isMultiConfigReader()) {
|
if (bs && bs->isMultiConfigReader()) {
|
||||||
cmd.addArg("--config");
|
cmd.addArg("--config");
|
||||||
cmd.addArg(bs->cmakeBuildType());
|
if (m_configuration)
|
||||||
|
cmd.addArg(m_configuration.value());
|
||||||
|
else
|
||||||
|
cmd.addArg(bs->cmakeBuildType());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_cmakeArguments->value().isEmpty())
|
if (!m_cmakeArguments->value().isEmpty())
|
||||||
@@ -453,13 +486,36 @@ QString CMakeBuildStep::activeRunConfigTarget() const
|
|||||||
return rc ? rc->buildKey() : QString();
|
return rc ? rc->buildKey() : QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMakeBuildStep::setBuildPreset(const QString &preset)
|
||||||
|
{
|
||||||
|
m_buildPreset = preset;
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *CMakeBuildStep::createConfigWidget()
|
QWidget *CMakeBuildStep::createConfigWidget()
|
||||||
{
|
{
|
||||||
auto updateDetails = [this] {
|
auto updateDetails = [this] {
|
||||||
ProcessParameters param;
|
ProcessParameters param;
|
||||||
setupProcessParameters(¶m);
|
setupProcessParameters(¶m);
|
||||||
param.setCommandLine(cmakeCommand());
|
param.setCommandLine(cmakeCommand());
|
||||||
setSummaryText(param.summary(displayName()));
|
|
||||||
|
QString summaryText = param.summary(displayName());
|
||||||
|
|
||||||
|
if (!m_buildPreset.isEmpty()) {
|
||||||
|
const CMakeProject *cp = static_cast<const CMakeProject *>(project());
|
||||||
|
|
||||||
|
const auto buildPresets = cp->presetsData().buildPresets;
|
||||||
|
const PresetsDetails::BuildPreset preset
|
||||||
|
= Utils::findOrDefault(buildPresets, [this](const PresetsDetails::BuildPreset &bp) {
|
||||||
|
return bp.name == m_buildPreset;
|
||||||
|
});
|
||||||
|
|
||||||
|
const QString presetDisplayName = preset.displayName ? preset.displayName.value()
|
||||||
|
: preset.name;
|
||||||
|
if (!presetDisplayName.isEmpty())
|
||||||
|
summaryText.append(QString("<br><b>Preset</b>: %1").arg(presetDisplayName));
|
||||||
|
}
|
||||||
|
|
||||||
|
setSummaryText(summaryText);
|
||||||
};
|
};
|
||||||
|
|
||||||
setDisplayName(tr("Build", "ConfigWidget display name."));
|
setDisplayName(tr("Build", "ConfigWidget display name."));
|
||||||
@@ -473,6 +529,34 @@ QWidget *CMakeBuildStep::createConfigWidget()
|
|||||||
auto frame = ItemViewFind::createSearchableWrapper(buildTargetsView,
|
auto frame = ItemViewFind::createSearchableWrapper(buildTargetsView,
|
||||||
ItemViewFind::LightColored);
|
ItemViewFind::LightColored);
|
||||||
|
|
||||||
|
auto createAndAddEnvironmentWidgets = [this](Layouting::Form &builder) {
|
||||||
|
auto clearBox = new QCheckBox(tr("Clear system environment"));
|
||||||
|
clearBox->setChecked(useClearEnvironment());
|
||||||
|
|
||||||
|
auto envWidget = new EnvironmentWidget(nullptr, EnvironmentWidget::TypeLocal, clearBox);
|
||||||
|
envWidget->setBaseEnvironment(baseEnvironment());
|
||||||
|
envWidget->setBaseEnvironmentText(baseEnvironmentText());
|
||||||
|
envWidget->setUserChanges(userEnvironmentChanges());
|
||||||
|
|
||||||
|
connect(envWidget, &EnvironmentWidget::userChangesChanged, this, [this, envWidget] {
|
||||||
|
setUserEnvironmentChanges(envWidget->userChanges());
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(clearBox, &QAbstractButton::toggled, this, [this, envWidget](bool checked) {
|
||||||
|
setUseClearEnvironment(checked);
|
||||||
|
envWidget->setBaseEnvironment(baseEnvironment());
|
||||||
|
envWidget->setBaseEnvironmentText(baseEnvironmentText());
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(this, &CMakeBuildStep::environmentChanged, this, [this, envWidget] {
|
||||||
|
envWidget->setBaseEnvironment(baseEnvironment());
|
||||||
|
envWidget->setBaseEnvironmentText(baseEnvironmentText());
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.addRow(clearBox);
|
||||||
|
builder.addRow(envWidget);
|
||||||
|
};
|
||||||
|
|
||||||
Layouting::Form builder;
|
Layouting::Form builder;
|
||||||
builder.addRow(m_cmakeArguments);
|
builder.addRow(m_cmakeArguments);
|
||||||
builder.addRow(m_toolArguments);
|
builder.addRow(m_toolArguments);
|
||||||
@@ -481,6 +565,10 @@ QWidget *CMakeBuildStep::createConfigWidget()
|
|||||||
builder.addRow(m_useiOSAutomaticProvisioningUpdates);
|
builder.addRow(m_useiOSAutomaticProvisioningUpdates);
|
||||||
|
|
||||||
builder.addRow({new QLabel(tr("Targets:")), frame});
|
builder.addRow({new QLabel(tr("Targets:")), frame});
|
||||||
|
|
||||||
|
if (!isCleanStep() && !m_buildPreset.isEmpty())
|
||||||
|
createAndAddEnvironmentWidgets(builder);
|
||||||
|
|
||||||
auto widget = builder.emerge(Layouting::WithoutMargins);
|
auto widget = builder.emerge(Layouting::WithoutMargins);
|
||||||
|
|
||||||
updateDetails();
|
updateDetails();
|
||||||
@@ -552,6 +640,83 @@ void CMakeBuildStep::updateBuildTargetsModel()
|
|||||||
emit buildTargetsChanged();
|
emit buildTargetsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMakeBuildStep::setConfiguration(const QString &configuration)
|
||||||
|
{
|
||||||
|
m_configuration = configuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeBuildStep::setToolArguments(const QStringList &nativeToolArguments)
|
||||||
|
{
|
||||||
|
m_toolArguments->setValue(nativeToolArguments.join(" "));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeBuildStep::setCMakeArguments(const QStringList &cmakeArguments)
|
||||||
|
{
|
||||||
|
m_cmakeArguments->setValue(cmakeArguments.join(" "));
|
||||||
|
}
|
||||||
|
|
||||||
|
Environment CMakeBuildStep::environment() const
|
||||||
|
{
|
||||||
|
return m_environment;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeBuildStep::setUserEnvironmentChanges(const Utils::EnvironmentItems &diff)
|
||||||
|
{
|
||||||
|
if (m_userEnvironmentChanges == diff)
|
||||||
|
return;
|
||||||
|
m_userEnvironmentChanges = diff;
|
||||||
|
updateAndEmitEnvironmentChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
EnvironmentItems CMakeBuildStep::userEnvironmentChanges() const
|
||||||
|
{
|
||||||
|
return m_userEnvironmentChanges;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CMakeBuildStep::useClearEnvironment() const
|
||||||
|
{
|
||||||
|
return m_clearSystemEnvironment;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeBuildStep::setUseClearEnvironment(bool b)
|
||||||
|
{
|
||||||
|
if (useClearEnvironment() == b)
|
||||||
|
return;
|
||||||
|
m_clearSystemEnvironment = b;
|
||||||
|
updateAndEmitEnvironmentChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeBuildStep::updateAndEmitEnvironmentChanged()
|
||||||
|
{
|
||||||
|
Environment env = baseEnvironment();
|
||||||
|
env.modify(userEnvironmentChanges());
|
||||||
|
if (env == m_environment)
|
||||||
|
return;
|
||||||
|
m_environment = env;
|
||||||
|
emit environmentChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
Environment CMakeBuildStep::baseEnvironment() const
|
||||||
|
{
|
||||||
|
Environment result;
|
||||||
|
if (!useClearEnvironment()) {
|
||||||
|
ProjectExplorer::IDevice::ConstPtr devicePtr = BuildDeviceKitAspect::device(kit());
|
||||||
|
result = devicePtr ? devicePtr->systemEnvironment() : Environment::systemEnvironment();
|
||||||
|
}
|
||||||
|
buildConfiguration()->addToEnvironment(result);
|
||||||
|
kit()->addToBuildEnvironment(result);
|
||||||
|
result.modify(project()->additionalEnvironment());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeBuildStep::baseEnvironmentText() const
|
||||||
|
{
|
||||||
|
if (useClearEnvironment())
|
||||||
|
return tr("Clean Environment");
|
||||||
|
else
|
||||||
|
return tr("System Environment");
|
||||||
|
}
|
||||||
|
|
||||||
void CMakeBuildStep::processFinished(int exitCode, QProcess::ExitStatus status)
|
void CMakeBuildStep::processFinished(int exitCode, QProcess::ExitStatus status)
|
||||||
{
|
{
|
||||||
AbstractProcessStep::processFinished(exitCode, status);
|
AbstractProcessStep::processFinished(exitCode, status);
|
||||||
|
|||||||
@@ -54,8 +54,26 @@ public:
|
|||||||
|
|
||||||
QString activeRunConfigTarget() const;
|
QString activeRunConfigTarget() const;
|
||||||
|
|
||||||
|
void setBuildPreset(const QString &preset);
|
||||||
|
|
||||||
|
Utils::Environment environment() const;
|
||||||
|
void setUserEnvironmentChanges(const Utils::EnvironmentItems &diff);
|
||||||
|
Utils::EnvironmentItems userEnvironmentChanges() const;
|
||||||
|
bool useClearEnvironment() const;
|
||||||
|
void setUseClearEnvironment(bool b);
|
||||||
|
void updateAndEmitEnvironmentChanged();
|
||||||
|
|
||||||
|
Utils::Environment baseEnvironment() const;
|
||||||
|
QString baseEnvironmentText() const;
|
||||||
|
|
||||||
|
void setCMakeArguments(const QStringList &cmakeArguments);
|
||||||
|
void setToolArguments(const QStringList &nativeToolArguments);
|
||||||
|
|
||||||
|
void setConfiguration(const QString &configuration);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void buildTargetsChanged();
|
void buildTargetsChanged();
|
||||||
|
void environmentChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Utils::CommandLine cmakeCommand() const;
|
Utils::CommandLine cmakeCommand() const;
|
||||||
@@ -69,6 +87,7 @@ private:
|
|||||||
QWidget *createConfigWidget() override;
|
QWidget *createConfigWidget() override;
|
||||||
|
|
||||||
QString defaultBuildTarget() const;
|
QString defaultBuildTarget() const;
|
||||||
|
bool isCleanStep() const;
|
||||||
|
|
||||||
void runImpl();
|
void runImpl();
|
||||||
void handleProjectWasParsed(bool success);
|
void handleProjectWasParsed(bool success);
|
||||||
@@ -90,6 +109,12 @@ private:
|
|||||||
QString m_installTarget = "install";
|
QString m_installTarget = "install";
|
||||||
|
|
||||||
Utils::TreeModel<Utils::TreeItem, CMakeTargetItem> m_buildTargetModel;
|
Utils::TreeModel<Utils::TreeItem, CMakeTargetItem> m_buildTargetModel;
|
||||||
|
|
||||||
|
Utils::Environment m_environment;
|
||||||
|
Utils::EnvironmentItems m_userEnvironmentChanges;
|
||||||
|
bool m_clearSystemEnvironment = false;
|
||||||
|
QString m_buildPreset;
|
||||||
|
std::optional<QString> m_configuration;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMakeBuildStepFactory : public ProjectExplorer::BuildStepFactory
|
class CMakeBuildStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
|
|||||||
@@ -88,54 +88,93 @@ Internal::PresetsData CMakeProject::combinePresets(Internal::PresetsData &cmakeP
|
|||||||
result.version = cmakePresetsData.version;
|
result.version = cmakePresetsData.version;
|
||||||
result.cmakeMinimimRequired = cmakePresetsData.cmakeMinimimRequired;
|
result.cmakeMinimimRequired = cmakePresetsData.cmakeMinimimRequired;
|
||||||
|
|
||||||
QHash<QString, PresetsDetails::ConfigurePreset> configurePresets;
|
auto combinePresetsInternal = [](auto &presetsHash,
|
||||||
|
auto &presets,
|
||||||
|
auto &userPresets,
|
||||||
|
const QString &presetType) {
|
||||||
|
// Populate the hash map with the CMakePresets
|
||||||
|
for (const auto &p : presets)
|
||||||
|
presetsHash.insert(p.name, p);
|
||||||
|
|
||||||
// Populate the hash map with the CMakePresets
|
auto resolveInherits = [](const auto &presetsHash, auto &presetsList) {
|
||||||
for (const PresetsDetails::ConfigurePreset &p: cmakePresetsData.configurePresets)
|
for (auto &p : presetsList) {
|
||||||
configurePresets.insert(p.name, p);
|
if (!p.inherits)
|
||||||
|
|
||||||
auto resolveInherits =
|
|
||||||
[configurePresets](std::vector<PresetsDetails::ConfigurePreset> &configurePresetsList) {
|
|
||||||
for (PresetsDetails::ConfigurePreset &cp : configurePresetsList) {
|
|
||||||
if (!cp.inherits)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (const QString &inheritFromName : cp.inherits.value())
|
for (const QString &inheritFromName : p.inherits.value())
|
||||||
if (configurePresets.contains(inheritFromName))
|
if (presetsHash.contains(inheritFromName))
|
||||||
cp.inheritFrom(configurePresets[inheritFromName]);
|
p.inheritFrom(presetsHash[inheritFromName]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// First resolve the CMakePresets
|
// First resolve the CMakePresets
|
||||||
resolveInherits(cmakePresetsData.configurePresets);
|
resolveInherits(presetsHash, presets);
|
||||||
|
|
||||||
// Add the CMakeUserPresets to the resolve hash map
|
// Add the CMakeUserPresets to the resolve hash map
|
||||||
for (const PresetsDetails::ConfigurePreset &cp : cmakeUserPresetsData.configurePresets) {
|
for (const auto &p : userPresets) {
|
||||||
if (configurePresets.contains(cp.name)) {
|
if (presetsHash.contains(p.name)) {
|
||||||
TaskHub::addTask(BuildSystemTask(
|
TaskHub::addTask(
|
||||||
Task::TaskType::Error,
|
BuildSystemTask(Task::TaskType::Error,
|
||||||
tr("CMakeUserPresets.json cannot re-define the configure preset: %1").arg(cp.name),
|
tr("CMakeUserPresets.json cannot re-define the %1 preset: %2")
|
||||||
"CMakeUserPresets.json"));
|
.arg(presetType)
|
||||||
TaskHub::requestPopup();
|
.arg(p.name),
|
||||||
} else {
|
"CMakeUserPresets.json"));
|
||||||
configurePresets.insert(cp.name, cp);
|
TaskHub::requestPopup();
|
||||||
|
} else {
|
||||||
|
presetsHash.insert(p.name, p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Then resolve the CMakeUserPresets
|
// Then resolve the CMakeUserPresets
|
||||||
resolveInherits(cmakeUserPresetsData.configurePresets);
|
resolveInherits(presetsHash, userPresets);
|
||||||
|
|
||||||
// Get both CMakePresets and CMakeUserPresets into the result
|
// Get both CMakePresets and CMakeUserPresets into the result
|
||||||
result.configurePresets = cmakePresetsData.configurePresets;
|
auto result = presets;
|
||||||
|
|
||||||
// std::vector doesn't have append
|
// std::vector doesn't have append
|
||||||
std::copy(cmakeUserPresetsData.configurePresets.begin(),
|
std::copy(userPresets.begin(), userPresets.end(), std::back_inserter(result));
|
||||||
cmakeUserPresetsData.configurePresets.end(),
|
return result;
|
||||||
std::back_inserter(result.configurePresets));
|
};
|
||||||
|
|
||||||
|
QHash<QString, PresetsDetails::ConfigurePreset> configurePresetsHash;
|
||||||
|
QHash<QString, PresetsDetails::BuildPreset> buildPresetsHash;
|
||||||
|
|
||||||
|
result.configurePresets = combinePresetsInternal(configurePresetsHash,
|
||||||
|
cmakePresetsData.configurePresets,
|
||||||
|
cmakeUserPresetsData.configurePresets,
|
||||||
|
"configure");
|
||||||
|
result.buildPresets = combinePresetsInternal(buildPresetsHash,
|
||||||
|
cmakePresetsData.buildPresets,
|
||||||
|
cmakeUserPresetsData.buildPresets,
|
||||||
|
"build");
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMakeProject::setupBuildPresets(Internal::PresetsData &presetsData)
|
||||||
|
{
|
||||||
|
for (auto &buildPreset : presetsData.buildPresets) {
|
||||||
|
if (buildPreset.inheritConfigureEnvironment) {
|
||||||
|
if (!buildPreset.configurePreset) {
|
||||||
|
TaskHub::addTask(BuildSystemTask(
|
||||||
|
Task::TaskType::Error,
|
||||||
|
tr("Build preset %1 is missing a corresponding configure preset.")
|
||||||
|
.arg(buildPreset.name)));
|
||||||
|
TaskHub::requestPopup();
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString &configurePresetName = buildPreset.configurePreset.value();
|
||||||
|
buildPreset.environment
|
||||||
|
= Utils::findOrDefault(presetsData.configurePresets,
|
||||||
|
[configurePresetName](
|
||||||
|
const PresetsDetails::ConfigurePreset &configurePreset) {
|
||||||
|
return configurePresetName == configurePreset.name;
|
||||||
|
})
|
||||||
|
.environment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CMakeProject::readPresets()
|
void CMakeProject::readPresets()
|
||||||
{
|
{
|
||||||
auto parsePreset = [](const Utils::FilePath &presetFile) -> Internal::PresetsData {
|
auto parsePreset = [](const Utils::FilePath &presetFile) -> Internal::PresetsData {
|
||||||
@@ -168,6 +207,7 @@ void CMakeProject::readPresets()
|
|||||||
Internal::PresetsData cmakeUserPresetsData = parsePreset(cmakeUserPresetsJson);
|
Internal::PresetsData cmakeUserPresetsData = parsePreset(cmakeUserPresetsJson);
|
||||||
|
|
||||||
m_presetsData = combinePresets(cmakePresetsData, cmakeUserPresetsData);
|
m_presetsData = combinePresets(cmakePresetsData, cmakeUserPresetsData);
|
||||||
|
setupBuildPresets(m_presetsData);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeProject::setupTarget(Target *t)
|
bool CMakeProject::setupTarget(Target *t)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ private:
|
|||||||
ProjectExplorer::DeploymentKnowledge deploymentKnowledge() const override;
|
ProjectExplorer::DeploymentKnowledge deploymentKnowledge() const override;
|
||||||
Internal::PresetsData combinePresets(Internal::PresetsData &cmakePresetsData,
|
Internal::PresetsData combinePresets(Internal::PresetsData &cmakePresetsData,
|
||||||
Internal::PresetsData &cmakeUserPresetsData);
|
Internal::PresetsData &cmakeUserPresetsData);
|
||||||
|
void setupBuildPresets(Internal::PresetsData &presetsData);
|
||||||
|
|
||||||
mutable Internal::CMakeProjectImporter *m_projectImporter = nullptr;
|
mutable Internal::CMakeProjectImporter *m_projectImporter = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
|
|
||||||
namespace CMakeProjectManager::Internal::CMakePresets::Macros {
|
namespace CMakeProjectManager::Internal::CMakePresets::Macros {
|
||||||
|
|
||||||
static void expandAllButEnv(const PresetsDetails::ConfigurePreset &configurePreset,
|
void expandAllButEnv(const PresetsDetails::ConfigurePreset &preset,
|
||||||
const Utils::FilePath &sourceDirectory,
|
const Utils::FilePath &sourceDirectory,
|
||||||
QString &value)
|
QString &value)
|
||||||
{
|
{
|
||||||
value.replace("${dollar}", "$");
|
value.replace("${dollar}", "$");
|
||||||
|
|
||||||
@@ -22,23 +22,36 @@ static void expandAllButEnv(const PresetsDetails::ConfigurePreset &configurePres
|
|||||||
value.replace("${sourceParentDir}", sourceDirectory.parentDir().toString());
|
value.replace("${sourceParentDir}", sourceDirectory.parentDir().toString());
|
||||||
value.replace("${sourceDirName}", sourceDirectory.fileName());
|
value.replace("${sourceDirName}", sourceDirectory.fileName());
|
||||||
|
|
||||||
value.replace("${presetName}", configurePreset.name);
|
value.replace("${presetName}", preset.name);
|
||||||
if (configurePreset.generator)
|
if (preset.generator)
|
||||||
value.replace("${generator}", configurePreset.generator.value());
|
value.replace("${generator}", preset.generator.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void expand(const PresetsDetails::ConfigurePreset &configurePreset,
|
void expandAllButEnv(const PresetsDetails::BuildPreset &preset,
|
||||||
|
const Utils::FilePath &sourceDirectory,
|
||||||
|
QString &value)
|
||||||
|
{
|
||||||
|
value.replace("${dollar}", "$");
|
||||||
|
|
||||||
|
value.replace("${sourceDir}", sourceDirectory.toString());
|
||||||
|
value.replace("${sourceParentDir}", sourceDirectory.parentDir().toString());
|
||||||
|
value.replace("${sourceDirName}", sourceDirectory.fileName());
|
||||||
|
|
||||||
|
value.replace("${presetName}", preset.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class PresetType>
|
||||||
|
void expand(const PresetType &preset,
|
||||||
Utils::Environment &env,
|
Utils::Environment &env,
|
||||||
const Utils::FilePath &sourceDirectory)
|
const Utils::FilePath &sourceDirectory)
|
||||||
{
|
{
|
||||||
const QHash<QString, QString> presetEnv = configurePreset.environment
|
const QHash<QString, QString> presetEnv = preset.environment ? preset.environment.value()
|
||||||
? configurePreset.environment.value()
|
: QHash<QString, QString>();
|
||||||
: QHash<QString, QString>();
|
|
||||||
for (auto it = presetEnv.constKeyValueBegin(); it != presetEnv.constKeyValueEnd(); ++it) {
|
for (auto it = presetEnv.constKeyValueBegin(); it != presetEnv.constKeyValueEnd(); ++it) {
|
||||||
const QString key = it->first;
|
const QString key = it->first;
|
||||||
QString value = it->second;
|
QString value = it->second;
|
||||||
|
|
||||||
expandAllButEnv(configurePreset, sourceDirectory, value);
|
expandAllButEnv(preset, sourceDirectory, value);
|
||||||
|
|
||||||
QRegularExpression envRegex(R"((\$env\{(\w+)\}))");
|
QRegularExpression envRegex(R"((\$env\{(\w+)\}))");
|
||||||
for (const QRegularExpressionMatch &match : envRegex.globalMatch(value)) {
|
for (const QRegularExpressionMatch &match : envRegex.globalMatch(value)) {
|
||||||
@@ -69,19 +82,19 @@ void expand(const PresetsDetails::ConfigurePreset &configurePreset,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void expand(const PresetsDetails::ConfigurePreset &configurePreset,
|
template<class PresetType>
|
||||||
|
void expand(const PresetType &preset,
|
||||||
Utils::EnvironmentItems &envItems,
|
Utils::EnvironmentItems &envItems,
|
||||||
const Utils::FilePath &sourceDirectory)
|
const Utils::FilePath &sourceDirectory)
|
||||||
{
|
{
|
||||||
const QHash<QString, QString> presetEnv = configurePreset.environment
|
const QHash<QString, QString> presetEnv = preset.environment ? preset.environment.value()
|
||||||
? configurePreset.environment.value()
|
: QHash<QString, QString>();
|
||||||
: QHash<QString, QString>();
|
|
||||||
|
|
||||||
for (auto it = presetEnv.constKeyValueBegin(); it != presetEnv.constKeyValueEnd(); ++it) {
|
for (auto it = presetEnv.constKeyValueBegin(); it != presetEnv.constKeyValueEnd(); ++it) {
|
||||||
const QString key = it->first;
|
const QString key = it->first;
|
||||||
QString value = it->second;
|
QString value = it->second;
|
||||||
|
|
||||||
expandAllButEnv(configurePreset, sourceDirectory, value);
|
expandAllButEnv(preset, sourceDirectory, value);
|
||||||
|
|
||||||
QRegularExpression envRegex(R"((\$env\{(\w+)\}))");
|
QRegularExpression envRegex(R"((\$env\{(\w+)\}))");
|
||||||
for (const QRegularExpressionMatch &match : envRegex.globalMatch(value)) {
|
for (const QRegularExpressionMatch &match : envRegex.globalMatch(value)) {
|
||||||
@@ -108,16 +121,16 @@ void expand(const PresetsDetails::ConfigurePreset &configurePreset,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void expand(const PresetsDetails::ConfigurePreset &configurePreset,
|
template<class PresetType>
|
||||||
|
void expand(const PresetType &preset,
|
||||||
const Utils::Environment &env,
|
const Utils::Environment &env,
|
||||||
const Utils::FilePath &sourceDirectory,
|
const Utils::FilePath &sourceDirectory,
|
||||||
QString &value)
|
QString &value)
|
||||||
{
|
{
|
||||||
expandAllButEnv(configurePreset, sourceDirectory, value);
|
expandAllButEnv(preset, sourceDirectory, value);
|
||||||
|
|
||||||
const QHash<QString, QString> presetEnv = configurePreset.environment
|
const QHash<QString, QString> presetEnv = preset.environment ? preset.environment.value()
|
||||||
? configurePreset.environment.value()
|
: QHash<QString, QString>();
|
||||||
: QHash<QString, QString>();
|
|
||||||
|
|
||||||
QRegularExpression envRegex(R"((\$env\{(\w+)\}))");
|
QRegularExpression envRegex(R"((\$env\{(\w+)\}))");
|
||||||
for (const QRegularExpressionMatch &match : envRegex.globalMatch(value))
|
for (const QRegularExpressionMatch &match : envRegex.globalMatch(value))
|
||||||
@@ -128,4 +141,32 @@ void expand(const PresetsDetails::ConfigurePreset &configurePreset,
|
|||||||
value.replace(match.captured(1), env.value(match.captured(2)));
|
value.replace(match.captured(1), env.value(match.captured(2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Expand for PresetsDetails::ConfigurePreset
|
||||||
|
template void expand<PresetsDetails::ConfigurePreset>(const PresetsDetails::ConfigurePreset &preset,
|
||||||
|
Utils::Environment &env,
|
||||||
|
const Utils::FilePath &sourceDirectory);
|
||||||
|
|
||||||
|
template void expand<PresetsDetails::ConfigurePreset>(const PresetsDetails::ConfigurePreset &preset,
|
||||||
|
Utils::EnvironmentItems &envItems,
|
||||||
|
const Utils::FilePath &sourceDirectory);
|
||||||
|
|
||||||
|
template void expand<PresetsDetails::ConfigurePreset>(const PresetsDetails::ConfigurePreset &preset,
|
||||||
|
const Utils::Environment &env,
|
||||||
|
const Utils::FilePath &sourceDirectory,
|
||||||
|
QString &value);
|
||||||
|
|
||||||
|
// Expand for PresetsDetails::BuildPreset
|
||||||
|
template void expand<PresetsDetails::BuildPreset>(const PresetsDetails::BuildPreset &preset,
|
||||||
|
Utils::Environment &env,
|
||||||
|
const Utils::FilePath &sourceDirectory);
|
||||||
|
|
||||||
|
template void expand<PresetsDetails::BuildPreset>(const PresetsDetails::BuildPreset &preset,
|
||||||
|
Utils::EnvironmentItems &envItems,
|
||||||
|
const Utils::FilePath &sourceDirectory);
|
||||||
|
|
||||||
|
template void expand<PresetsDetails::BuildPreset>(const PresetsDetails::BuildPreset &preset,
|
||||||
|
const Utils::Environment &env,
|
||||||
|
const Utils::FilePath &sourceDirectory,
|
||||||
|
QString &value);
|
||||||
|
|
||||||
} // namespace CMakeProjectManager::Internal::CMakePresets::Macros
|
} // namespace CMakeProjectManager::Internal::CMakePresets::Macros
|
||||||
|
|||||||
@@ -12,16 +12,13 @@ class FilePath;
|
|||||||
|
|
||||||
namespace CMakeProjectManager::Internal {
|
namespace CMakeProjectManager::Internal {
|
||||||
|
|
||||||
namespace PresetsDetails {
|
|
||||||
class ConfigurePreset;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace CMakePresets::Macros {
|
namespace CMakePresets::Macros {
|
||||||
/**
|
/**
|
||||||
* Expands the CMakePresets Macros using Utils::Environment as target and source for parent environment values.
|
* Expands the CMakePresets Macros using Utils::Environment as target and source for parent environment values.
|
||||||
* $penv{PATH} is taken from Utils::Environment
|
* $penv{PATH} is taken from Utils::Environment
|
||||||
*/
|
*/
|
||||||
void expand(const PresetsDetails::ConfigurePreset &configurePreset,
|
template<class PresetType>
|
||||||
|
void expand(const PresetType &preset,
|
||||||
Utils::Environment &env,
|
Utils::Environment &env,
|
||||||
const Utils::FilePath &sourceDirectory);
|
const Utils::FilePath &sourceDirectory);
|
||||||
|
|
||||||
@@ -29,14 +26,16 @@ void expand(const PresetsDetails::ConfigurePreset &configurePreset,
|
|||||||
* Expands the CMakePresets Macros using Utils::Environment as target
|
* Expands the CMakePresets Macros using Utils::Environment as target
|
||||||
* $penv{PATH} is replaced with Qt Creator macros ${PATH}
|
* $penv{PATH} is replaced with Qt Creator macros ${PATH}
|
||||||
*/
|
*/
|
||||||
void expand(const PresetsDetails::ConfigurePreset &configurePreset,
|
template<class PresetType>
|
||||||
|
void expand(const PresetType &preset,
|
||||||
Utils::EnvironmentItems &envItems,
|
Utils::EnvironmentItems &envItems,
|
||||||
const Utils::FilePath &sourceDirectory);
|
const Utils::FilePath &sourceDirectory);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expands the CMakePresets macros inside the @value QString parameter.
|
* Expands the CMakePresets macros inside the @value QString parameter.
|
||||||
*/
|
*/
|
||||||
void expand(const PresetsDetails::ConfigurePreset &configurePreset,
|
template<class PresetType>
|
||||||
|
void expand(const PresetType &preset,
|
||||||
const Utils::Environment &env,
|
const Utils::Environment &env,
|
||||||
const Utils::FilePath &sourceDirectory,
|
const Utils::FilePath &sourceDirectory,
|
||||||
QString &value);
|
QString &value);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Internal {
|
|||||||
|
|
||||||
bool parseVersion(const QJsonValue &jsonValue, int &version)
|
bool parseVersion(const QJsonValue &jsonValue, int &version)
|
||||||
{
|
{
|
||||||
if (jsonValue.isNull())
|
if (jsonValue.isUndefined())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const int invalidVersion = -1;
|
const int invalidVersion = -1;
|
||||||
@@ -23,7 +23,7 @@ bool parseVersion(const QJsonValue &jsonValue, int &version)
|
|||||||
|
|
||||||
bool parseCMakeMinimumRequired(const QJsonValue &jsonValue, QVersionNumber &versionNumber)
|
bool parseCMakeMinimumRequired(const QJsonValue &jsonValue, QVersionNumber &versionNumber)
|
||||||
{
|
{
|
||||||
if (jsonValue.isNull() || !jsonValue.isObject())
|
if (jsonValue.isUndefined() || !jsonValue.isObject())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QJsonObject object = jsonValue.toObject();
|
QJsonObject object = jsonValue.toObject();
|
||||||
@@ -38,7 +38,7 @@ bool parseConfigurePresets(const QJsonValue &jsonValue,
|
|||||||
std::vector<PresetsDetails::ConfigurePreset> &configurePresets)
|
std::vector<PresetsDetails::ConfigurePreset> &configurePresets)
|
||||||
{
|
{
|
||||||
// The whole section is optional
|
// The whole section is optional
|
||||||
if (jsonValue.isNull())
|
if (jsonValue.isUndefined())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!jsonValue.isArray())
|
if (!jsonValue.isArray())
|
||||||
@@ -56,7 +56,7 @@ bool parseConfigurePresets(const QJsonValue &jsonValue,
|
|||||||
preset.hidden = object.value("hidden").toBool();
|
preset.hidden = object.value("hidden").toBool();
|
||||||
|
|
||||||
QJsonValue inherits = object.value("inherits");
|
QJsonValue inherits = object.value("inherits");
|
||||||
if (!inherits.isNull()) {
|
if (!inherits.isUndefined()) {
|
||||||
preset.inherits = QStringList();
|
preset.inherits = QStringList();
|
||||||
if (inherits.isArray()) {
|
if (inherits.isArray()) {
|
||||||
const QJsonArray inheritsArray = inherits.toArray();
|
const QJsonArray inheritsArray = inherits.toArray();
|
||||||
@@ -184,6 +184,97 @@ bool parseConfigurePresets(const QJsonValue &jsonValue,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool parseBuildPresets(const QJsonValue &jsonValue,
|
||||||
|
std::vector<PresetsDetails::BuildPreset> &buildPresets)
|
||||||
|
{
|
||||||
|
// The whole section is optional
|
||||||
|
if (jsonValue.isUndefined())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (!jsonValue.isArray())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const QJsonArray buildPresetsArray = jsonValue.toArray();
|
||||||
|
for (const QJsonValue &presetJson : buildPresetsArray) {
|
||||||
|
if (!presetJson.isObject())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QJsonObject object = presetJson.toObject();
|
||||||
|
PresetsDetails::BuildPreset preset;
|
||||||
|
|
||||||
|
preset.name = object.value("name").toString();
|
||||||
|
preset.hidden = object.value("hidden").toBool();
|
||||||
|
|
||||||
|
QJsonValue inherits = object.value("inherits");
|
||||||
|
if (!inherits.isUndefined()) {
|
||||||
|
preset.inherits = QStringList();
|
||||||
|
if (inherits.isArray()) {
|
||||||
|
const QJsonArray inheritsArray = inherits.toArray();
|
||||||
|
for (const QJsonValue &inheritsValue : inheritsArray)
|
||||||
|
preset.inherits.value() << inheritsValue.toString();
|
||||||
|
} else {
|
||||||
|
QString inheritsValue = inherits.toString();
|
||||||
|
if (!inheritsValue.isEmpty())
|
||||||
|
preset.inherits.value() << inheritsValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object.contains("displayName"))
|
||||||
|
preset.displayName = object.value("displayName").toString();
|
||||||
|
if (object.contains("description"))
|
||||||
|
preset.description = object.value("description").toString();
|
||||||
|
|
||||||
|
const QJsonObject environmentObj = object.value("environment").toObject();
|
||||||
|
for (const QString &envKey : environmentObj.keys()) {
|
||||||
|
if (!preset.environment)
|
||||||
|
preset.environment = QHash<QString, QString>();
|
||||||
|
|
||||||
|
QJsonValue envValue = environmentObj.value(envKey);
|
||||||
|
preset.environment.value().insert(envKey, envValue.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (object.contains("configurePreset"))
|
||||||
|
preset.configurePreset = object.value("configurePreset").toString();
|
||||||
|
if (object.contains("inheritConfigureEnvironment"))
|
||||||
|
preset.inheritConfigureEnvironment = object.value("inheritConfigureEnvironment").toBool();
|
||||||
|
if (object.contains("jobs"))
|
||||||
|
preset.jobs = object.value("jobs").toInt();
|
||||||
|
|
||||||
|
QJsonValue targets = object.value("targets");
|
||||||
|
if (!targets.isUndefined()) {
|
||||||
|
preset.targets = QStringList();
|
||||||
|
if (targets.isArray()) {
|
||||||
|
const QJsonArray targetsArray = targets.toArray();
|
||||||
|
for (const QJsonValue &targetsValue : targetsArray)
|
||||||
|
preset.targets.value() << targetsValue.toString();
|
||||||
|
} else {
|
||||||
|
QString targetsValue = targets.toString();
|
||||||
|
if (!targetsValue.isEmpty())
|
||||||
|
preset.targets.value() << targetsValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object.contains("configuration"))
|
||||||
|
preset.configuration = object.value("configuration").toString();
|
||||||
|
if (object.contains("verbose"))
|
||||||
|
preset.verbose = object.value("verbose").toBool();
|
||||||
|
if (object.contains("cleanFirst"))
|
||||||
|
preset.cleanFirst = object.value("cleanFirst").toBool();
|
||||||
|
|
||||||
|
QJsonValue nativeToolOptions = object.value("nativeToolOptions");
|
||||||
|
if (!nativeToolOptions.isUndefined()) {
|
||||||
|
if (nativeToolOptions.isArray()) {
|
||||||
|
preset.nativeToolOptions = QStringList();
|
||||||
|
const QJsonArray toolOptionsArray = nativeToolOptions.toArray();
|
||||||
|
for (const QJsonValue &toolOptionsValue : toolOptionsArray)
|
||||||
|
preset.nativeToolOptions.value() << toolOptionsValue.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildPresets.emplace_back(preset);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const PresetsData &PresetsParser::presetsData() const
|
const PresetsData &PresetsParser::presetsData() const
|
||||||
{
|
{
|
||||||
return m_presetsData;
|
return m_presetsData;
|
||||||
@@ -232,9 +323,19 @@ bool PresetsParser::parse(const Utils::FilePath &jsonFile, QString &errorMessage
|
|||||||
|
|
||||||
// optional
|
// optional
|
||||||
if (!parseConfigurePresets(root.value("configurePresets"), m_presetsData.configurePresets)) {
|
if (!parseConfigurePresets(root.value("configurePresets"), m_presetsData.configurePresets)) {
|
||||||
errorMessage = QCoreApplication::translate(
|
errorMessage
|
||||||
"CMakeProjectManager::Internal",
|
= QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||||
"Invalid \"configurePresets\" section in %1 file").arg(jsonFile.fileName());
|
"Invalid \"configurePresets\" section in %1 file")
|
||||||
|
.arg(jsonFile.fileName());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// optional
|
||||||
|
if (!parseBuildPresets(root.value("buildPresets"), m_presetsData.buildPresets)) {
|
||||||
|
errorMessage
|
||||||
|
= QCoreApplication::translate("CMakeProjectManager::Internal",
|
||||||
|
"Invalid \"buildPresets\" section in %1 file")
|
||||||
|
.arg(jsonFile.fileName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,5 +378,38 @@ void PresetsDetails::ConfigurePreset::inheritFrom(const ConfigurePreset &other)
|
|||||||
debug = other.debug;
|
debug = other.debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PresetsDetails::BuildPreset::inheritFrom(const BuildPreset &other)
|
||||||
|
{
|
||||||
|
if (!vendor && other.vendor)
|
||||||
|
vendor = other.vendor;
|
||||||
|
|
||||||
|
if (!environment && other.environment)
|
||||||
|
environment = other.environment;
|
||||||
|
|
||||||
|
if (!configurePreset && other.configurePreset)
|
||||||
|
configurePreset = other.configurePreset;
|
||||||
|
|
||||||
|
if (!inheritConfigureEnvironment && other.inheritConfigureEnvironment)
|
||||||
|
inheritConfigureEnvironment = other.inheritConfigureEnvironment;
|
||||||
|
|
||||||
|
if (!jobs && other.jobs)
|
||||||
|
jobs = other.jobs;
|
||||||
|
|
||||||
|
if (!targets && other.targets)
|
||||||
|
targets = other.targets;
|
||||||
|
|
||||||
|
if (!configuration && other.configuration)
|
||||||
|
configuration = other.configuration;
|
||||||
|
|
||||||
|
if (!verbose && other.verbose)
|
||||||
|
verbose = other.verbose;
|
||||||
|
|
||||||
|
if (!cleanFirst && other.cleanFirst)
|
||||||
|
cleanFirst = other.cleanFirst;
|
||||||
|
|
||||||
|
if (!nativeToolOptions && other.nativeToolOptions)
|
||||||
|
nativeToolOptions = other.nativeToolOptions;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace CMakeProjectManager
|
} // namespace CMakeProjectManager
|
||||||
|
|||||||
@@ -67,6 +67,27 @@ public:
|
|||||||
std::optional<Debug> debug;
|
std::optional<Debug> debug;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BuildPreset {
|
||||||
|
public:
|
||||||
|
void inheritFrom(const BuildPreset &other);
|
||||||
|
|
||||||
|
QString name;
|
||||||
|
std::optional<bool> hidden = false;
|
||||||
|
std::optional<QStringList> inherits;
|
||||||
|
std::optional<QHash<QString, QString>> vendor;
|
||||||
|
std::optional<QString> displayName;
|
||||||
|
std::optional<QString> description;
|
||||||
|
std::optional<QHash<QString, QString>> environment;
|
||||||
|
std::optional<QString> configurePreset;
|
||||||
|
std::optional<bool> inheritConfigureEnvironment = true;
|
||||||
|
std::optional<int> jobs;
|
||||||
|
std::optional<QStringList> targets;
|
||||||
|
std::optional<QString> configuration;
|
||||||
|
std::optional<bool> verbose;
|
||||||
|
std::optional<bool> cleanFirst;
|
||||||
|
std::optional<QStringList> nativeToolOptions;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace PresetsDetails
|
} // namespace PresetsDetails
|
||||||
|
|
||||||
class PresetsData
|
class PresetsData
|
||||||
@@ -76,6 +97,7 @@ public:
|
|||||||
QVersionNumber cmakeMinimimRequired;
|
QVersionNumber cmakeMinimimRequired;
|
||||||
QHash<QString, QString> vendor;
|
QHash<QString, QString> vendor;
|
||||||
std::vector<PresetsDetails::ConfigurePreset> configurePresets;
|
std::vector<PresetsDetails::ConfigurePreset> configurePresets;
|
||||||
|
std::vector<PresetsDetails::BuildPreset> buildPresets;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PresetsParser
|
class PresetsParser
|
||||||
|
|||||||
@@ -211,12 +211,14 @@ MainWindow::MainWindow()
|
|||||||
connect(dropSupport, &DropSupport::filesDropped,
|
connect(dropSupport, &DropSupport::filesDropped,
|
||||||
this, &MainWindow::openDroppedFiles);
|
this, &MainWindow::openDroppedFiles);
|
||||||
|
|
||||||
|
if (HostOsInfo::isLinuxHost()) {
|
||||||
|
m_trimTimer.setSingleShot(true);
|
||||||
|
m_trimTimer.setInterval(60000);
|
||||||
|
// glibc may not actually free memory in free().
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
m_trimTimer.setSingleShot(true);
|
connect(&m_trimTimer, &QTimer::timeout, this, [] { malloc_trim(0); });
|
||||||
m_trimTimer.setInterval(60000);
|
|
||||||
// glibc may not actually free memory in free().
|
|
||||||
connect(&m_trimTimer, &QTimer::timeout, this, [] { malloc_trim(0); });
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigationWidget *MainWindow::navigationWidget(Side side) const
|
NavigationWidget *MainWindow::navigationWidget(Side side) const
|
||||||
@@ -358,7 +360,7 @@ void MainWindow::restart()
|
|||||||
|
|
||||||
void MainWindow::restartTrimmer()
|
void MainWindow::restartTrimmer()
|
||||||
{
|
{
|
||||||
if (!m_trimTimer.isActive())
|
if (HostOsInfo::isLinuxHost() && !m_trimTimer.isActive())
|
||||||
m_trimTimer.start();
|
m_trimTimer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,15 @@
|
|||||||
#include "builtineditordocumentprocessor.h"
|
#include "builtineditordocumentprocessor.h"
|
||||||
#include "cppcanonicalsymbol.h"
|
#include "cppcanonicalsymbol.h"
|
||||||
#include "cppcompletionassist.h"
|
#include "cppcompletionassist.h"
|
||||||
|
#include "cppeditortr.h"
|
||||||
#include "cppeditorwidget.h"
|
#include "cppeditorwidget.h"
|
||||||
#include "cppelementevaluator.h"
|
#include "cppelementevaluator.h"
|
||||||
#include "cppfollowsymbolundercursor.h"
|
#include "cppfollowsymbolundercursor.h"
|
||||||
#include "cppoutlinemodel.h"
|
|
||||||
#include "cpptoolsreuse.h"
|
#include "cpptoolsreuse.h"
|
||||||
#include "symbolfinder.h"
|
#include "symbolfinder.h"
|
||||||
|
|
||||||
#include <app/app_version.h>
|
#include <app/app_version.h>
|
||||||
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <texteditor/basehoverhandler.h>
|
#include <texteditor/basehoverhandler.h>
|
||||||
#include <utils/executeondestruction.h>
|
#include <utils/executeondestruction.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -105,6 +106,17 @@ void BuiltinModelManagerSupport::followSymbol(const CursorInEditor &data,
|
|||||||
data.editorWidget()->semanticInfo().doc, &finder, inNextSplit);
|
data.editorWidget()->semanticInfo().doc, &finder, inNextSplit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BuiltinModelManagerSupport::followSymbolToType(const CursorInEditor &data,
|
||||||
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
|
bool inNextSplit)
|
||||||
|
{
|
||||||
|
Q_UNUSED(data)
|
||||||
|
Q_UNUSED(processLinkCallback)
|
||||||
|
Q_UNUSED(inNextSplit)
|
||||||
|
MessageManager::writeDisrupting(
|
||||||
|
Tr::tr("Follow Symbol to Type is only available when using clangd"));
|
||||||
|
}
|
||||||
|
|
||||||
void BuiltinModelManagerSupport::switchDeclDef(const CursorInEditor &data,
|
void BuiltinModelManagerSupport::switchDeclDef(const CursorInEditor &data,
|
||||||
const Utils::LinkHandler &processLinkCallback)
|
const Utils::LinkHandler &processLinkCallback)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
void followSymbol(const CursorInEditor &data, const Utils::LinkHandler &processLinkCallback,
|
void followSymbol(const CursorInEditor &data, const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget, bool inNextSplit) override;
|
bool resolveTarget, bool inNextSplit) override;
|
||||||
|
void followSymbolToType(const CursorInEditor &data,
|
||||||
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
|
bool inNextSplit) override;
|
||||||
void switchDeclDef(const CursorInEditor &data,
|
void switchDeclDef(const CursorInEditor &data,
|
||||||
const Utils::LinkHandler &processLinkCallback) override;
|
const Utils::LinkHandler &processLinkCallback) override;
|
||||||
void startLocalRenaming(const CursorInEditor &data,
|
void startLocalRenaming(const CursorInEditor &data,
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ const char CPPEDITOR_ID[] = "CppEditor.C++Editor";
|
|||||||
const char CPPEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("OpenWith::Editors", "C++ Editor");
|
const char CPPEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("OpenWith::Editors", "C++ Editor");
|
||||||
const char SWITCH_DECLARATION_DEFINITION[] = "CppEditor.SwitchDeclarationDefinition";
|
const char SWITCH_DECLARATION_DEFINITION[] = "CppEditor.SwitchDeclarationDefinition";
|
||||||
const char OPEN_DECLARATION_DEFINITION_IN_NEXT_SPLIT[] = "CppEditor.OpenDeclarationDefinitionInNextSplit";
|
const char OPEN_DECLARATION_DEFINITION_IN_NEXT_SPLIT[] = "CppEditor.OpenDeclarationDefinitionInNextSplit";
|
||||||
|
const char FOLLOW_SYMBOL_TO_TYPE[] = "TextEditor.FollowSymbolToType";
|
||||||
|
const char FOLLOW_SYMBOL_TO_TYPE_IN_NEXT_SPLIT[] = "TextEditor.FollowSymbolToTypeInNextSplit";
|
||||||
const char OPEN_PREPROCESSOR_DIALOG[] = "CppEditor.OpenPreprocessorDialog";
|
const char OPEN_PREPROCESSOR_DIALOG[] = "CppEditor.OpenPreprocessorDialog";
|
||||||
const char MULTIPLE_PARSE_CONTEXTS_AVAILABLE[] = "CppEditor.MultipleParseContextsAvailable";
|
const char MULTIPLE_PARSE_CONTEXTS_AVAILABLE[] = "CppEditor.MultipleParseContextsAvailable";
|
||||||
const char M_REFACTORING_MENU_INSERTION_POINT[] = "CppEditor.RefactorGroup";
|
const char M_REFACTORING_MENU_INSERTION_POINT[] = "CppEditor.RefactorGroup";
|
||||||
|
|||||||
@@ -357,6 +357,30 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
|||||||
this, &CppEditorPlugin::openDeclarationDefinitionInNextSplit);
|
this, &CppEditorPlugin::openDeclarationDefinitionInNextSplit);
|
||||||
cppToolsMenu->addAction(cmd);
|
cppToolsMenu->addAction(cmd);
|
||||||
|
|
||||||
|
QAction * const followSymbolToType = new QAction(tr("Follow Symbol Under Cursor to Type"),
|
||||||
|
this);
|
||||||
|
cmd = ActionManager::registerAction(followSymbolToType, Constants::FOLLOW_SYMBOL_TO_TYPE,
|
||||||
|
context, true);
|
||||||
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F2")));
|
||||||
|
connect(followSymbolToType, &QAction::triggered, this, []{
|
||||||
|
if (CppEditorWidget *editorWidget = currentCppEditorWidget())
|
||||||
|
editorWidget->followSymbolToType(false);
|
||||||
|
});
|
||||||
|
contextMenu->addAction(cmd, Constants::G_CONTEXT_FIRST);
|
||||||
|
cppToolsMenu->addAction(cmd);
|
||||||
|
QAction * const followSymbolToTypeInNextSplit =
|
||||||
|
new QAction(tr("Follow Symbol To Type in Next Split"), this);
|
||||||
|
cmd = ActionManager::registerAction(followSymbolToTypeInNextSplit,
|
||||||
|
Constants::FOLLOW_SYMBOL_TO_TYPE_IN_NEXT_SPLIT, context, true);
|
||||||
|
cmd->setDefaultKeySequence(QKeySequence(HostOsInfo::isMacHost()
|
||||||
|
? tr("Meta+E, Ctrl+Shift+F2")
|
||||||
|
: tr("Ctrl+E, Ctrl+Shift+F2")));
|
||||||
|
connect(followSymbolToTypeInNextSplit, &QAction::triggered, this, []{
|
||||||
|
if (CppEditorWidget *editorWidget = currentCppEditorWidget())
|
||||||
|
editorWidget->followSymbolToType(true);
|
||||||
|
});
|
||||||
|
cppToolsMenu->addAction(cmd);
|
||||||
|
|
||||||
cmd = ActionManager::command(TextEditor::Constants::FIND_USAGES);
|
cmd = ActionManager::command(TextEditor::Constants::FIND_USAGES);
|
||||||
contextMenu->addAction(cmd, Constants::G_CONTEXT_FIRST);
|
contextMenu->addAction(cmd, Constants::G_CONTEXT_FIRST);
|
||||||
cppToolsMenu->addAction(cmd);
|
cppToolsMenu->addAction(cmd);
|
||||||
|
|||||||
@@ -834,6 +834,20 @@ void CppEditorWidget::switchDeclarationDefinition(bool inNextSplit)
|
|||||||
CppModelManager::switchDeclDef(cursor, std::move(callback));
|
CppModelManager::switchDeclDef(cursor, std::move(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CppEditorWidget::followSymbolToType(bool inNextSplit)
|
||||||
|
{
|
||||||
|
if (!d->m_modelManager)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const CursorInEditor cursor(textCursor(), textDocument()->filePath(), this, textDocument());
|
||||||
|
const auto callback = [self = QPointer(this),
|
||||||
|
split = inNextSplit != alwaysOpenLinksInNextSplit()](const Link &link) {
|
||||||
|
if (self && link.hasValidTarget())
|
||||||
|
self->openLink(link, split);
|
||||||
|
};
|
||||||
|
CppModelManager::followSymbolToType(cursor, callback, inNextSplit);
|
||||||
|
}
|
||||||
|
|
||||||
bool CppEditorWidget::followQrcUrl(const QTextCursor &cursor,
|
bool CppEditorWidget::followQrcUrl(const QTextCursor &cursor,
|
||||||
const Utils::LinkHandler &processLinkCallback)
|
const Utils::LinkHandler &processLinkCallback)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ public:
|
|||||||
void selectAll() override;
|
void selectAll() override;
|
||||||
|
|
||||||
void switchDeclarationDefinition(bool inNextSplit);
|
void switchDeclarationDefinition(bool inNextSplit);
|
||||||
|
void followSymbolToType(bool inNextSplit);
|
||||||
void showPreProcessorWidget();
|
void showPreProcessorWidget();
|
||||||
|
|
||||||
void findUsages() override;
|
void findUsages() override;
|
||||||
|
|||||||
@@ -1764,6 +1764,14 @@ void CppModelManager::followSymbol(const CursorInEditor &data,
|
|||||||
resolveTarget, inNextSplit);
|
resolveTarget, inNextSplit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CppModelManager::followSymbolToType(const CursorInEditor &data,
|
||||||
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
|
bool inNextSplit, Backend backend)
|
||||||
|
{
|
||||||
|
instance()->modelManagerSupport(backend)->followSymbolToType(data, processLinkCallback,
|
||||||
|
inNextSplit);
|
||||||
|
}
|
||||||
|
|
||||||
void CppModelManager::switchDeclDef(const CursorInEditor &data,
|
void CppModelManager::switchDeclDef(const CursorInEditor &data,
|
||||||
const Utils::LinkHandler &processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
Backend backend)
|
Backend backend)
|
||||||
|
|||||||
@@ -167,6 +167,9 @@ public:
|
|||||||
static void followSymbol(const CursorInEditor &data,
|
static void followSymbol(const CursorInEditor &data,
|
||||||
const Utils::LinkHandler &processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget, bool inNextSplit, Backend backend = Backend::Best);
|
bool resolveTarget, bool inNextSplit, Backend backend = Backend::Best);
|
||||||
|
static void followSymbolToType(const CursorInEditor &data,
|
||||||
|
const Utils::LinkHandler &processLinkCallback, bool inNextSplit,
|
||||||
|
Backend backend = Backend::Best);
|
||||||
static void switchDeclDef(const CursorInEditor &data,
|
static void switchDeclDef(const CursorInEditor &data,
|
||||||
const Utils::LinkHandler &processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
Backend backend = Backend::Best);
|
Backend backend = Backend::Best);
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ public:
|
|||||||
virtual void followSymbol(const CursorInEditor &data,
|
virtual void followSymbol(const CursorInEditor &data,
|
||||||
const Utils::LinkHandler &processLinkCallback,
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
bool resolveTarget, bool inNextSplit) = 0;
|
bool resolveTarget, bool inNextSplit) = 0;
|
||||||
|
virtual void followSymbolToType(const CursorInEditor &data,
|
||||||
|
const Utils::LinkHandler &processLinkCallback,
|
||||||
|
bool inNextSplit) = 0;
|
||||||
virtual void switchDeclDef(const CursorInEditor &data,
|
virtual void switchDeclDef(const CursorInEditor &data,
|
||||||
const Utils::LinkHandler &processLinkCallback) = 0;
|
const Utils::LinkHandler &processLinkCallback) = 0;
|
||||||
virtual void startLocalRenaming(const CursorInEditor &data,
|
virtual void startLocalRenaming(const CursorInEditor &data,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QTimer>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
@@ -62,6 +63,8 @@ public:
|
|||||||
DebuggerItemManagerPrivate();
|
DebuggerItemManagerPrivate();
|
||||||
~DebuggerItemManagerPrivate();
|
~DebuggerItemManagerPrivate();
|
||||||
|
|
||||||
|
void extensionsInitialized();
|
||||||
|
|
||||||
void restoreDebuggers();
|
void restoreDebuggers();
|
||||||
void saveDebuggers();
|
void saveDebuggers();
|
||||||
|
|
||||||
@@ -815,6 +818,10 @@ DebuggerItemManagerPrivate::DebuggerItemManagerPrivate()
|
|||||||
m_model = new DebuggerItemModel;
|
m_model = new DebuggerItemModel;
|
||||||
m_optionsPage = new DebuggerOptionsPage;
|
m_optionsPage = new DebuggerOptionsPage;
|
||||||
ExtensionSystem::PluginManager::addObject(m_optionsPage);
|
ExtensionSystem::PluginManager::addObject(m_optionsPage);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerItemManagerPrivate::extensionsInitialized()
|
||||||
|
{
|
||||||
restoreDebuggers();
|
restoreDebuggers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -954,6 +961,11 @@ DebuggerItemManager::~DebuggerItemManager()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerItemManager::extensionsInitialized()
|
||||||
|
{
|
||||||
|
d->extensionsInitialized();
|
||||||
|
}
|
||||||
|
|
||||||
const QList<DebuggerItem> DebuggerItemManager::debuggers()
|
const QList<DebuggerItem> DebuggerItemManager::debuggers()
|
||||||
{
|
{
|
||||||
QList<DebuggerItem> result;
|
QList<DebuggerItem> result;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ public:
|
|||||||
DebuggerItemManager();
|
DebuggerItemManager();
|
||||||
~DebuggerItemManager();
|
~DebuggerItemManager();
|
||||||
|
|
||||||
|
void extensionsInitialized();
|
||||||
|
|
||||||
static const QList<DebuggerItem> debuggers();
|
static const QList<DebuggerItem> debuggers();
|
||||||
|
|
||||||
static QVariant registerDebugger(const DebuggerItem &item);
|
static QVariant registerDebugger(const DebuggerItem &item);
|
||||||
|
|||||||
@@ -2053,6 +2053,10 @@ void DebuggerPluginPrivate::remoteCommand(const QStringList &options)
|
|||||||
|
|
||||||
void DebuggerPluginPrivate::extensionsInitialized()
|
void DebuggerPluginPrivate::extensionsInitialized()
|
||||||
{
|
{
|
||||||
|
QTimer::singleShot(0, this, [this]{
|
||||||
|
m_debuggerItemManager.extensionsInitialized();
|
||||||
|
});
|
||||||
|
|
||||||
// If the CppEditor or QmlJS editor plugin is there, we want to add something to
|
// If the CppEditor or QmlJS editor plugin is there, we want to add something to
|
||||||
// the editor context menu.
|
// the editor context menu.
|
||||||
for (Id menuId : { CppEditor::Constants::M_CONTEXT, QmlJSEditor::Constants::M_CONTEXT }) {
|
for (Id menuId : { CppEditor::Constants::M_CONTEXT, QmlJSEditor::Constants::M_CONTEXT }) {
|
||||||
|
|||||||
@@ -14,11 +14,14 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
|
|
||||||
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||||
#include <projectexplorer/devicesupport/idevicewidget.h>
|
#include <projectexplorer/devicesupport/idevicewidget.h>
|
||||||
#include <projectexplorer/kitinformation.h>
|
#include <projectexplorer/kitinformation.h>
|
||||||
#include <projectexplorer/kitmanager.h>
|
#include <projectexplorer/kitmanager.h>
|
||||||
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/runcontrol.h>
|
#include <projectexplorer/runcontrol.h>
|
||||||
|
#include <projectexplorer/target.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <projectexplorer/toolchainmanager.h>
|
#include <projectexplorer/toolchainmanager.h>
|
||||||
|
|
||||||
@@ -145,6 +148,8 @@ public:
|
|||||||
|
|
||||||
CommandLine withDockerExecCmd(const CommandLine &cmd, bool interactive = false);
|
CommandLine withDockerExecCmd(const CommandLine &cmd, bool interactive = false);
|
||||||
|
|
||||||
|
bool prepareForBuild(const Target *target);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool createContainer();
|
bool createContainer();
|
||||||
void startContainer();
|
void startContainer();
|
||||||
@@ -445,6 +450,14 @@ static QString getLocalIPv4Address()
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DockerDevicePrivate::prepareForBuild(const Target *target)
|
||||||
|
{
|
||||||
|
QTC_ASSERT(QThread::currentThread() == thread(), return false);
|
||||||
|
|
||||||
|
return ensureReachable(target->project()->projectDirectory())
|
||||||
|
&& ensureReachable(target->activeBuildConfiguration()->buildDirectory());
|
||||||
|
}
|
||||||
|
|
||||||
bool DockerDevicePrivate::createContainer()
|
bool DockerDevicePrivate::createContainer()
|
||||||
{
|
{
|
||||||
if (!m_settings)
|
if (!m_settings)
|
||||||
@@ -1357,4 +1370,9 @@ void DockerDevicePrivate::setData(const DockerDeviceData &data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DockerDevice::prepareForBuild(const Target *target)
|
||||||
|
{
|
||||||
|
return d->prepareForBuild(target);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Docker::Internal
|
} // namespace Docker::Internal
|
||||||
|
|||||||
@@ -122,6 +122,8 @@ public:
|
|||||||
void updateContainerAccess() const;
|
void updateContainerAccess() const;
|
||||||
void setMounts(const QStringList &mounts) const;
|
void setMounts(const QStringList &mounts) const;
|
||||||
|
|
||||||
|
bool prepareForBuild(const ProjectExplorer::Target *target) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void fromMap(const QVariantMap &map) final;
|
void fromMap(const QVariantMap &map) final;
|
||||||
QVariantMap toMap() const final;
|
QVariantMap toMap() const final;
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
|
|||||||
auto searchDirsComboBox = new QComboBox;
|
auto searchDirsComboBox = new QComboBox;
|
||||||
searchDirsComboBox->addItem(Tr::tr("Search in PATH"));
|
searchDirsComboBox->addItem(Tr::tr("Search in PATH"));
|
||||||
searchDirsComboBox->addItem(Tr::tr("Search in Selected Directories"));
|
searchDirsComboBox->addItem(Tr::tr("Search in Selected Directories"));
|
||||||
|
searchDirsComboBox->addItem(Tr::tr("Search in PATH and Additional Directories"));
|
||||||
|
|
||||||
auto searchDirsLineEdit = new FancyLineEdit;
|
auto searchDirsLineEdit = new FancyLineEdit;
|
||||||
|
|
||||||
@@ -132,9 +133,10 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
|
|||||||
|
|
||||||
auto searchPaths = [searchDirsComboBox, searchDirsLineEdit, dockerDevice] {
|
auto searchPaths = [searchDirsComboBox, searchDirsLineEdit, dockerDevice] {
|
||||||
FilePaths paths;
|
FilePaths paths;
|
||||||
if (searchDirsComboBox->currentIndex() == 0) {
|
const int idx = searchDirsComboBox->currentIndex();
|
||||||
paths = dockerDevice->systemEnvironment().path();
|
if (idx == 0 || idx == 2)
|
||||||
} else {
|
paths += dockerDevice->systemEnvironment().path();
|
||||||
|
if (idx == 1 || idx == 2) {
|
||||||
for (const QString &path : searchDirsLineEdit->text().split(';'))
|
for (const QString &path : searchDirsLineEdit->text().split(';'))
|
||||||
paths.append(FilePath::fromString(path.trimmed()));
|
paths.append(FilePath::fromString(path.trimmed()));
|
||||||
}
|
}
|
||||||
@@ -184,6 +186,7 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
|
|||||||
Column {
|
Column {
|
||||||
Space(20),
|
Space(20),
|
||||||
Row {
|
Row {
|
||||||
|
Tr::tr("Search Locations:"),
|
||||||
searchDirsComboBox,
|
searchDirsComboBox,
|
||||||
searchDirsLineEdit
|
searchDirsLineEdit
|
||||||
},
|
},
|
||||||
@@ -200,8 +203,8 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
|
|||||||
|
|
||||||
searchDirsLineEdit->setVisible(false);
|
searchDirsLineEdit->setVisible(false);
|
||||||
auto updateDirectoriesLineEdit = [searchDirsLineEdit](int index) {
|
auto updateDirectoriesLineEdit = [searchDirsLineEdit](int index) {
|
||||||
searchDirsLineEdit->setVisible(index == 1);
|
searchDirsLineEdit->setVisible(index == 1 || index == 2);
|
||||||
if (index == 1)
|
if (index == 1 || index == 2)
|
||||||
searchDirsLineEdit->setFocus();
|
searchDirsLineEdit->setFocus();
|
||||||
};
|
};
|
||||||
QObject::connect(searchDirsComboBox, &QComboBox::activated, this, updateDirectoriesLineEdit);
|
QObject::connect(searchDirsComboBox, &QComboBox::activated, this, updateDirectoriesLineEdit);
|
||||||
|
|||||||
@@ -434,10 +434,7 @@ void LanguageClientManager::showInspector()
|
|||||||
QString clientName;
|
QString clientName;
|
||||||
if (Client *client = clientForDocument(TextEditor::TextDocument::currentTextDocument()))
|
if (Client *client = clientForDocument(TextEditor::TextDocument::currentTextDocument()))
|
||||||
clientName = client->name();
|
clientName = client->name();
|
||||||
QWidget *inspectorWidget = instance()->m_inspector.createWidget(clientName);
|
instance()->m_inspector.show(clientName);
|
||||||
inspectorWidget->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
Core::ICore::registerWindow(inspectorWidget, Core::Context("LanguageClient.Inspector"));
|
|
||||||
inspectorWidget->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Client *> LanguageClientManager::reachableClients()
|
QList<Client *> LanguageClientManager::reachableClients()
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <utils/listmodel.h>
|
#include <utils/listmodel.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QApplication>
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
@@ -335,11 +336,18 @@ private:
|
|||||||
QListWidget *m_clients = nullptr;
|
QListWidget *m_clients = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
QWidget *LspInspector::createWidget(const QString &defaultClient)
|
void LspInspector::show(const QString &defaultClient)
|
||||||
{
|
{
|
||||||
auto *inspector = new LspInspectorWidget(this);
|
if (!m_currentWidget) {
|
||||||
inspector->selectClient(defaultClient);
|
m_currentWidget = new LspInspectorWidget(this);
|
||||||
return inspector;
|
m_currentWidget->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
Core::ICore::registerWindow(m_currentWidget, Core::Context("LanguageClient.Inspector"));
|
||||||
|
} else {
|
||||||
|
QApplication::setActiveWindow(m_currentWidget);
|
||||||
|
}
|
||||||
|
if (!defaultClient.isEmpty())
|
||||||
|
static_cast<LspInspectorWidget *>(m_currentWidget.data())->selectClient(defaultClient);
|
||||||
|
m_currentWidget->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LspInspector::log(const LspLogMessage::MessageSender sender,
|
void LspInspector::log(const LspLogMessage::MessageSender sender,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "dynamiccapabilities.h"
|
#include "dynamiccapabilities.h"
|
||||||
|
|
||||||
|
#include <QPointer>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
@@ -47,8 +48,7 @@ class LspInspector : public QObject
|
|||||||
public:
|
public:
|
||||||
LspInspector() {}
|
LspInspector() {}
|
||||||
|
|
||||||
QWidget *createWidget(const QString &defaultClient = {});
|
void show(const QString &defaultClient = {});
|
||||||
|
|
||||||
|
|
||||||
void log(const LspLogMessage::MessageSender sender,
|
void log(const LspLogMessage::MessageSender sender,
|
||||||
const QString &clientName,
|
const QString &clientName,
|
||||||
@@ -70,6 +70,7 @@ signals:
|
|||||||
private:
|
private:
|
||||||
QMap<QString, std::list<LspLogMessage>> m_logs;
|
QMap<QString, std::list<LspLogMessage>> m_logs;
|
||||||
QMap<QString, Capabilities> m_capabilities;
|
QMap<QString, Capabilities> m_capabilities;
|
||||||
|
QPointer<QWidget> m_currentWidget;
|
||||||
int m_logSize = 100; // default log size if no widget is currently visible
|
int m_logSize = 100; // default log size if no widget is currently visible
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -629,12 +629,23 @@ static PackageDescription parsePackage(const QJsonObject &cmakeEntry)
|
|||||||
[&](const QVariant &version) {
|
[&](const QVariant &version) {
|
||||||
return version.toString();
|
return version.toString();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Parse the default value depending on the operating system
|
||||||
|
QString defaultPathString;
|
||||||
|
if (cmakeEntry["defaultValue"].isObject())
|
||||||
|
defaultPathString
|
||||||
|
= cmakeEntry["defaultValue"]
|
||||||
|
.toObject()[HostOsInfo::isWindowsHost() ? QString("windows") : QString("unix")]
|
||||||
|
.toString("");
|
||||||
|
else
|
||||||
|
defaultPathString = cmakeEntry["defaultValue"].toString();
|
||||||
|
|
||||||
return {cmakeEntry["label"].toString(),
|
return {cmakeEntry["label"].toString(),
|
||||||
cmakeEntry["envVar"].toString(),
|
cmakeEntry["envVar"].toString(),
|
||||||
cmakeEntry["cmakeVar"].toString(),
|
cmakeEntry["cmakeVar"].toString(),
|
||||||
cmakeEntry["description"].toString(),
|
cmakeEntry["description"].toString(),
|
||||||
cmakeEntry["setting"].toString(),
|
cmakeEntry["setting"].toString(),
|
||||||
FilePath::fromUserInput(cmakeEntry["defaultValue"].toString()),
|
FilePath::fromUserInput(defaultPathString),
|
||||||
FilePath::fromUserInput(cmakeEntry["validation"].toString()),
|
FilePath::fromUserInput(cmakeEntry["validation"].toString()),
|
||||||
versions,
|
versions,
|
||||||
parseVersionDetection(cmakeEntry),
|
parseVersionDetection(cmakeEntry),
|
||||||
|
|||||||
@@ -25,15 +25,6 @@ constexpr auto armgcc_ek_ra6m3g_baremetal_json = R"(
|
|||||||
"unix": "/opt/SEGGER/JLink"
|
"unix": "/opt/SEGGER/JLink"
|
||||||
},
|
},
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
|
||||||
{
|
|
||||||
"cmakeVar": "EK_RA6M3G_E2_PROJECT_PATH",
|
|
||||||
"defaultValue": "%{Env:HOME}/e2_studio/workspace/",
|
|
||||||
"id": "EK_RA6M3G_E2_PROJECT_PATH",
|
|
||||||
"label": "Path to project for Renesas e2 Studio",
|
|
||||||
"optional": true,
|
|
||||||
"setting": "RenesasE2ProjectPath",
|
|
||||||
"type": "path"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,25 +8,30 @@ constexpr auto iar_ek_ra6m3g_baremetal_json = R"(
|
|||||||
"qulVersion": "2.3.0",
|
"qulVersion": "2.3.0",
|
||||||
"compatVersion": "1",
|
"compatVersion": "1",
|
||||||
"platform": {
|
"platform": {
|
||||||
"id": "TVIIC2D6M-BAREMETAL",
|
"id": "EK-RA6M3G-BAREMETAL",
|
||||||
"vendor": "CYPRESS",
|
"vendor": "RENESAS",
|
||||||
"colorDepths": [
|
"colorDepths": [
|
||||||
32
|
16
|
||||||
],
|
],
|
||||||
"cmakeEntries": [
|
"cmakeEntries": [
|
||||||
{
|
{
|
||||||
"id": "INFINEON_AUTO_FLASH_UTILITY_DIR",
|
"cmakeVar": "JLINK_PATH",
|
||||||
"label": "Cypress Auto Flash Utility",
|
"setting": "JLinkPath",
|
||||||
|
"envVar": "JLINK_PATH",
|
||||||
|
"label": "Path to SEGGER J-Link",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"cmakeVar": "INFINEON_AUTO_FLASH_UTILITY_DIR",
|
"defaultValue": {
|
||||||
"optional": false
|
"windows": "%{Env:PROGRAMSANDFILES}/SEGGER/JLink",
|
||||||
|
"unix": "/opt/SEGGER/JLink"
|
||||||
|
},
|
||||||
|
"optional": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"toolchain": {
|
"toolchain": {
|
||||||
"id": "iar",
|
"id": "iar",
|
||||||
"versions": [
|
"versions": [
|
||||||
"8.22.3"
|
"9.20.4"
|
||||||
],
|
],
|
||||||
"compiler": {
|
"compiler": {
|
||||||
"id": "IARToolchain",
|
"id": "IARToolchain",
|
||||||
@@ -51,15 +56,15 @@ constexpr auto iar_ek_ra6m3g_baremetal_json = R"(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"boardSdk": {
|
"boardSdk": {
|
||||||
"envVar": "TVII_GRAPHICS_DRIVER_DIR",
|
|
||||||
"versions": [
|
|
||||||
"V1e.1.0"
|
|
||||||
],
|
|
||||||
"id": "TVII_GRAPHICS_DRIVER_DIR",
|
|
||||||
"label": "Graphics Driver for Traveo II Cluster Series",
|
|
||||||
"cmakeVar": "QUL_BOARD_SDK_DIR",
|
"cmakeVar": "QUL_BOARD_SDK_DIR",
|
||||||
|
"envVar": "EK_RA6M3G_FSP_PATH",
|
||||||
|
"id": "EK_RA6M3G_FSP_PATH",
|
||||||
|
"label": "Flexible Software Package for Renesas RA MCU Family",
|
||||||
|
"optional": false,
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"optional": false
|
"versions": [
|
||||||
|
"3.8.0"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
|
|||||||
@@ -1444,4 +1444,14 @@ void McuSupportTest::test_legacy_createThirdPartyPackage()
|
|||||||
QVERIFY(qunsetenv(envVar.toLocal8Bit()));
|
QVERIFY(qunsetenv(envVar.toLocal8Bit()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void McuSupportTest::test_defaultValueForEachOperationSystem()
|
||||||
|
{
|
||||||
|
const auto packageDescription = parseDescriptionJson(armgcc_mimxrt1050_evk_freertos_json);
|
||||||
|
auto default_path_entry = packageDescription.platform.entries[0].defaultPath.toString();
|
||||||
|
|
||||||
|
if (HostOsInfo::isWindowsHost())
|
||||||
|
QCOMPARE(QString("%{Env:ROOT}/nxp/MCUXpressoIDE*"), default_path_entry);
|
||||||
|
else
|
||||||
|
QCOMPARE(QString("/usr/local/mcuxpressoide"), default_path_entry);
|
||||||
|
};
|
||||||
} // namespace McuSupport::Internal::Test
|
} // namespace McuSupport::Internal::Test
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ private slots:
|
|||||||
void test_legacy_createThirdPartyPackage_data();
|
void test_legacy_createThirdPartyPackage_data();
|
||||||
void test_legacy_createThirdPartyPackage();
|
void test_legacy_createThirdPartyPackage();
|
||||||
|
|
||||||
|
void test_defaultValueForEachOperationSystem();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVersionNumber currentQulVersion{2, 0};
|
QVersionNumber currentQulVersion{2, 0};
|
||||||
PackageMock *freeRtosPackage{new PackageMock};
|
PackageMock *freeRtosPackage{new PackageMock};
|
||||||
|
|||||||
@@ -159,6 +159,24 @@ static int queue(const QList<Project *> &projects, const QList<Id> &stepIds,
|
|||||||
.arg(pro->displayName()) + QLatin1Char('\n'));
|
.arg(pro->displayName()) + QLatin1Char('\n'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (const Project *pro : projects) {
|
||||||
|
for (const Target *const t : targetsForSelection(pro, configSelection)) {
|
||||||
|
for (const BuildConfiguration *bc : buildConfigsForSelection(t, configSelection)) {
|
||||||
|
const IDevice::Ptr device = BuildDeviceKitAspect::device(bc->kit())
|
||||||
|
.constCast<IDevice>();
|
||||||
|
|
||||||
|
if (device && !device->prepareForBuild(t)) {
|
||||||
|
preambleMessage.append(
|
||||||
|
BuildManager::tr("The build device failed to prepare for the build of %1 "
|
||||||
|
"(%2).")
|
||||||
|
.arg(pro->displayName())
|
||||||
|
.arg(t->displayName())
|
||||||
|
+ QLatin1Char('\n'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (const Id id : stepIds) {
|
for (const Id id : stepIds) {
|
||||||
const bool isBuild = id == Constants::BUILDSTEPS_BUILD;
|
const bool isBuild = id == Constants::BUILDSTEPS_BUILD;
|
||||||
const bool isClean = id == Constants::BUILDSTEPS_CLEAN;
|
const bool isClean = id == Constants::BUILDSTEPS_CLEAN;
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
#include "../kitinformation.h"
|
#include "../kitinformation.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <utils/displayname.h>
|
#include <utils/displayname.h>
|
||||||
#include <utils/icon.h>
|
#include <utils/icon.h>
|
||||||
#include <utils/portlist.h>
|
#include <utils/portlist.h>
|
||||||
@@ -822,6 +825,12 @@ bool IDevice::ensureReachable(const FilePath &other) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IDevice::prepareForBuild(const Target *target)
|
||||||
|
{
|
||||||
|
Q_UNUSED(target)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceProcessSignalOperation::setDebuggerCommand(const FilePath &cmd)
|
void DeviceProcessSignalOperation::setDebuggerCommand(const FilePath &cmd)
|
||||||
{
|
{
|
||||||
m_debuggerCommand = cmd;
|
m_debuggerCommand = cmd;
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class FileTransferInterface;
|
|||||||
class FileTransferSetupData;
|
class FileTransferSetupData;
|
||||||
class Kit;
|
class Kit;
|
||||||
class SshParameters;
|
class SshParameters;
|
||||||
|
class Target;
|
||||||
class Task;
|
class Task;
|
||||||
|
|
||||||
namespace Internal { class IDevicePrivate; }
|
namespace Internal { class IDevicePrivate; }
|
||||||
@@ -263,6 +264,8 @@ public:
|
|||||||
|
|
||||||
virtual bool ensureReachable(const Utils::FilePath &other) const;
|
virtual bool ensureReachable(const Utils::FilePath &other) const;
|
||||||
|
|
||||||
|
virtual bool prepareForBuild(const Target *target);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
IDevice();
|
IDevice();
|
||||||
|
|
||||||
|
|||||||
@@ -2277,6 +2277,9 @@ void ProjectExplorerPlugin::extensionsInitialized()
|
|||||||
});
|
});
|
||||||
mtools->addAction(cmd);
|
mtools->addAction(cmd);
|
||||||
|
|
||||||
|
// Load devices immediately, as other plugins might want to use them
|
||||||
|
DeviceManager::instance()->load();
|
||||||
|
|
||||||
// delay restoring kits until UI is shown for improved perceived startup performance
|
// delay restoring kits until UI is shown for improved perceived startup performance
|
||||||
QTimer::singleShot(0, this, &ProjectExplorerPlugin::restoreKits);
|
QTimer::singleShot(0, this, &ProjectExplorerPlugin::restoreKits);
|
||||||
}
|
}
|
||||||
@@ -2285,7 +2288,6 @@ void ProjectExplorerPlugin::restoreKits()
|
|||||||
{
|
{
|
||||||
dd->determineSessionToRestoreAtStartup();
|
dd->determineSessionToRestoreAtStartup();
|
||||||
ExtraAbi::load(); // Load this before Toolchains!
|
ExtraAbi::load(); // Load this before Toolchains!
|
||||||
DeviceManager::instance()->load();
|
|
||||||
ToolChainManager::restoreToolChains();
|
ToolChainManager::restoreToolChains();
|
||||||
KitManager::restoreKits();
|
KitManager::restoreKits();
|
||||||
QTimer::singleShot(0, dd, &ProjectExplorerPluginPrivate::restoreSession); // delay a bit...
|
QTimer::singleShot(0, dd, &ProjectExplorerPluginPrivate::restoreSession); // delay a bit...
|
||||||
|
|||||||
@@ -69,42 +69,40 @@ static FilePath buildDir(const FilePath &projectFilePath, const Kit *k)
|
|||||||
projectFilePath, projectName, k, QString(), BuildConfiguration::Unknown, "qbs");
|
projectFilePath, projectName, k, QString(), BuildConfiguration::Unknown, "qbs");
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool hasBuildGraph(const QString &dir)
|
static bool hasBuildGraph(const FilePath &dir)
|
||||||
{
|
{
|
||||||
const QString &dirName = QFileInfo(dir).fileName();
|
return dir.pathAppended(dir.fileName() + ".bg").exists();
|
||||||
return QFileInfo::exists(dir + QLatin1Char('/') + dirName + QLatin1String(".bg"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static QStringList candidatesForDirectory(const QString &dir)
|
static FilePaths candidatesForDirectory(const FilePath &dir)
|
||||||
{
|
{
|
||||||
QStringList candidates;
|
FilePaths candidates;
|
||||||
const QStringList &subDirs = QDir(dir).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
const FilePaths subDirs = dir.dirEntries(QDir::Dirs | QDir::NoDotAndDotDot);
|
||||||
for (const QString &subDir : subDirs) {
|
for (const FilePath &subDir : subDirs) {
|
||||||
const QString absSubDir = dir + QLatin1Char('/') + subDir;
|
if (hasBuildGraph(subDir))
|
||||||
if (hasBuildGraph(absSubDir))
|
candidates << subDir;
|
||||||
candidates << absSubDir;
|
|
||||||
}
|
}
|
||||||
return candidates;
|
return candidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
FilePaths QbsProjectImporter::importCandidates()
|
FilePaths QbsProjectImporter::importCandidates()
|
||||||
{
|
{
|
||||||
const QString projectDir = projectFilePath().toFileInfo().absolutePath();
|
const FilePath projectDir = projectFilePath().absolutePath();
|
||||||
QStringList candidates = candidatesForDirectory(projectDir);
|
FilePaths candidates = candidatesForDirectory(projectDir);
|
||||||
|
|
||||||
QSet<QString> seenCandidates;
|
QSet<FilePath> seenCandidates;
|
||||||
seenCandidates.insert(projectDir);
|
seenCandidates.insert(projectDir);
|
||||||
const auto &kits = KitManager::kits();
|
const auto &kits = KitManager::kits();
|
||||||
for (Kit * const k : kits) {
|
for (Kit * const k : kits) {
|
||||||
QFileInfo fi = buildDir(projectFilePath(), k).toFileInfo();
|
FilePath bdir = buildDir(projectFilePath(), k);
|
||||||
const QString candidate = fi.absolutePath();
|
const FilePath candidate = bdir.absolutePath();
|
||||||
if (!seenCandidates.contains(candidate)) {
|
if (!seenCandidates.contains(candidate)) {
|
||||||
seenCandidates.insert(candidate);
|
seenCandidates.insert(candidate);
|
||||||
candidates << candidatesForDirectory(candidate);
|
candidates << candidatesForDirectory(candidate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qCDebug(qbsPmLog) << "build directory candidates:" << candidates;
|
qCDebug(qbsPmLog) << "build directory candidates:" << candidates;
|
||||||
return Utils::transform(candidates, &FilePath::fromString);
|
return candidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<void *> QbsProjectImporter::examineDirectory(const FilePath &importPath,
|
QList<void *> QbsProjectImporter::examineDirectory(const FilePath &importPath,
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ add_qtc_plugin(QmakeProjectManager
|
|||||||
PLUGIN_DEPENDS Core CppEditor QtSupport ResourceEditor TextEditor
|
PLUGIN_DEPENDS Core CppEditor QtSupport ResourceEditor TextEditor
|
||||||
SOURCES
|
SOURCES
|
||||||
addlibrarywizard.cpp addlibrarywizard.h
|
addlibrarywizard.cpp addlibrarywizard.h
|
||||||
customwidgetwizard/classdefinition.cpp customwidgetwizard/classdefinition.h customwidgetwizard/classdefinition.ui
|
customwidgetwizard/classdefinition.cpp customwidgetwizard/classdefinition.h
|
||||||
customwidgetwizard/classlist.cpp customwidgetwizard/classlist.h
|
customwidgetwizard/classlist.cpp customwidgetwizard/classlist.h
|
||||||
customwidgetwizard/customwidgetpluginwizardpage.cpp customwidgetwizard/customwidgetpluginwizardpage.h customwidgetwizard/customwidgetpluginwizardpage.ui
|
customwidgetwizard/customwidgetpluginwizardpage.cpp customwidgetwizard/customwidgetpluginwizardpage.h
|
||||||
customwidgetwizard/customwidgetwidgetswizardpage.cpp customwidgetwizard/customwidgetwidgetswizardpage.h customwidgetwizard/customwidgetwidgetswizardpage.ui
|
customwidgetwizard/customwidgetwidgetswizardpage.cpp customwidgetwizard/customwidgetwidgetswizardpage.h
|
||||||
customwidgetwizard/customwidgetwizard.cpp customwidgetwizard/customwidgetwizard.h
|
customwidgetwizard/customwidgetwizard.cpp customwidgetwizard/customwidgetwizard.h
|
||||||
customwidgetwizard/customwidgetwizarddialog.cpp customwidgetwizard/customwidgetwizarddialog.h
|
customwidgetwizard/customwidgetwizarddialog.cpp customwidgetwizard/customwidgetwizarddialog.h
|
||||||
customwidgetwizard/filenamingparameters.h
|
customwidgetwizard/filenamingparameters.h
|
||||||
|
|||||||
@@ -3,7 +3,15 @@
|
|||||||
|
|
||||||
#include "classdefinition.h"
|
#include "classdefinition.h"
|
||||||
|
|
||||||
|
#include <utils/layoutbuilder.h>
|
||||||
|
#include <utils/pathchooser.h>
|
||||||
|
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QRadioButton>
|
||||||
|
#include <QTextEdit>
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -12,44 +20,102 @@ ClassDefinition::ClassDefinition(QWidget *parent) :
|
|||||||
QTabWidget(parent),
|
QTabWidget(parent),
|
||||||
m_domXmlChanged(false)
|
m_domXmlChanged(false)
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
using namespace Utils::Layouting;
|
||||||
m_ui.iconPathChooser->setExpectedKind(Utils::PathChooser::File);
|
|
||||||
m_ui.iconPathChooser->setHistoryCompleter(QLatin1String("Qmake.Icon.History"));
|
|
||||||
m_ui.iconPathChooser->setPromptDialogTitle(tr("Select Icon"));
|
|
||||||
m_ui.iconPathChooser->setPromptDialogFilter(tr("Icon files (*.png *.ico *.jpg *.xpm *.tif *.svg)"));
|
|
||||||
|
|
||||||
connect(m_ui.libraryRadio, &QRadioButton::toggled, this, &ClassDefinition::enableButtons);
|
// "Sources" tab
|
||||||
connect(m_ui.skeletonCheck, &QCheckBox::toggled, this, &ClassDefinition::enableButtons);
|
auto sourceTab = new QWidget;
|
||||||
connect(m_ui.widgetLibraryEdit, &QLineEdit::textChanged,
|
m_libraryRadio = new QRadioButton(tr("&Link library"));
|
||||||
|
auto includeRadio = new QRadioButton(tr("Include pro&ject"));
|
||||||
|
includeRadio->setChecked(true);
|
||||||
|
m_skeletonCheck = new QCheckBox(tr("Create s&keleton"));
|
||||||
|
m_widgetLibraryLabel = new QLabel(tr("Widget librar&y:"));
|
||||||
|
m_widgetLibraryEdit = new QLineEdit;
|
||||||
|
m_widgetProjectLabel = new QLabel(tr("Widget project &file:"));
|
||||||
|
m_widgetProjectEdit = new QLineEdit;
|
||||||
|
m_widgetHeaderEdit = new QLineEdit;
|
||||||
|
m_widgetSourceLabel = new QLabel(tr("Widge&t source file:"));
|
||||||
|
m_widgetSourceEdit = new QLineEdit;
|
||||||
|
m_widgetBaseClassLabel = new QLabel(tr("Widget &base class:"));
|
||||||
|
m_widgetBaseClassEdit = new QLineEdit("QWidget");
|
||||||
|
m_pluginClassEdit = new QLineEdit;
|
||||||
|
m_pluginHeaderEdit = new QLineEdit;
|
||||||
|
m_pluginSourceEdit = new QLineEdit;
|
||||||
|
m_iconPathChooser = new Utils::PathChooser;
|
||||||
|
m_iconPathChooser->setExpectedKind(Utils::PathChooser::File);
|
||||||
|
m_iconPathChooser->setHistoryCompleter(QLatin1String("Qmake.Icon.History"));
|
||||||
|
m_iconPathChooser->setPromptDialogTitle(tr("Select Icon"));
|
||||||
|
m_iconPathChooser->setPromptDialogFilter(tr("Icon files (*.png *.ico *.jpg *.xpm *.tif *.svg)"));
|
||||||
|
Form {
|
||||||
|
empty, Row { Column { m_libraryRadio, includeRadio }, m_skeletonCheck}, br,
|
||||||
|
m_widgetLibraryLabel, m_widgetLibraryEdit, br,
|
||||||
|
m_widgetProjectLabel, m_widgetProjectEdit, br,
|
||||||
|
tr("Widget h&eader file:"), m_widgetHeaderEdit, br,
|
||||||
|
m_widgetSourceLabel, m_widgetSourceEdit, br,
|
||||||
|
m_widgetBaseClassLabel, m_widgetBaseClassEdit, br,
|
||||||
|
tr("Plugin class &name:"), m_pluginClassEdit, br,
|
||||||
|
tr("Plugin &header file:"), m_pluginHeaderEdit, br,
|
||||||
|
tr("Plugin sou&rce file:"), m_pluginSourceEdit, br,
|
||||||
|
tr("Icon file:"), m_iconPathChooser, br,
|
||||||
|
}.attachTo(sourceTab);
|
||||||
|
addTab(sourceTab, tr("&Sources"));
|
||||||
|
|
||||||
|
// "Description" tab
|
||||||
|
auto descriptionTab = new QWidget;
|
||||||
|
m_groupEdit = new QLineEdit;
|
||||||
|
m_tooltipEdit = new QLineEdit;
|
||||||
|
m_whatsthisEdit = new QTextEdit;
|
||||||
|
m_containerCheck = new QCheckBox(tr("The widget is a &container"));
|
||||||
|
Form {
|
||||||
|
tr("G&roup:"), m_groupEdit, br,
|
||||||
|
tr("&Tooltip:"), m_tooltipEdit, br,
|
||||||
|
tr("W&hat's this:"), m_whatsthisEdit, br,
|
||||||
|
empty, m_containerCheck, br,
|
||||||
|
}.attachTo(descriptionTab);
|
||||||
|
addTab(descriptionTab, tr("&Description"));
|
||||||
|
|
||||||
|
// "Property defaults" tab
|
||||||
|
auto propertyDefaultsTab = new QWidget;
|
||||||
|
auto domXmlLabel = new QLabel(tr("dom&XML:"));
|
||||||
|
m_domXmlEdit = new QTextEdit;
|
||||||
|
domXmlLabel->setBuddy(m_domXmlEdit);
|
||||||
|
Column {
|
||||||
|
domXmlLabel,
|
||||||
|
m_domXmlEdit,
|
||||||
|
}.attachTo(propertyDefaultsTab);
|
||||||
|
addTab(propertyDefaultsTab, tr("Property defa&ults"));
|
||||||
|
|
||||||
|
connect(m_libraryRadio, &QRadioButton::toggled, this, &ClassDefinition::enableButtons);
|
||||||
|
connect(m_skeletonCheck, &QCheckBox::toggled, this, &ClassDefinition::enableButtons);
|
||||||
|
connect(m_widgetLibraryEdit, &QLineEdit::textChanged,
|
||||||
this, &ClassDefinition::widgetLibraryChanged);
|
this, &ClassDefinition::widgetLibraryChanged);
|
||||||
connect(m_ui.widgetHeaderEdit, &QLineEdit::textChanged,
|
connect(m_widgetHeaderEdit, &QLineEdit::textChanged,
|
||||||
this, &ClassDefinition::widgetHeaderChanged);
|
this, &ClassDefinition::widgetHeaderChanged);
|
||||||
connect(m_ui.pluginClassEdit, &QLineEdit::textChanged,
|
connect(m_pluginClassEdit, &QLineEdit::textChanged,
|
||||||
this, &ClassDefinition::pluginClassChanged);
|
this, &ClassDefinition::pluginClassChanged);
|
||||||
connect(m_ui.pluginHeaderEdit, &QLineEdit::textChanged,
|
connect(m_pluginHeaderEdit, &QLineEdit::textChanged,
|
||||||
this, &ClassDefinition::pluginHeaderChanged);
|
this, &ClassDefinition::pluginHeaderChanged);
|
||||||
connect(m_ui.domXmlEdit, &QTextEdit::textChanged,
|
connect(m_domXmlEdit, &QTextEdit::textChanged,
|
||||||
this, [this] { m_domXmlChanged = true; });
|
this, [this] { m_domXmlChanged = true; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDefinition::enableButtons()
|
void ClassDefinition::enableButtons()
|
||||||
{
|
{
|
||||||
const bool enLib = m_ui.libraryRadio->isChecked();
|
const bool enLib = m_libraryRadio->isChecked();
|
||||||
m_ui.widgetLibraryLabel->setEnabled(enLib);
|
m_widgetLibraryLabel->setEnabled(enLib);
|
||||||
m_ui.widgetLibraryEdit->setEnabled(enLib);
|
m_widgetLibraryEdit->setEnabled(enLib);
|
||||||
|
|
||||||
const bool enSrc = m_ui.skeletonCheck->isChecked();
|
const bool enSrc = m_skeletonCheck->isChecked();
|
||||||
m_ui.widgetSourceLabel->setEnabled(enSrc);
|
m_widgetSourceLabel->setEnabled(enSrc);
|
||||||
m_ui.widgetSourceEdit->setEnabled(enSrc);
|
m_widgetSourceEdit->setEnabled(enSrc);
|
||||||
m_ui.widgetBaseClassLabel->setEnabled(enSrc);
|
m_widgetBaseClassLabel->setEnabled(enSrc);
|
||||||
m_ui.widgetBaseClassEdit->setEnabled(enSrc);
|
m_widgetBaseClassEdit->setEnabled(enSrc);
|
||||||
|
|
||||||
const bool enPrj = !enLib || enSrc;
|
const bool enPrj = !enLib || enSrc;
|
||||||
m_ui.widgetProjectLabel->setEnabled(enPrj);
|
m_widgetProjectLabel->setEnabled(enPrj);
|
||||||
m_ui.widgetProjectEdit->setEnabled(enPrj);
|
m_widgetProjectEdit->setEnabled(enPrj);
|
||||||
m_ui.widgetProjectEdit->setText(
|
m_widgetProjectEdit->setText(
|
||||||
QFileInfo(m_ui.widgetProjectEdit->text()).completeBaseName() +
|
QFileInfo(m_widgetProjectEdit->text()).completeBaseName() +
|
||||||
(m_ui.libraryRadio->isChecked() ? QLatin1String(".pro") : QLatin1String(".pri")));
|
(m_libraryRadio->isChecked() ? QLatin1String(".pro") : QLatin1String(".pri")));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QString xmlFromClassName(const QString &name)
|
static inline QString xmlFromClassName(const QString &name)
|
||||||
@@ -68,59 +134,59 @@ static inline QString xmlFromClassName(const QString &name)
|
|||||||
|
|
||||||
void ClassDefinition::setClassName(const QString &name)
|
void ClassDefinition::setClassName(const QString &name)
|
||||||
{
|
{
|
||||||
m_ui.widgetLibraryEdit->setText(name.toLower());
|
m_widgetLibraryEdit->setText(name.toLower());
|
||||||
m_ui.widgetHeaderEdit->setText(m_fileNamingParameters.headerFileName(name));
|
m_widgetHeaderEdit->setText(m_fileNamingParameters.headerFileName(name));
|
||||||
m_ui.pluginClassEdit->setText(name + QLatin1String("Plugin"));
|
m_pluginClassEdit->setText(name + QLatin1String("Plugin"));
|
||||||
if (!m_domXmlChanged) {
|
if (!m_domXmlChanged) {
|
||||||
m_ui.domXmlEdit->setText(xmlFromClassName(name));
|
m_domXmlEdit->setText(xmlFromClassName(name));
|
||||||
m_domXmlChanged = false;
|
m_domXmlChanged = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDefinition::widgetLibraryChanged(const QString &text)
|
void ClassDefinition::widgetLibraryChanged(const QString &text)
|
||||||
{
|
{
|
||||||
m_ui.widgetProjectEdit->setText(text +
|
m_widgetProjectEdit->setText(text +
|
||||||
(m_ui.libraryRadio->isChecked() ? QLatin1String(".pro") : QLatin1String(".pri")));
|
(m_libraryRadio->isChecked() ? QLatin1String(".pro") : QLatin1String(".pri")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDefinition::widgetHeaderChanged(const QString &text)
|
void ClassDefinition::widgetHeaderChanged(const QString &text)
|
||||||
{
|
{
|
||||||
m_ui.widgetSourceEdit->setText(m_fileNamingParameters.headerToSourceFileName(text));
|
m_widgetSourceEdit->setText(m_fileNamingParameters.headerToSourceFileName(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDefinition::pluginClassChanged(const QString &text)
|
void ClassDefinition::pluginClassChanged(const QString &text)
|
||||||
{
|
{
|
||||||
m_ui.pluginHeaderEdit->setText(m_fileNamingParameters.headerFileName(text));
|
m_pluginHeaderEdit->setText(m_fileNamingParameters.headerFileName(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDefinition::pluginHeaderChanged(const QString &text)
|
void ClassDefinition::pluginHeaderChanged(const QString &text)
|
||||||
{
|
{
|
||||||
m_ui.pluginSourceEdit->setText(m_fileNamingParameters.headerToSourceFileName(text));
|
m_pluginSourceEdit->setText(m_fileNamingParameters.headerToSourceFileName(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginOptions::WidgetOptions ClassDefinition::widgetOptions(const QString &className) const
|
PluginOptions::WidgetOptions ClassDefinition::widgetOptions(const QString &className) const
|
||||||
{
|
{
|
||||||
PluginOptions::WidgetOptions wo;
|
PluginOptions::WidgetOptions wo;
|
||||||
wo.createSkeleton = m_ui.skeletonCheck->isChecked();
|
wo.createSkeleton = m_skeletonCheck->isChecked();
|
||||||
wo.sourceType =
|
wo.sourceType =
|
||||||
m_ui.libraryRadio->isChecked() ?
|
m_libraryRadio->isChecked() ?
|
||||||
PluginOptions::WidgetOptions::LinkLibrary :
|
PluginOptions::WidgetOptions::LinkLibrary :
|
||||||
PluginOptions::WidgetOptions::IncludeProject;
|
PluginOptions::WidgetOptions::IncludeProject;
|
||||||
wo.widgetLibrary = m_ui.widgetLibraryEdit->text();
|
wo.widgetLibrary = m_widgetLibraryEdit->text();
|
||||||
wo.widgetProjectFile = m_ui.widgetProjectEdit->text();
|
wo.widgetProjectFile = m_widgetProjectEdit->text();
|
||||||
wo.widgetClassName = className;
|
wo.widgetClassName = className;
|
||||||
wo.widgetHeaderFile = m_ui.widgetHeaderEdit->text();
|
wo.widgetHeaderFile = m_widgetHeaderEdit->text();
|
||||||
wo.widgetSourceFile = m_ui.widgetSourceEdit->text();
|
wo.widgetSourceFile = m_widgetSourceEdit->text();
|
||||||
wo.widgetBaseClassName = m_ui.widgetBaseClassEdit->text();
|
wo.widgetBaseClassName = m_widgetBaseClassEdit->text();
|
||||||
wo.pluginClassName = m_ui.pluginClassEdit->text();
|
wo.pluginClassName = m_pluginClassEdit->text();
|
||||||
wo.pluginHeaderFile = m_ui.pluginHeaderEdit->text();
|
wo.pluginHeaderFile = m_pluginHeaderEdit->text();
|
||||||
wo.pluginSourceFile = m_ui.pluginSourceEdit->text();
|
wo.pluginSourceFile = m_pluginSourceEdit->text();
|
||||||
wo.iconFile = m_ui.iconPathChooser->filePath().toString();
|
wo.iconFile = m_iconPathChooser->filePath().toString();
|
||||||
wo.group = m_ui.groupEdit->text();
|
wo.group = m_groupEdit->text();
|
||||||
wo.toolTip = m_ui.tooltipEdit->text();
|
wo.toolTip = m_tooltipEdit->text();
|
||||||
wo.whatsThis = m_ui.whatsthisEdit->toPlainText();
|
wo.whatsThis = m_whatsthisEdit->toPlainText();
|
||||||
wo.isContainer = m_ui.containerCheck->isChecked();
|
wo.isContainer = m_containerCheck->isChecked();
|
||||||
wo.domXml = m_ui.domXmlEdit->toPlainText();
|
wo.domXml = m_domXmlEdit->toPlainText();
|
||||||
return wo;
|
return wo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,21 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ui_classdefinition.h"
|
|
||||||
#include "filenamingparameters.h"
|
#include "filenamingparameters.h"
|
||||||
#include "pluginoptions.h"
|
#include "pluginoptions.h"
|
||||||
|
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QCheckBox;
|
||||||
|
class QLabel;
|
||||||
|
class QLineEdit;
|
||||||
|
class QRadioButton;
|
||||||
|
class QTextEdit;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
namespace Utils { class PathChooser; }
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -34,9 +43,29 @@ private Q_SLOTS:
|
|||||||
void pluginHeaderChanged(const QString &text);
|
void pluginHeaderChanged(const QString &text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ClassDefinition m_ui;
|
|
||||||
FileNamingParameters m_fileNamingParameters;
|
FileNamingParameters m_fileNamingParameters;
|
||||||
bool m_domXmlChanged;
|
bool m_domXmlChanged;
|
||||||
|
|
||||||
|
Utils::PathChooser *m_iconPathChooser;
|
||||||
|
QRadioButton *m_libraryRadio;
|
||||||
|
QCheckBox *m_skeletonCheck;
|
||||||
|
QLabel *m_widgetLibraryLabel;
|
||||||
|
QLineEdit *m_widgetLibraryEdit;
|
||||||
|
QLabel *m_widgetSourceLabel;
|
||||||
|
QLineEdit *m_widgetSourceEdit;
|
||||||
|
QLabel *m_widgetBaseClassLabel;
|
||||||
|
QLineEdit *m_widgetBaseClassEdit;
|
||||||
|
QLabel *m_widgetProjectLabel;
|
||||||
|
QLineEdit *m_widgetProjectEdit;
|
||||||
|
QLineEdit *m_widgetHeaderEdit;
|
||||||
|
QLineEdit *m_pluginClassEdit;
|
||||||
|
QLineEdit *m_pluginSourceEdit;
|
||||||
|
QLineEdit *m_pluginHeaderEdit;
|
||||||
|
QLineEdit *m_groupEdit;
|
||||||
|
QLineEdit *m_tooltipEdit;
|
||||||
|
QTextEdit *m_whatsthisEdit;
|
||||||
|
QCheckBox *m_containerCheck;
|
||||||
|
QTextEdit *m_domXmlEdit;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,324 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>QmakeProjectManager::Internal::ClassDefinition</class>
|
|
||||||
<widget class="QTabWidget" name="QmakeProjectManager::Internal::ClassDefinition">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>649</width>
|
|
||||||
<height>427</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="whatsThis">
|
|
||||||
<string>The header file</string>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="sourceTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>&Sources</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="widgetLibraryLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Widget librar&y:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>widgetLibraryEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="widgetLibraryEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="widgetProjectLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Widget project &file:</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>widgetProjectEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLineEdit" name="widgetProjectEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="widgetHeaderLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Widget h&eader file:</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>widgetHeaderEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLineEdit" name="widgetHeaderEdit">
|
|
||||||
<property name="whatsThis">
|
|
||||||
<string>The header file has to be specified in source code.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="widgetSourceLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Widge&t source file:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>widgetSourceEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QLineEdit" name="widgetSourceEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="widgetBaseClassLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Widget &base class:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>widgetBaseClassEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QLineEdit" name="widgetBaseClassEdit">
|
|
||||||
<property name="text">
|
|
||||||
<string>QWidget</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<widget class="QLabel" name="pluginClassLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Plugin class &name:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>pluginClassEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QLineEdit" name="pluginClassEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="pluginHeaderLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Plugin &header file:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>pluginHeaderEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="1">
|
|
||||||
<widget class="QLineEdit" name="pluginHeaderEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="QLabel" name="pluginSourceLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Plugin sou&rce file:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>pluginSourceEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="1">
|
|
||||||
<widget class="QLineEdit" name="pluginSourceEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="0">
|
|
||||||
<widget class="QLabel" name="iconLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Icon file:</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="1">
|
|
||||||
<widget class="Utils::PathChooser" name="iconPathChooser"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QRadioButton" name="libraryRadio">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Link library</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1" rowspan="2">
|
|
||||||
<widget class="QCheckBox" name="skeletonCheck">
|
|
||||||
<property name="text">
|
|
||||||
<string>Create s&keleton</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QRadioButton" name="includeRadio">
|
|
||||||
<property name="text">
|
|
||||||
<string>Include pro&ject</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="descriptionTab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>&Description</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
|
||||||
<property name="fieldGrowthPolicy">
|
|
||||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>G&roup:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>groupEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="groupEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>&Tooltip:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>tooltipEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="tooltipEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>W&hat's this:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>whatsthisEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QTextEdit" name="whatsthisEdit">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>36</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>100</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QCheckBox" name="containerCheck">
|
|
||||||
<property name="text">
|
|
||||||
<string>The widget is a &container</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="propertyDefaults">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Property defa&ults</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QTextEdit" name="domXmlEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>dom&XML:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>domXmlEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>Utils::PathChooser</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header location="global">utils/pathchooser.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<tabstops>
|
|
||||||
<tabstop>libraryRadio</tabstop>
|
|
||||||
<tabstop>includeRadio</tabstop>
|
|
||||||
<tabstop>skeletonCheck</tabstop>
|
|
||||||
<tabstop>widgetLibraryEdit</tabstop>
|
|
||||||
<tabstop>widgetProjectEdit</tabstop>
|
|
||||||
<tabstop>widgetHeaderEdit</tabstop>
|
|
||||||
<tabstop>widgetSourceEdit</tabstop>
|
|
||||||
<tabstop>widgetBaseClassEdit</tabstop>
|
|
||||||
<tabstop>pluginClassEdit</tabstop>
|
|
||||||
<tabstop>pluginHeaderEdit</tabstop>
|
|
||||||
<tabstop>pluginSourceEdit</tabstop>
|
|
||||||
<tabstop>groupEdit</tabstop>
|
|
||||||
<tabstop>tooltipEdit</tabstop>
|
|
||||||
<tabstop>whatsthisEdit</tabstop>
|
|
||||||
<tabstop>containerCheck</tabstop>
|
|
||||||
<tabstop>domXmlEdit</tabstop>
|
|
||||||
</tabstops>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
@@ -3,10 +3,13 @@
|
|||||||
|
|
||||||
#include "customwidgetpluginwizardpage.h"
|
#include "customwidgetpluginwizardpage.h"
|
||||||
#include "customwidgetwidgetswizardpage.h"
|
#include "customwidgetwidgetswizardpage.h"
|
||||||
#include "ui_customwidgetpluginwizardpage.h"
|
|
||||||
|
|
||||||
|
#include <utils/layoutbuilder.h>
|
||||||
#include <utils/wizard.h>
|
#include <utils/wizard.h>
|
||||||
|
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QLineEdit>
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -18,41 +21,56 @@ static inline QString createPluginName(const QString &prefix)
|
|||||||
|
|
||||||
CustomWidgetPluginWizardPage::CustomWidgetPluginWizardPage(QWidget *parent) :
|
CustomWidgetPluginWizardPage::CustomWidgetPluginWizardPage(QWidget *parent) :
|
||||||
QWizardPage(parent),
|
QWizardPage(parent),
|
||||||
m_ui(new Ui::CustomWidgetPluginWizardPage),
|
|
||||||
m_classCount(-1),
|
m_classCount(-1),
|
||||||
m_complete(false)
|
m_complete(false)
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_collectionClassLabel = new QLabel(tr("Collection class:"));
|
||||||
connect(m_ui->collectionClassEdit, &QLineEdit::textEdited,
|
m_collectionClassEdit = new QLineEdit;
|
||||||
|
m_collectionHeaderLabel = new QLabel(tr("Collection header file:"));
|
||||||
|
m_collectionHeaderEdit = new QLineEdit;
|
||||||
|
m_collectionSourceLabel = new QLabel(tr("Collection source file:"));
|
||||||
|
m_collectionSourceEdit = new QLineEdit;
|
||||||
|
m_pluginNameEdit = new QLineEdit;
|
||||||
|
m_resourceFileEdit = new QLineEdit(tr("icons.qrc"));
|
||||||
|
|
||||||
|
using namespace Utils::Layouting;
|
||||||
|
Column {
|
||||||
|
tr("Specify the properties of the plugin library and the collection class."),
|
||||||
|
Space(10),
|
||||||
|
Form {
|
||||||
|
m_collectionClassLabel, m_collectionClassEdit, br,
|
||||||
|
m_collectionHeaderLabel, m_collectionHeaderEdit, br,
|
||||||
|
m_collectionSourceLabel, m_collectionSourceEdit, br,
|
||||||
|
tr("Plugin name:"), m_pluginNameEdit, br,
|
||||||
|
tr("Resource file:"), m_resourceFileEdit, br,
|
||||||
|
}
|
||||||
|
}.attachTo(this);
|
||||||
|
|
||||||
|
connect(m_collectionClassEdit, &QLineEdit::textEdited,
|
||||||
this, &CustomWidgetPluginWizardPage::slotCheckCompleteness);
|
this, &CustomWidgetPluginWizardPage::slotCheckCompleteness);
|
||||||
connect(m_ui->collectionClassEdit, &QLineEdit::textChanged,
|
connect(m_collectionClassEdit, &QLineEdit::textChanged,
|
||||||
this, [this](const QString &collectionClass) {
|
this, [this](const QString &collectionClass) {
|
||||||
m_ui->collectionHeaderEdit->setText(m_fileNamingParameters.headerFileName(collectionClass));
|
m_collectionHeaderEdit->setText(m_fileNamingParameters.headerFileName(collectionClass));
|
||||||
m_ui->pluginNameEdit->setText(createPluginName(collectionClass));
|
m_pluginNameEdit->setText(createPluginName(collectionClass));
|
||||||
});
|
});
|
||||||
connect(m_ui->pluginNameEdit, &QLineEdit::textEdited,
|
connect(m_pluginNameEdit, &QLineEdit::textEdited,
|
||||||
this, &CustomWidgetPluginWizardPage::slotCheckCompleteness);
|
this, &CustomWidgetPluginWizardPage::slotCheckCompleteness);
|
||||||
connect(m_ui->collectionHeaderEdit, &QLineEdit::textChanged,
|
connect(m_collectionHeaderEdit, &QLineEdit::textChanged,
|
||||||
this, [this](const QString &text) {
|
this, [this](const QString &text) {
|
||||||
m_ui->collectionSourceEdit->setText(m_fileNamingParameters.headerToSourceFileName(text));
|
m_collectionSourceEdit->setText(m_fileNamingParameters.headerToSourceFileName(text));
|
||||||
});
|
});
|
||||||
|
|
||||||
setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Plugin Details"));
|
setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Plugin Details"));
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomWidgetPluginWizardPage::~CustomWidgetPluginWizardPage()
|
|
||||||
{
|
|
||||||
delete m_ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CustomWidgetPluginWizardPage::collectionClassName() const
|
QString CustomWidgetPluginWizardPage::collectionClassName() const
|
||||||
{
|
{
|
||||||
return m_ui->collectionClassEdit->text();
|
return m_collectionClassEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CustomWidgetPluginWizardPage::pluginName() const
|
QString CustomWidgetPluginWizardPage::pluginName() const
|
||||||
{
|
{
|
||||||
return m_ui->pluginNameEdit->text();
|
return m_pluginNameEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomWidgetPluginWizardPage::init(const CustomWidgetWidgetsWizardPage *widgetsPage)
|
void CustomWidgetPluginWizardPage::init(const CustomWidgetWidgetsWizardPage *widgetsPage)
|
||||||
@@ -60,37 +78,37 @@ void CustomWidgetPluginWizardPage::init(const CustomWidgetWidgetsWizardPage *wid
|
|||||||
m_classCount = widgetsPage->classCount();
|
m_classCount = widgetsPage->classCount();
|
||||||
const QString empty;
|
const QString empty;
|
||||||
if (m_classCount == 1) {
|
if (m_classCount == 1) {
|
||||||
m_ui->pluginNameEdit->setText(createPluginName(widgetsPage->classNameAt(0)));
|
m_pluginNameEdit->setText(createPluginName(widgetsPage->classNameAt(0)));
|
||||||
setCollectionEnabled(false);
|
setCollectionEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
m_ui->pluginNameEdit->setText(empty);
|
m_pluginNameEdit->setText(empty);
|
||||||
setCollectionEnabled(true);
|
setCollectionEnabled(true);
|
||||||
}
|
}
|
||||||
m_ui->collectionClassEdit->setText(empty);
|
m_collectionClassEdit->setText(empty);
|
||||||
m_ui->collectionHeaderEdit->setText(empty);
|
m_collectionHeaderEdit->setText(empty);
|
||||||
m_ui->collectionSourceEdit->setText(empty);
|
m_collectionSourceEdit->setText(empty);
|
||||||
|
|
||||||
slotCheckCompleteness();
|
slotCheckCompleteness();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomWidgetPluginWizardPage::setCollectionEnabled(bool enColl)
|
void CustomWidgetPluginWizardPage::setCollectionEnabled(bool enColl)
|
||||||
{
|
{
|
||||||
m_ui->collectionClassLabel->setEnabled(enColl);
|
m_collectionClassLabel->setEnabled(enColl);
|
||||||
m_ui->collectionClassEdit->setEnabled(enColl);
|
m_collectionClassEdit->setEnabled(enColl);
|
||||||
m_ui->collectionHeaderLabel->setEnabled(enColl);
|
m_collectionHeaderLabel->setEnabled(enColl);
|
||||||
m_ui->collectionHeaderEdit->setEnabled(enColl);
|
m_collectionHeaderEdit->setEnabled(enColl);
|
||||||
m_ui->collectionSourceLabel->setEnabled(enColl);
|
m_collectionSourceLabel->setEnabled(enColl);
|
||||||
m_ui->collectionSourceEdit->setEnabled(enColl);
|
m_collectionSourceEdit->setEnabled(enColl);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<PluginOptions> CustomWidgetPluginWizardPage::basicPluginOptions() const
|
QSharedPointer<PluginOptions> CustomWidgetPluginWizardPage::basicPluginOptions() const
|
||||||
{
|
{
|
||||||
QSharedPointer<PluginOptions> po(new PluginOptions);
|
QSharedPointer<PluginOptions> po(new PluginOptions);
|
||||||
po->pluginName = pluginName();
|
po->pluginName = pluginName();
|
||||||
po->resourceFile = m_ui->resourceFileEdit->text();
|
po->resourceFile = m_resourceFileEdit->text();
|
||||||
po->collectionClassName = collectionClassName();
|
po->collectionClassName = collectionClassName();
|
||||||
po->collectionHeaderFile = m_ui->collectionHeaderEdit->text();
|
po->collectionHeaderFile = m_collectionHeaderEdit->text();
|
||||||
po->collectionSourceFile = m_ui->collectionSourceEdit->text();
|
po->collectionSourceFile = m_collectionSourceEdit->text();
|
||||||
return po;
|
return po;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,21 +8,23 @@
|
|||||||
#include <QWizardPage>
|
#include <QWizardPage>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QLineEdit;
|
||||||
|
class QLabel;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
struct PluginOptions;
|
struct PluginOptions;
|
||||||
class CustomWidgetWidgetsWizardPage;
|
class CustomWidgetWidgetsWizardPage;
|
||||||
|
|
||||||
namespace Ui { class CustomWidgetPluginWizardPage; }
|
|
||||||
|
|
||||||
class CustomWidgetPluginWizardPage : public QWizardPage
|
class CustomWidgetPluginWizardPage : public QWizardPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CustomWidgetPluginWizardPage(QWidget *parent = nullptr);
|
explicit CustomWidgetPluginWizardPage(QWidget *parent = nullptr);
|
||||||
~CustomWidgetPluginWizardPage() override;
|
|
||||||
|
|
||||||
void init(const CustomWidgetWidgetsWizardPage *widgetsPage);
|
void init(const CustomWidgetWidgetsWizardPage *widgetsPage);
|
||||||
|
|
||||||
@@ -40,10 +42,18 @@ private:
|
|||||||
inline QString pluginName() const;
|
inline QString pluginName() const;
|
||||||
void setCollectionEnabled(bool enColl);
|
void setCollectionEnabled(bool enColl);
|
||||||
|
|
||||||
Ui::CustomWidgetPluginWizardPage *m_ui;
|
|
||||||
FileNamingParameters m_fileNamingParameters;
|
FileNamingParameters m_fileNamingParameters;
|
||||||
int m_classCount;
|
int m_classCount;
|
||||||
bool m_complete;
|
bool m_complete;
|
||||||
|
|
||||||
|
QLabel *m_collectionClassLabel;
|
||||||
|
QLineEdit *m_collectionClassEdit;
|
||||||
|
QLabel *m_collectionHeaderLabel;
|
||||||
|
QLineEdit *m_collectionHeaderEdit;
|
||||||
|
QLabel *m_collectionSourceLabel;
|
||||||
|
QLineEdit *m_collectionSourceEdit;
|
||||||
|
QLineEdit *m_pluginNameEdit;
|
||||||
|
QLineEdit *m_resourceFileEdit;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -1,157 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>QmakeProjectManager::Internal::CustomWidgetPluginWizardPage</class>
|
|
||||||
<widget class="QWizardPage" name="QmakeProjectManager::Internal::CustomWidgetPluginWizardPage">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>591</width>
|
|
||||||
<height>446</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>WizardPage</string>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Plugin and Collection Class Information</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="subTitleLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Specify the properties of the plugin library and the collection class.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="subTitleSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>10</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<layout class="QFormLayout" name="formLayout">
|
|
||||||
<property name="fieldGrowthPolicy">
|
|
||||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="collectionClassLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Collection class:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>collectionClassEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="collectionClassEdit">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="collectionHeaderLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Collection header file:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>collectionHeaderEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="collectionHeaderEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="collectionSourceLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Collection source file:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>collectionSourceEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLineEdit" name="collectionSourceEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="pluginNameLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Plugin name:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>pluginNameEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLineEdit" name="pluginNameEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="resourceFileLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Resource file:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>resourceFileEdit</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QLineEdit" name="resourceFileEdit">
|
|
||||||
<property name="text">
|
|
||||||
<string>icons.qrc</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
@@ -2,33 +2,35 @@
|
|||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "customwidgetwidgetswizardpage.h"
|
#include "customwidgetwidgetswizardpage.h"
|
||||||
#include "ui_customwidgetwidgetswizardpage.h"
|
|
||||||
#include "classdefinition.h"
|
#include "classdefinition.h"
|
||||||
|
#include "classlist.h"
|
||||||
|
|
||||||
|
#include <utils/layoutbuilder.h>
|
||||||
#include <utils/utilsicons.h>
|
#include <utils/utilsicons.h>
|
||||||
#include <utils/wizard.h>
|
#include <utils/wizard.h>
|
||||||
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
#include <QStackedLayout>
|
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QStackedLayout>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QToolButton>
|
||||||
|
|
||||||
namespace QmakeProjectManager {
|
namespace QmakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
CustomWidgetWidgetsWizardPage::CustomWidgetWidgetsWizardPage(QWidget *parent) :
|
CustomWidgetWidgetsWizardPage::CustomWidgetWidgetsWizardPage(QWidget *parent) :
|
||||||
QWizardPage(parent),
|
QWizardPage(parent),
|
||||||
m_ui(new Ui::CustomWidgetWidgetsWizardPage),
|
|
||||||
m_tabStackLayout(new QStackedLayout),
|
m_tabStackLayout(new QStackedLayout),
|
||||||
m_complete(false)
|
m_complete(false)
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
auto classListLabel = new QLabel(tr("Widget &Classes:"));
|
||||||
m_ui->tabStackWidget->setLayout(m_tabStackLayout);
|
auto addButton = new QToolButton;
|
||||||
m_ui->addButton->setIcon(Utils::Icons::PLUS_TOOLBAR.icon());
|
addButton->setIcon(Utils::Icons::PLUS.icon());
|
||||||
connect(m_ui->addButton, &QAbstractButton::clicked, m_ui->classList, &ClassList::startEditingNewClassItem);
|
m_deleteButton = new QToolButton;
|
||||||
m_ui->deleteButton->setIcon(Utils::Icons::MINUS_TOOLBAR.icon());
|
m_deleteButton->setIcon(Utils::Icons::MINUS.icon());
|
||||||
connect(m_ui->deleteButton, &QAbstractButton::clicked, m_ui->classList, &ClassList::removeCurrentClass);
|
m_deleteButton->setEnabled(false);
|
||||||
m_ui->deleteButton->setEnabled(false);
|
m_classList = new ClassList;
|
||||||
|
classListLabel->setBuddy(m_classList);
|
||||||
|
|
||||||
// Disabled dummy for <new class> column>.
|
// Disabled dummy for <new class> column>.
|
||||||
auto *dummy = new ClassDefinition;
|
auto *dummy = new ClassDefinition;
|
||||||
@@ -36,23 +38,33 @@ CustomWidgetWidgetsWizardPage::CustomWidgetWidgetsWizardPage(QWidget *parent) :
|
|||||||
dummy->setEnabled(false);
|
dummy->setEnabled(false);
|
||||||
m_tabStackLayout->addWidget(dummy);
|
m_tabStackLayout->addWidget(dummy);
|
||||||
|
|
||||||
connect(m_ui->classList, &ClassList::currentRowChanged,
|
using namespace Utils::Layouting;
|
||||||
|
Column {
|
||||||
|
tr("Specify the list of custom widgets and their properties."),
|
||||||
|
Space(10),
|
||||||
|
Row {
|
||||||
|
Column {
|
||||||
|
Row { classListLabel, addButton, m_deleteButton },
|
||||||
|
m_classList,
|
||||||
|
},
|
||||||
|
m_tabStackLayout,
|
||||||
|
}
|
||||||
|
}.attachTo(this);
|
||||||
|
|
||||||
|
connect(m_deleteButton, &QAbstractButton::clicked, m_classList, &ClassList::removeCurrentClass);
|
||||||
|
connect(addButton, &QAbstractButton::clicked, m_classList, &ClassList::startEditingNewClassItem);
|
||||||
|
connect(m_classList, &ClassList::currentRowChanged,
|
||||||
this, &CustomWidgetWidgetsWizardPage::slotCurrentRowChanged);
|
this, &CustomWidgetWidgetsWizardPage::slotCurrentRowChanged);
|
||||||
connect(m_ui->classList, &ClassList::classAdded,
|
connect(m_classList, &ClassList::classAdded,
|
||||||
this, &CustomWidgetWidgetsWizardPage::slotClassAdded);
|
this, &CustomWidgetWidgetsWizardPage::slotClassAdded);
|
||||||
connect(m_ui->classList, &ClassList::classDeleted,
|
connect(m_classList, &ClassList::classDeleted,
|
||||||
this, &CustomWidgetWidgetsWizardPage::slotClassDeleted);
|
this, &CustomWidgetWidgetsWizardPage::slotClassDeleted);
|
||||||
connect(m_ui->classList, &ClassList::classRenamed,
|
connect(m_classList, &ClassList::classRenamed,
|
||||||
this, &CustomWidgetWidgetsWizardPage::slotClassRenamed);
|
this, &CustomWidgetWidgetsWizardPage::slotClassRenamed);
|
||||||
|
|
||||||
setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Custom Widgets"));
|
setProperty(Utils::SHORT_TITLE_PROPERTY, tr("Custom Widgets"));
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomWidgetWidgetsWizardPage::~CustomWidgetWidgetsWizardPage()
|
|
||||||
{
|
|
||||||
delete m_ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CustomWidgetWidgetsWizardPage::isComplete() const
|
bool CustomWidgetWidgetsWizardPage::isComplete() const
|
||||||
{
|
{
|
||||||
return m_complete;
|
return m_complete;
|
||||||
@@ -61,13 +73,13 @@ bool CustomWidgetWidgetsWizardPage::isComplete() const
|
|||||||
void CustomWidgetWidgetsWizardPage::initializePage()
|
void CustomWidgetWidgetsWizardPage::initializePage()
|
||||||
{
|
{
|
||||||
// Takes effect only if visible.
|
// Takes effect only if visible.
|
||||||
QTimer::singleShot(0, m_ui->classList, &ClassList::startEditingNewClassItem);
|
QTimer::singleShot(0, m_classList, &ClassList::startEditingNewClassItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomWidgetWidgetsWizardPage::slotCurrentRowChanged(int row)
|
void CustomWidgetWidgetsWizardPage::slotCurrentRowChanged(int row)
|
||||||
{
|
{
|
||||||
const bool onDummyItem = row == m_tabStackLayout->count() - 1;
|
const bool onDummyItem = row == m_tabStackLayout->count() - 1;
|
||||||
m_ui->deleteButton->setEnabled(!onDummyItem);
|
m_deleteButton->setEnabled(!onDummyItem);
|
||||||
m_tabStackLayout->setCurrentIndex(row);
|
m_tabStackLayout->setCurrentIndex(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +112,7 @@ void CustomWidgetWidgetsWizardPage::slotClassRenamed(int index, const QString &n
|
|||||||
|
|
||||||
QString CustomWidgetWidgetsWizardPage::classNameAt(int i) const
|
QString CustomWidgetWidgetsWizardPage::classNameAt(int i) const
|
||||||
{
|
{
|
||||||
return m_ui->classList->className(i);
|
return m_classList->className(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<PluginOptions::WidgetOptions> CustomWidgetWidgetsWizardPage::widgetOptions() const
|
QList<PluginOptions::WidgetOptions> CustomWidgetWidgetsWizardPage::widgetOptions() const
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <QWizardPage>
|
#include <QWizardPage>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QToolButton;
|
||||||
class QStackedLayout;
|
class QStackedLayout;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
@@ -17,6 +18,7 @@ namespace QmakeProjectManager {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ClassDefinition;
|
class ClassDefinition;
|
||||||
|
class ClassList;
|
||||||
struct PluginOptions;
|
struct PluginOptions;
|
||||||
|
|
||||||
namespace Ui { class CustomWidgetWidgetsWizardPage; }
|
namespace Ui { class CustomWidgetWidgetsWizardPage; }
|
||||||
@@ -27,7 +29,6 @@ class CustomWidgetWidgetsWizardPage : public QWizardPage
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CustomWidgetWidgetsWizardPage(QWidget *parent = nullptr);
|
explicit CustomWidgetWidgetsWizardPage(QWidget *parent = nullptr);
|
||||||
~CustomWidgetWidgetsWizardPage() override;
|
|
||||||
|
|
||||||
QList<PluginOptions::WidgetOptions> widgetOptions() const;
|
QList<PluginOptions::WidgetOptions> widgetOptions() const;
|
||||||
|
|
||||||
@@ -51,11 +52,12 @@ private Q_SLOTS:
|
|||||||
private:
|
private:
|
||||||
void updatePluginTab();
|
void updatePluginTab();
|
||||||
|
|
||||||
Ui::CustomWidgetWidgetsWizardPage *m_ui;
|
|
||||||
QList<ClassDefinition *> m_uiClassDefs;
|
QList<ClassDefinition *> m_uiClassDefs;
|
||||||
QStackedLayout *m_tabStackLayout;
|
QStackedLayout *m_tabStackLayout;
|
||||||
FileNamingParameters m_fileNamingParameters;
|
FileNamingParameters m_fileNamingParameters;
|
||||||
bool m_complete;
|
bool m_complete;
|
||||||
|
QToolButton *m_deleteButton;
|
||||||
|
ClassList *m_classList;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,105 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>QmakeProjectManager::Internal::CustomWidgetWidgetsWizardPage</class>
|
|
||||||
<widget class="QWizardPage" name="QmakeProjectManager::Internal::CustomWidgetWidgetsWizardPage">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>668</width>
|
|
||||||
<height>475</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Custom Qt Widget Wizard</string>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Custom Widget List</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="2" column="1" rowspan="2">
|
|
||||||
<widget class="QWidget" name="tabStackWidget" native="true">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>400</width>
|
|
||||||
<height>200</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QmakeProjectManager::Internal::ClassList" name="classList">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>400</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QLabel" name="subTitleLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Specify the list of custom widgets and their properties.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="titleSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>10</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Widget &Classes:</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy">
|
|
||||||
<cstring>classList</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="addButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="deleteButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>QmakeProjectManager::Internal::ClassList</class>
|
|
||||||
<extends>QListWidget</extends>
|
|
||||||
<header location="global">qmakeprojectmanager/customwidgetwizard/classlist.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<tabstops>
|
|
||||||
<tabstop>classList</tabstop>
|
|
||||||
</tabstops>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
||||||
@@ -33,11 +33,13 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace QmakeProjectManager;
|
|
||||||
using namespace QtSupport;
|
using namespace QtSupport;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
namespace {
|
namespace QmakeProjectManager::Internal {
|
||||||
|
|
||||||
|
const Utils::Id QT_IS_TEMPORARY("Qmake.TempQt");
|
||||||
|
const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios"; // ugly
|
||||||
|
|
||||||
struct DirectoryData
|
struct DirectoryData
|
||||||
{
|
{
|
||||||
@@ -52,38 +54,29 @@ struct DirectoryData
|
|||||||
QMakeStepConfig::OsType osType;
|
QMakeStepConfig::OsType osType;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
namespace QmakeProjectManager::Internal {
|
|
||||||
|
|
||||||
const Utils::Id QT_IS_TEMPORARY("Qmake.TempQt");
|
|
||||||
const char IOSQT[] = "Qt4ProjectManager.QtVersion.Ios"; // ugly
|
|
||||||
|
|
||||||
QmakeProjectImporter::QmakeProjectImporter(const FilePath &path) :
|
QmakeProjectImporter::QmakeProjectImporter(const FilePath &path) :
|
||||||
QtProjectImporter(path)
|
QtProjectImporter(path)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
FilePaths QmakeProjectImporter::importCandidates()
|
FilePaths QmakeProjectImporter::importCandidates()
|
||||||
{
|
{
|
||||||
QStringList candidates;
|
FilePaths candidates;
|
||||||
|
|
||||||
QFileInfo pfi = projectFilePath().toFileInfo();
|
const FilePath pfp = projectFilePath();
|
||||||
const QString prefix = pfi.baseName();
|
const QString prefix = pfp.baseName();
|
||||||
candidates << pfi.absolutePath();
|
candidates << pfp.absolutePath();
|
||||||
|
|
||||||
foreach (Kit *k, KitManager::kits()) {
|
for (Kit *k : KitManager::kits()) {
|
||||||
const FilePath sbdir = QmakeBuildConfiguration::shadowBuildDirectory
|
const FilePath sbdir = QmakeBuildConfiguration::shadowBuildDirectory
|
||||||
(projectFilePath(), k, QString(), BuildConfiguration::Unknown);
|
(projectFilePath(), k, QString(), BuildConfiguration::Unknown);
|
||||||
|
|
||||||
const QString baseDir = sbdir.toFileInfo().absolutePath();
|
const FilePath baseDir = sbdir.absolutePath();
|
||||||
|
for (const FilePath &path : baseDir.dirEntries(QDir::Filters())) {
|
||||||
foreach (const QString &dir, QDir(baseDir).entryList()) {
|
if (path.fileName().startsWith(prefix) && !candidates.contains(path))
|
||||||
const QString path = baseDir + QLatin1Char('/') + dir;
|
|
||||||
if (dir.startsWith(prefix) && !candidates.contains(path))
|
|
||||||
candidates << path;
|
candidates << path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Utils::transform(candidates, &FilePath::fromString);
|
return candidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<void *> QmakeProjectImporter::examineDirectory(const FilePath &importPath,
|
QList<void *> QmakeProjectImporter::examineDirectory(const FilePath &importPath,
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ Project {
|
|||||||
name: "Custom Widget Wizard"
|
name: "Custom Widget Wizard"
|
||||||
prefix: "customwidgetwizard/"
|
prefix: "customwidgetwizard/"
|
||||||
files: [
|
files: [
|
||||||
"classdefinition.cpp", "classdefinition.h", "classdefinition.ui",
|
"classdefinition.cpp", "classdefinition.h",
|
||||||
"classlist.cpp", "classlist.h",
|
"classlist.cpp", "classlist.h",
|
||||||
"customwidgetpluginwizardpage.cpp", "customwidgetpluginwizardpage.h", "customwidgetpluginwizardpage.ui",
|
"customwidgetpluginwizardpage.cpp", "customwidgetpluginwizardpage.h",
|
||||||
"customwidgetwidgetswizardpage.cpp", "customwidgetwidgetswizardpage.h", "customwidgetwidgetswizardpage.ui",
|
"customwidgetwidgetswizardpage.cpp", "customwidgetwidgetswizardpage.h",
|
||||||
"customwidgetwizard.cpp", "customwidgetwizard.h",
|
"customwidgetwizard.cpp", "customwidgetwizard.h",
|
||||||
"customwidgetwizarddialog.cpp", "customwidgetwizarddialog.h",
|
"customwidgetwizarddialog.cpp", "customwidgetwizarddialog.h",
|
||||||
"filenamingparameters.h",
|
"filenamingparameters.h",
|
||||||
|
|||||||
@@ -144,7 +144,6 @@ void CurveEditorView::variantPropertiesChanged([[maybe_unused]] const QList<Vari
|
|||||||
for (const auto &property : propertyList) {
|
for (const auto &property : propertyList) {
|
||||||
if ((property.name() == "frame" || property.name() == "value")
|
if ((property.name() == "frame" || property.name() == "value")
|
||||||
&& property.parentModelNode().type() == "QtQuick.Timeline.Keyframe"
|
&& property.parentModelNode().type() == "QtQuick.Timeline.Keyframe"
|
||||||
&& property.parentModelNode().isValid()
|
|
||||||
&& property.parentModelNode().hasParentProperty()) {
|
&& property.parentModelNode().hasParentProperty()) {
|
||||||
const ModelNode framesNode = property.parentModelNode().parentProperty().parentModelNode();
|
const ModelNode framesNode = property.parentModelNode().parentProperty().parentModelNode();
|
||||||
if (QmlTimelineKeyframeGroup::isValidQmlTimelineKeyframeGroup(framesNode))
|
if (QmlTimelineKeyframeGroup::isValidQmlTimelineKeyframeGroup(framesNode))
|
||||||
@@ -166,7 +165,7 @@ void CurveEditorView::bindingPropertiesChanged([[maybe_unused]] const QList<Bind
|
|||||||
void CurveEditorView::propertiesRemoved([[maybe_unused]] const QList<AbstractProperty> &propertyList)
|
void CurveEditorView::propertiesRemoved([[maybe_unused]] const QList<AbstractProperty> &propertyList)
|
||||||
{
|
{
|
||||||
for (const auto &property : propertyList) {
|
for (const auto &property : propertyList) {
|
||||||
if (property.name() == "keyframes" && property.parentModelNode().isValid()) {
|
if (property.name() == "keyframes") {
|
||||||
ModelNode parent = property.parentModelNode();
|
ModelNode parent = property.parentModelNode();
|
||||||
if (dirtyfiesView(parent))
|
if (dirtyfiesView(parent))
|
||||||
updateKeyframes();
|
updateKeyframes();
|
||||||
@@ -260,10 +259,7 @@ ModelNode getTargetNode(PropertyTreeItem *item, const QmlTimeline &timeline)
|
|||||||
QmlTimelineKeyframeGroup timelineKeyframeGroup(QmlTimeline &timeline, PropertyTreeItem *item)
|
QmlTimelineKeyframeGroup timelineKeyframeGroup(QmlTimeline &timeline, PropertyTreeItem *item)
|
||||||
{
|
{
|
||||||
ModelNode node = getTargetNode(item, timeline);
|
ModelNode node = getTargetNode(item, timeline);
|
||||||
if (node.isValid())
|
return timeline.keyframeGroup(node, item->name().toLatin1());
|
||||||
return timeline.keyframeGroup(node, item->name().toLatin1());
|
|
||||||
|
|
||||||
return QmlTimelineKeyframeGroup();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void attachEasingCurve(const QmlTimelineKeyframeGroup &group, double frame, const QEasingCurve &curve)
|
void attachEasingCurve(const QmlTimelineKeyframeGroup &group, double frame, const QEasingCurve &curve)
|
||||||
@@ -277,23 +273,21 @@ void attachEasingCurve(const QmlTimelineKeyframeGroup &group, double frame, cons
|
|||||||
|
|
||||||
void commitAuxiliaryData(ModelNode &node, TreeItem *item)
|
void commitAuxiliaryData(ModelNode &node, TreeItem *item)
|
||||||
{
|
{
|
||||||
if (node.isValid()) {
|
if (item->locked())
|
||||||
if (item->locked())
|
node.setLocked(true);
|
||||||
node.setLocked(true);
|
else
|
||||||
else
|
node.setLocked(false);
|
||||||
node.setLocked(false);
|
|
||||||
|
|
||||||
if (item->pinned())
|
if (item->pinned())
|
||||||
node.setAuxiliaryData(pinnedProperty, true);
|
node.setAuxiliaryData(pinnedProperty, true);
|
||||||
else
|
else
|
||||||
node.removeAuxiliaryData(pinnedProperty);
|
node.removeAuxiliaryData(pinnedProperty);
|
||||||
|
|
||||||
if (auto *pitem = item->asPropertyItem()) {
|
if (auto *pitem = item->asPropertyItem()) {
|
||||||
if (pitem->hasUnified())
|
if (pitem->hasUnified())
|
||||||
node.setAuxiliaryData(unifiedProperty, pitem->unifyString());
|
node.setAuxiliaryData(unifiedProperty, pitem->unifyString());
|
||||||
else
|
else
|
||||||
node.removeAuxiliaryData(unifiedProperty);
|
node.removeAuxiliaryData(unifiedProperty);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,13 +21,12 @@ PathToolView::PathToolView(PathTool *pathTool)
|
|||||||
|
|
||||||
static bool isInEditedPath(const NodeAbstractProperty &propertyParent, const ModelNode &editingPathViewModelNode)
|
static bool isInEditedPath(const NodeAbstractProperty &propertyParent, const ModelNode &editingPathViewModelNode)
|
||||||
{
|
{
|
||||||
if (editingPathViewModelNode.isValid()) {
|
if (editingPathViewModelNode.hasNodeProperty("path")) {
|
||||||
if (editingPathViewModelNode.hasNodeProperty("path")) {
|
ModelNode pathModelNode = editingPathViewModelNode.nodeProperty("path").modelNode();
|
||||||
ModelNode pathModelNode = editingPathViewModelNode.nodeProperty("path").modelNode();
|
if (pathModelNode.metaInfo().isQtQuickPath()) {
|
||||||
if (pathModelNode.metaInfo().isQtQuickPath()) {
|
if (propertyParent.name() == "pathElements"
|
||||||
if (propertyParent.name() == "pathElements" && propertyParent.parentModelNode() == pathModelNode)
|
&& propertyParent.parentModelNode() == pathModelNode)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ int GradientModel::rowCount(const QModelIndex & /*parent*/) const
|
|||||||
QmlDesigner::ModelNode gradientNode =
|
QmlDesigner::ModelNode gradientNode =
|
||||||
m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode();
|
m_itemNode.modelNode().nodeProperty(gradientPropertyName().toUtf8()).modelNode();
|
||||||
|
|
||||||
if (gradientNode.isValid() && gradientNode.hasNodeListProperty("stops"))
|
if (gradientNode.hasNodeListProperty("stops"))
|
||||||
return gradientNode.nodeListProperty("stops").toModelNodeList().count();
|
return gradientNode.nodeListProperty("stops").toModelNodeList().count();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -808,7 +808,7 @@ NodeMetaInfo PropertyEditorQmlBackend::findCommonAncestor(const ModelNode &node)
|
|||||||
if (!node.isValid())
|
if (!node.isValid())
|
||||||
return node.metaInfo();
|
return node.metaInfo();
|
||||||
|
|
||||||
if (auto metaInfo = node.metaInfo(); metaInfo.isValid())
|
if (auto metaInfo = node.metaInfo())
|
||||||
return metaInfo;
|
return metaInfo;
|
||||||
|
|
||||||
AbstractView *view = node.view();
|
AbstractView *view = node.view();
|
||||||
|
|||||||
@@ -38,13 +38,10 @@ PropertyEditorValue::PropertyEditorValue(QObject *parent)
|
|||||||
QVariant PropertyEditorValue::value() const
|
QVariant PropertyEditorValue::value() const
|
||||||
{
|
{
|
||||||
QVariant returnValue = m_value;
|
QVariant returnValue = m_value;
|
||||||
if (modelNode().isValid()) {
|
if (auto metaInfo = modelNode().metaInfo(); metaInfo.property(name()).propertyType().isUrl()) {
|
||||||
if (auto metaInfo = modelNode().metaInfo();
|
returnValue = returnValue.toUrl().toString();
|
||||||
metaInfo.isValid() && metaInfo.hasProperty(name())
|
|
||||||
&& metaInfo.property(name()).propertyType().isUrl()) {
|
|
||||||
returnValue = returnValue.toUrl().toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,30 +79,24 @@ static void fixAmbigousColorNames(const QmlDesigner::ModelNode &modelNode,
|
|||||||
const QmlDesigner::PropertyName &name,
|
const QmlDesigner::PropertyName &name,
|
||||||
QVariant *value)
|
QVariant *value)
|
||||||
{
|
{
|
||||||
if (modelNode.isValid()) {
|
if (auto metaInfo = modelNode.metaInfo(); metaInfo.property(name).propertyType().isColor()) {
|
||||||
if (auto metaInfo = modelNode.metaInfo();
|
if ((value->type() == QVariant::Color)) {
|
||||||
metaInfo.isValid() && metaInfo.property(name).propertyType().isColor()) {
|
QColor color = value->value<QColor>();
|
||||||
if ((value->type() == QVariant::Color)) {
|
int alpha = color.alpha();
|
||||||
QColor color = value->value<QColor>();
|
color = QColor(color.name());
|
||||||
int alpha = color.alpha();
|
color.setAlpha(alpha);
|
||||||
color = QColor(color.name());
|
*value = color;
|
||||||
color.setAlpha(alpha);
|
} else if (value->toString() != QStringLiteral("transparent")) {
|
||||||
*value = color;
|
*value = QColor(value->toString()).name(QColor::HexArgb);
|
||||||
} else if (value->toString() != QStringLiteral("transparent")) {
|
|
||||||
*value = QColor(value->toString()).name(QColor::HexArgb);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fixUrl(const QmlDesigner::ModelNode &modelNode, const QmlDesigner::PropertyName &name, QVariant *value)
|
static void fixUrl(const QmlDesigner::ModelNode &modelNode, const QmlDesigner::PropertyName &name, QVariant *value)
|
||||||
{
|
{
|
||||||
if (modelNode.isValid()) {
|
if (auto metaInfo = modelNode.metaInfo(); metaInfo.property(name).propertyType().isUrl()) {
|
||||||
if (auto metaInfo = modelNode.metaInfo();
|
if (!value->isValid())
|
||||||
metaInfo.isValid() && metaInfo.property(name).propertyType().isUrl())
|
*value = QStringLiteral("");
|
||||||
|
|
||||||
if (!value->isValid())
|
|
||||||
*value = QStringLiteral("");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,12 +115,8 @@ void PropertyEditorValue::setValueWithEmit(const QVariant &value)
|
|||||||
{
|
{
|
||||||
if (!compareVariants(value, m_value ) || isBound()) {
|
if (!compareVariants(value, m_value ) || isBound()) {
|
||||||
QVariant newValue = value;
|
QVariant newValue = value;
|
||||||
if (modelNode().isValid()) {
|
if (auto metaInfo = modelNode().metaInfo(); metaInfo.property(name()).propertyType().isUrl()) {
|
||||||
if (auto metaInfo = modelNode().metaInfo();
|
newValue = QUrl(newValue.toString());
|
||||||
metaInfo.isValid() && metaInfo.hasProperty(name())
|
|
||||||
&& metaInfo.property(name()).propertyType().isUrl()) {
|
|
||||||
newValue = QUrl(newValue.toString());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cleverDoubleCompare(newValue, m_value))
|
if (cleverDoubleCompare(newValue, m_value))
|
||||||
@@ -212,7 +199,7 @@ bool PropertyEditorValue::isBound() const
|
|||||||
|
|
||||||
bool PropertyEditorValue::isInModel() const
|
bool PropertyEditorValue::isInModel() const
|
||||||
{
|
{
|
||||||
return modelNode().isValid() && modelNode().hasProperty(name());
|
return modelNode().hasProperty(name());
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlDesigner::PropertyName PropertyEditorValue::name() const
|
QmlDesigner::PropertyName PropertyEditorValue::name() const
|
||||||
@@ -248,7 +235,7 @@ bool PropertyEditorValue::isTranslated() const
|
|||||||
metaInfo.isValid() && metaInfo.hasProperty(name())
|
metaInfo.isValid() && metaInfo.hasProperty(name())
|
||||||
&& metaInfo.property(name()).propertyType().isString()) {
|
&& metaInfo.property(name()).propertyType().isString()) {
|
||||||
const QmlDesigner::QmlObjectNode objectNode(modelNode());
|
const QmlDesigner::QmlObjectNode objectNode(modelNode());
|
||||||
if (objectNode.isValid() && objectNode.hasBindingProperty(name())) {
|
if (objectNode.hasBindingProperty(name())) {
|
||||||
const QRegularExpression rx(
|
const QRegularExpression rx(
|
||||||
QRegularExpression::anchoredPattern("qsTr(|Id|anslate)\\(\".*\"\\)"));
|
QRegularExpression::anchoredPattern("qsTr(|Id|anslate)\\(\".*\"\\)"));
|
||||||
//qsTr()
|
//qsTr()
|
||||||
@@ -422,7 +409,7 @@ QString PropertyEditorValue::getTranslationContext() const
|
|||||||
metaInfo.isValid() && metaInfo.hasProperty(name())
|
metaInfo.isValid() && metaInfo.hasProperty(name())
|
||||||
&& metaInfo.property(name()).propertyType().isString()) {
|
&& metaInfo.property(name()).propertyType().isString()) {
|
||||||
const QmlDesigner::QmlObjectNode objectNode(modelNode());
|
const QmlDesigner::QmlObjectNode objectNode(modelNode());
|
||||||
if (objectNode.isValid() && objectNode.hasBindingProperty(name())) {
|
if (objectNode.hasBindingProperty(name())) {
|
||||||
const QRegularExpression rx(QRegularExpression::anchoredPattern(
|
const QRegularExpression rx(QRegularExpression::anchoredPattern(
|
||||||
"qsTranslate\\(\"(.*)\"\\s*,\\s*\".*\"\\s*\\)"));
|
"qsTranslate\\(\"(.*)\"\\s*,\\s*\".*\"\\s*\\)"));
|
||||||
const QRegularExpressionMatch match = rx.match(expression());
|
const QRegularExpressionMatch match = rx.match(expression());
|
||||||
@@ -438,7 +425,7 @@ bool PropertyEditorValue::isIdList() const
|
|||||||
{
|
{
|
||||||
if (modelNode().isValid() && modelNode().metaInfo().isValid() && modelNode().metaInfo().hasProperty(name())) {
|
if (modelNode().isValid() && modelNode().metaInfo().isValid() && modelNode().metaInfo().hasProperty(name())) {
|
||||||
const QmlDesigner::QmlObjectNode objectNode(modelNode());
|
const QmlDesigner::QmlObjectNode objectNode(modelNode());
|
||||||
if (objectNode.isValid() && objectNode.hasBindingProperty(name())) {
|
if (objectNode.hasBindingProperty(name())) {
|
||||||
static const QRegularExpression rx(QRegularExpression::anchoredPattern(
|
static const QRegularExpression rx(QRegularExpression::anchoredPattern(
|
||||||
"^[a-z_]\\w*|^[A-Z]\\w*\\.{1}([a-z_]\\w*\\.?)+"));
|
"^[a-z_]\\w*|^[A-Z]\\w*\\.{1}([a-z_]\\w*\\.?)+"));
|
||||||
const QString exp = objectNode.propertyAffectedByCurrentState(name()) ? expression() : modelNode().bindingProperty(name()).expression();
|
const QString exp = objectNode.propertyAffectedByCurrentState(name()) ? expression() : modelNode().bindingProperty(name()).expression();
|
||||||
@@ -586,11 +573,7 @@ bool PropertyEditorNodeWrapper::exists()
|
|||||||
|
|
||||||
QString PropertyEditorNodeWrapper::type()
|
QString PropertyEditorNodeWrapper::type()
|
||||||
{
|
{
|
||||||
if (!(m_modelNode.isValid()))
|
|
||||||
return QString();
|
|
||||||
|
|
||||||
return m_modelNode.simplifiedTypeName();
|
return m_modelNode.simplifiedTypeName();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlDesigner::ModelNode PropertyEditorNodeWrapper::parentModelNode() const
|
QmlDesigner::ModelNode PropertyEditorNodeWrapper::parentModelNode() const
|
||||||
@@ -635,8 +618,7 @@ void PropertyEditorNodeWrapper::add(const QString &type)
|
|||||||
void PropertyEditorNodeWrapper::remove()
|
void PropertyEditorNodeWrapper::remove()
|
||||||
{
|
{
|
||||||
if ((m_editorValue && m_editorValue->modelNode().isValid())) {
|
if ((m_editorValue && m_editorValue->modelNode().isValid())) {
|
||||||
if (QmlDesigner::QmlObjectNode(m_modelNode).isValid())
|
QmlDesigner::QmlObjectNode(m_modelNode).destroy();
|
||||||
QmlDesigner::QmlObjectNode(m_modelNode).destroy();
|
|
||||||
m_editorValue->modelNode().removeProperty(m_editorValue->name());
|
m_editorValue->modelNode().removeProperty(m_editorValue->name());
|
||||||
} else {
|
} else {
|
||||||
qWarning("PropertyEditorNodeWrapper::remove failed - node invalid");
|
qWarning("PropertyEditorNodeWrapper::remove failed - node invalid");
|
||||||
@@ -675,13 +657,12 @@ void PropertyEditorNodeWrapper::setup()
|
|||||||
Q_ASSERT(m_editorValue);
|
Q_ASSERT(m_editorValue);
|
||||||
Q_ASSERT(m_editorValue->modelNode().isValid());
|
Q_ASSERT(m_editorValue->modelNode().isValid());
|
||||||
if ((m_editorValue->modelNode().isValid() && m_modelNode.isValid())) {
|
if ((m_editorValue->modelNode().isValid() && m_modelNode.isValid())) {
|
||||||
QmlDesigner::QmlObjectNode qmlObjectNode(m_modelNode);
|
|
||||||
const QStringList propertyNames = m_valuesPropertyMap.keys();
|
const QStringList propertyNames = m_valuesPropertyMap.keys();
|
||||||
for (const QString &propertyName : propertyNames)
|
for (const QString &propertyName : propertyNames)
|
||||||
m_valuesPropertyMap.clear(propertyName);
|
m_valuesPropertyMap.clear(propertyName);
|
||||||
qDeleteAll(m_valuesPropertyMap.children());
|
qDeleteAll(m_valuesPropertyMap.children());
|
||||||
|
|
||||||
if (qmlObjectNode.isValid()) {
|
if (QmlDesigner::QmlObjectNode qmlObjectNode = m_modelNode) {
|
||||||
for (const auto &property : m_modelNode.metaInfo().properties()) {
|
for (const auto &property : m_modelNode.metaInfo().properties()) {
|
||||||
const auto &propertyName = property.name();
|
const auto &propertyName = property.name();
|
||||||
auto valueObject = new PropertyEditorValue(&m_valuesPropertyMap);
|
auto valueObject = new PropertyEditorValue(&m_valuesPropertyMap);
|
||||||
|
|||||||
@@ -161,8 +161,8 @@ void PropertyEditorView::changeValue(const QString &name)
|
|||||||
|
|
||||||
QVariant castedValue;
|
QVariant castedValue;
|
||||||
|
|
||||||
if (metaInfo.isValid() && metaInfo.hasProperty(propertyName)) {
|
if (auto property = metaInfo.property(propertyName)) {
|
||||||
castedValue = metaInfo.property(propertyName).castedValue(value->value());
|
castedValue = property.castedValue(value->value());
|
||||||
} else if (propertyIsAttachedLayoutProperty(propertyName)) {
|
} else if (propertyIsAttachedLayoutProperty(propertyName)) {
|
||||||
castedValue = value->value();
|
castedValue = value->value();
|
||||||
} else {
|
} else {
|
||||||
@@ -177,8 +177,7 @@ void PropertyEditorView::changeValue(const QString &name)
|
|||||||
|
|
||||||
bool propertyTypeUrl = false;
|
bool propertyTypeUrl = false;
|
||||||
|
|
||||||
if (metaInfo.isValid() && metaInfo.hasProperty(propertyName)
|
if (metaInfo.property(propertyName).propertyType().isUrl()) {
|
||||||
&& metaInfo.property(propertyName).propertyType().isUrl()) {
|
|
||||||
// turn absolute local file paths into relative paths
|
// turn absolute local file paths into relative paths
|
||||||
propertyTypeUrl = true;
|
propertyTypeUrl = true;
|
||||||
QString filePath = castedValue.toUrl().toString();
|
QString filePath = castedValue.toUrl().toString();
|
||||||
@@ -247,9 +246,8 @@ void PropertyEditorView::changeExpression(const QString &propertyName)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto metaInfo = qmlObjectNode->modelNode().metaInfo();
|
if (auto property = qmlObjectNode->modelNode().metaInfo().property(name)) {
|
||||||
metaInfo.isValid() && metaInfo.hasProperty(name)) {
|
const auto &propertType = property.propertyType();
|
||||||
const auto &propertType = metaInfo.property(name).propertyType();
|
|
||||||
if (propertType.isColor()) {
|
if (propertType.isColor()) {
|
||||||
if (QColor(value->expression().remove('"')).isValid()) {
|
if (QColor(value->expression().remove('"')).isValid()) {
|
||||||
qmlObjectNode->setVariantProperty(name, QColor(value->expression().remove('"')));
|
qmlObjectNode->setVariantProperty(name, QColor(value->expression().remove('"')));
|
||||||
@@ -642,7 +640,7 @@ void PropertyEditorView::propertiesRemoved(const QList<AbstractProperty>& proper
|
|||||||
|
|
||||||
if ("width" == property.name() || "height" == property.name()) {
|
if ("width" == property.name() || "height" == property.name()) {
|
||||||
const QmlItemNode qmlItemNode = m_selectedNode;
|
const QmlItemNode qmlItemNode = m_selectedNode;
|
||||||
if (qmlItemNode.isValid() && qmlItemNode.isInLayout())
|
if (qmlItemNode.isInLayout())
|
||||||
resetPuppet();
|
resetPuppet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,20 +100,13 @@ QVariant StatesEditorModel::data(const QModelIndex &index, int role) const
|
|||||||
return index.internalId();
|
return index.internalId();
|
||||||
|
|
||||||
case HasWhenCondition:
|
case HasWhenCondition:
|
||||||
return stateNode.isValid() && stateNode.hasProperty("when");
|
return stateNode.hasProperty("when");
|
||||||
|
|
||||||
case WhenConditionString: {
|
case WhenConditionString:
|
||||||
if (stateNode.isValid() && stateNode.hasBindingProperty("when"))
|
return stateNode.bindingProperty("when").expression();
|
||||||
return stateNode.bindingProperty("when").expression();
|
|
||||||
else
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
case IsDefault: {
|
case IsDefault: {
|
||||||
QmlModelState modelState(stateNode);
|
return QmlModelState(stateNode).isDefault();
|
||||||
if (modelState.isValid())
|
|
||||||
return modelState.isDefault();
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case ModelHasDefaultState:
|
case ModelHasDefaultState:
|
||||||
|
|||||||
@@ -346,9 +346,7 @@ void StatesEditorView::resetWhenCondition(int internalNodeId)
|
|||||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||||
try {
|
try {
|
||||||
if (state.isValid() && state.modelNode().hasProperty("when"))
|
state.modelNode().removeProperty("when");
|
||||||
state.modelNode().removeProperty("when");
|
|
||||||
|
|
||||||
} catch (const RewritingException &e) {
|
} catch (const RewritingException &e) {
|
||||||
e.showException();
|
e.showException();
|
||||||
}
|
}
|
||||||
@@ -409,9 +407,7 @@ void StatesEditorView::setAnnotation(int internalNodeId)
|
|||||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||||
try {
|
try {
|
||||||
if (state.isValid()) {
|
if (state.isValid()) {
|
||||||
ModelNode modelNode = state.modelNode();
|
if (ModelNode modelNode = state.modelNode()) {
|
||||||
|
|
||||||
if (modelNode.isValid()) {
|
|
||||||
if (!m_editor)
|
if (!m_editor)
|
||||||
m_editor = new AnnotationEditor(this);
|
m_editor = new AnnotationEditor(this);
|
||||||
|
|
||||||
|
|||||||
@@ -142,15 +142,12 @@ void TimelineActions::copyKeyframes(const QList<ModelNode> &keyframes)
|
|||||||
|
|
||||||
bool isKeyframe(const ModelNode &node)
|
bool isKeyframe(const ModelNode &node)
|
||||||
{
|
{
|
||||||
return node.isValid() && node.metaInfo().isQtQuickTimelineKeyframe();
|
return node.metaInfo().isQtQuickTimelineKeyframe();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant getValue(const ModelNode &node)
|
QVariant getValue(const ModelNode &node)
|
||||||
{
|
{
|
||||||
if (node.isValid())
|
return node.variantProperty("value").value();
|
||||||
return node.variantProperty("value").value();
|
|
||||||
|
|
||||||
return QVariant();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal getTime(const ModelNode &node)
|
qreal getTime(const ModelNode &node)
|
||||||
|
|||||||
@@ -769,7 +769,7 @@ void TimelineGraphicsScene::deleteKeyframes(const QList<ModelNode> &frames)
|
|||||||
ModelNode frame = keyframe;
|
ModelNode frame = keyframe;
|
||||||
ModelNode parent = frame.parentProperty().parentModelNode();
|
ModelNode parent = frame.parentProperty().parentModelNode();
|
||||||
keyframe.destroy();
|
keyframe.destroy();
|
||||||
if (parent.isValid() && parent.defaultNodeListProperty().isEmpty())
|
if (parent.defaultNodeListProperty().isEmpty())
|
||||||
parent.destroy();
|
parent.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,10 +257,7 @@ void TimelinePropertyItem::updateFrames()
|
|||||||
|
|
||||||
bool TimelinePropertyItem::isSelected() const
|
bool TimelinePropertyItem::isSelected() const
|
||||||
{
|
{
|
||||||
if (m_frames.isValid() && m_frames.target().isValid())
|
return m_frames.target().isSelected();
|
||||||
return m_frames.target().isSelected();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString convertVariant(const QVariant &variant)
|
QString convertVariant(const QVariant &variant)
|
||||||
@@ -564,7 +561,7 @@ void TimelineKeyframeItem::enableUpdates()
|
|||||||
|
|
||||||
bool TimelineKeyframeItem::hasManualBezier() const
|
bool TimelineKeyframeItem::hasManualBezier() const
|
||||||
{
|
{
|
||||||
return m_frame.isValid() && m_frame.hasProperty("easing.bezierCurve");
|
return m_frame.hasProperty("easing.bezierCurve");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimelineKeyframeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
|
void TimelineKeyframeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ AbstractView *TimelineSectionItem::view() const
|
|||||||
|
|
||||||
bool TimelineSectionItem::isSelected() const
|
bool TimelineSectionItem::isSelected() const
|
||||||
{
|
{
|
||||||
return m_targetNode.isValid() && m_targetNode.isSelected();
|
return m_targetNode.isSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelNode TimelineSectionItem::targetNode() const
|
ModelNode TimelineSectionItem::targetNode() const
|
||||||
@@ -967,7 +967,7 @@ void TimelineBarItem::commitPosition(const QPointF & /*point*/)
|
|||||||
|
|
||||||
bool TimelineBarItem::isLocked() const
|
bool TimelineBarItem::isLocked() const
|
||||||
{
|
{
|
||||||
return sectionItem()->targetNode().isValid() && sectionItem()->targetNode().locked();
|
return sectionItem()->targetNode().locked();
|
||||||
}
|
}
|
||||||
|
|
||||||
TimelineBarItem *TimelineBarItem::asTimelineBarItem()
|
TimelineBarItem *TimelineBarItem::asTimelineBarItem()
|
||||||
@@ -994,13 +994,10 @@ void TimelineBarItem::paint(QPainter *painter,
|
|||||||
const QColor indicatorColor = Theme::getColor(Theme::PanelTextColorLight);
|
const QColor indicatorColor = Theme::getColor(Theme::PanelTextColorLight);
|
||||||
|
|
||||||
ModelNode target = sectionItem()->targetNode();
|
ModelNode target = sectionItem()->targetNode();
|
||||||
if (target.isValid()) {
|
QColor overrideColor = target.auxiliaryDataWithDefault(timelineOverrideColorProperty).value<QColor>();
|
||||||
QColor overrideColor = target.auxiliaryDataWithDefault(timelineOverrideColorProperty)
|
if (overrideColor.isValid()) {
|
||||||
.value<QColor>();
|
brushColorSelected = overrideColor;
|
||||||
if (overrideColor.isValid()) {
|
brushColor = brushColorSelected.darker(120);
|
||||||
brushColorSelected = overrideColor;
|
|
||||||
brushColor = brushColorSelected.darker(120);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QRectF itemRect = rect();
|
const QRectF itemRect = rect();
|
||||||
@@ -1079,8 +1076,7 @@ void TimelineBarItem::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
|
|||||||
QAction* resetColor = menu.addAction(tr("Reset Color"));
|
QAction* resetColor = menu.addAction(tr("Reset Color"));
|
||||||
auto reset = [this]() {
|
auto reset = [this]() {
|
||||||
ModelNode target = sectionItem()->targetNode();
|
ModelNode target = sectionItem()->targetNode();
|
||||||
if (target.isValid())
|
target.removeAuxiliaryData(timelineOverrideColorProperty);
|
||||||
target.removeAuxiliaryData(timelineOverrideColorProperty);
|
|
||||||
};
|
};
|
||||||
QObject::connect(resetColor, &QAction::triggered, reset);
|
QObject::connect(resetColor, &QAction::triggered, reset);
|
||||||
|
|
||||||
|
|||||||
@@ -208,9 +208,9 @@ void TimelineSettingsModel::addState(const ModelNode &state)
|
|||||||
QList<QStandardItem *> items;
|
QList<QStandardItem *> items;
|
||||||
|
|
||||||
QmlTimeline timeline = timelineView()->timelineForState(state);
|
QmlTimeline timeline = timelineView()->timelineForState(state);
|
||||||
const QString timelineId = timeline.isValid() ? timeline.modelNode().id() : QString("");
|
const QString timelineId = timeline.modelNode().id();
|
||||||
ModelNode animation = animationForTimelineAndState(timeline, state);
|
ModelNode animation = animationForTimelineAndState(timeline, state);
|
||||||
const QString animationId = animation.isValid() ? animation.id() : QString("");
|
const QString animationId = animation.id();
|
||||||
|
|
||||||
QStandardItem *stateItem = createStateItem(state);
|
QStandardItem *stateItem = createStateItem(state);
|
||||||
auto *timelinelItem = new QStandardItem(timelineId);
|
auto *timelinelItem = new QStandardItem(timelineId);
|
||||||
@@ -318,34 +318,24 @@ void TimelineSettingsModel::updateAnimation(int row)
|
|||||||
ModelNode oldAnimation = animationForTimelineAndState(oldTimeline, modelState);
|
ModelNode oldAnimation = animationForTimelineAndState(oldTimeline, modelState);
|
||||||
|
|
||||||
if (modelState.isBaseState()) {
|
if (modelState.isBaseState()) {
|
||||||
if (oldAnimation.isValid())
|
oldAnimation.variantProperty("running").setValue(false);
|
||||||
oldAnimation.variantProperty("running").setValue(false);
|
animation.variantProperty("running").setValue(true);
|
||||||
if (animation.isValid())
|
timeline.modelNode().removeProperty("currentFrame");
|
||||||
animation.variantProperty("running").setValue(true);
|
|
||||||
if (timeline.isValid() && timeline.modelNode().hasProperty("currentFrame"))
|
|
||||||
timeline.modelNode().removeProperty("currentFrame");
|
|
||||||
} else {
|
} else {
|
||||||
if (oldAnimation.isValid() && modelState.affectsModelNode(oldAnimation)) {
|
if (modelState.affectsModelNode(oldAnimation)) {
|
||||||
QmlPropertyChanges propertyChanges(modelState.propertyChanges(oldAnimation));
|
QmlPropertyChanges propertyChanges(modelState.propertyChanges(oldAnimation));
|
||||||
if (propertyChanges.isValid() && propertyChanges.modelNode().hasProperty("running"))
|
propertyChanges.modelNode().removeProperty("running");
|
||||||
propertyChanges.modelNode().removeProperty("running");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelNode baseAnimation(animationForRow(0));
|
if (ModelNode baseAnimation = animationForRow(0)) {
|
||||||
|
|
||||||
if (baseAnimation.isValid()) {
|
|
||||||
QmlPropertyChanges propertyChanges(modelState.propertyChanges(baseAnimation));
|
QmlPropertyChanges propertyChanges(modelState.propertyChanges(baseAnimation));
|
||||||
if (propertyChanges.isValid()) {
|
propertyChanges.modelNode().variantProperty("running").setValue(false);
|
||||||
propertyChanges.modelNode().variantProperty("running").setValue(false);
|
propertyChanges.modelNode().removeProperty("currentFrame");
|
||||||
if (propertyChanges.modelNode().hasProperty("currentFrame"))
|
|
||||||
propertyChanges.modelNode().removeProperty("currentFrame");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (animation.isValid()) { /* If animation is invalid 'none' was selected */
|
if (animation.isValid()) { /* If animation is invalid 'none' was selected */
|
||||||
QmlPropertyChanges propertyChanges(modelState.propertyChanges(animation));
|
QmlPropertyChanges propertyChanges(modelState.propertyChanges(animation));
|
||||||
if (propertyChanges.isValid())
|
propertyChanges.modelNode().variantProperty("running").setValue(true);
|
||||||
propertyChanges.modelNode().variantProperty("running").setValue(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -363,20 +353,17 @@ void TimelineSettingsModel::updateFixedFrameRow(int row)
|
|||||||
int fixedFrame = fixedFrameForRow(row);
|
int fixedFrame = fixedFrameForRow(row);
|
||||||
|
|
||||||
if (modelState.isBaseState()) {
|
if (modelState.isBaseState()) {
|
||||||
if (animation.isValid())
|
animation.variantProperty("running").setValue(false);
|
||||||
animation.variantProperty("running").setValue(false);
|
timeline.modelNode().variantProperty("currentFrame").setValue(fixedFrame);
|
||||||
if (timeline.isValid())
|
|
||||||
timeline.modelNode().variantProperty("currentFrame").setValue(fixedFrame);
|
|
||||||
} else {
|
} else {
|
||||||
if (animation.isValid() && modelState.affectsModelNode(animation)) {
|
if (modelState.affectsModelNode(animation)) {
|
||||||
QmlPropertyChanges propertyChanges(modelState.propertyChanges(animation));
|
QmlPropertyChanges propertyChanges(modelState.propertyChanges(animation));
|
||||||
if (propertyChanges.isValid() && propertyChanges.modelNode().hasProperty("running"))
|
if (propertyChanges.modelNode().hasProperty("running"))
|
||||||
propertyChanges.modelNode().removeProperty("running");
|
propertyChanges.modelNode().removeProperty("running");
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlPropertyChanges propertyChanges(modelState.propertyChanges(timeline));
|
QmlPropertyChanges propertyChanges(modelState.propertyChanges(timeline));
|
||||||
if (propertyChanges.isValid())
|
propertyChanges.modelNode().variantProperty("currentFrame").setValue(fixedFrame);
|
||||||
propertyChanges.modelNode().variantProperty("currentFrame").setValue(fixedFrame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@@ -394,10 +381,8 @@ void TimelineSettingsModel::resetRow(int row)
|
|||||||
QmlTimeline timeline(timelineForRow(row));
|
QmlTimeline timeline(timelineForRow(row));
|
||||||
ModelNode animation = animationForTimelineAndState(timeline, modelState);
|
ModelNode animation = animationForTimelineAndState(timeline, modelState);
|
||||||
|
|
||||||
if (animationItem) {
|
if (animationItem)
|
||||||
const QString animationId = animation.isValid() ? animation.id() : QString();
|
animationItem->setText(animation.id());
|
||||||
animationItem->setText(animationId);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fixedFrameItem) {
|
if (fixedFrameItem) {
|
||||||
auto fixedValue = propertyValueForState(timeline, modelState, "currentFrame");
|
auto fixedValue = propertyValueForState(timeline, modelState, "currentFrame");
|
||||||
|
|||||||
@@ -98,22 +98,16 @@ void TimelineView::nodeAboutToBeRemoved(const ModelNode &removedNode)
|
|||||||
if (lastId != currentId)
|
if (lastId != currentId)
|
||||||
m_timelineWidget->setTimelineId(currentId);
|
m_timelineWidget->setTimelineId(currentId);
|
||||||
|
|
||||||
} else if (removedNode.parentProperty().isValid()
|
} else if (QmlTimeline::isValidQmlTimeline(removedNode.parentProperty().parentModelNode())) {
|
||||||
&& QmlTimeline::isValidQmlTimeline(
|
if (const ModelNode target = removedNode.bindingProperty("target").resolveToModelNode()) {
|
||||||
removedNode.parentProperty().parentModelNode())) {
|
QmlTimeline timeline(removedNode.parentProperty().parentModelNode());
|
||||||
if (removedNode.hasBindingProperty("target")) {
|
if (timeline.hasKeyframeGroupForTarget(target))
|
||||||
const ModelNode target = removedNode.bindingProperty("target").resolveToModelNode();
|
QTimer::singleShot(0, [this, target, timeline]() {
|
||||||
if (target.isValid()) {
|
if (timeline.hasKeyframeGroupForTarget(target))
|
||||||
QmlTimeline timeline(removedNode.parentProperty().parentModelNode());
|
m_timelineWidget->graphicsScene()->invalidateSectionForTarget(target);
|
||||||
if (timeline.hasKeyframeGroupForTarget(target))
|
else
|
||||||
QTimer::singleShot(0, [this, target, timeline]() {
|
m_timelineWidget->graphicsScene()->invalidateScene();
|
||||||
if (timeline.hasKeyframeGroupForTarget(target))
|
});
|
||||||
m_timelineWidget->graphicsScene()->invalidateSectionForTarget(
|
|
||||||
target);
|
|
||||||
else
|
|
||||||
m_timelineWidget->graphicsScene()->invalidateScene();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,7 +184,6 @@ void TimelineView::variantPropertiesChanged(const QList<VariantProperty> &proper
|
|||||||
for (const auto &property : propertyList) {
|
for (const auto &property : propertyList) {
|
||||||
if ((property.name() == "frame" || property.name() == "value")
|
if ((property.name() == "frame" || property.name() == "value")
|
||||||
&& property.parentModelNode().type() == "QtQuick.Timeline.Keyframe"
|
&& property.parentModelNode().type() == "QtQuick.Timeline.Keyframe"
|
||||||
&& property.parentModelNode().isValid()
|
|
||||||
&& property.parentModelNode().hasParentProperty()) {
|
&& property.parentModelNode().hasParentProperty()) {
|
||||||
const ModelNode framesNode
|
const ModelNode framesNode
|
||||||
= property.parentModelNode().parentProperty().parentModelNode();
|
= property.parentModelNode().parentProperty().parentModelNode();
|
||||||
|
|||||||
@@ -94,10 +94,8 @@ void TransitionEditorGraphicsLayout::setTransition(const ModelNode &transition)
|
|||||||
m_rulerItem->setParentItem(this);
|
m_rulerItem->setParentItem(this);
|
||||||
|
|
||||||
qreal duration = 2000;
|
qreal duration = 2000;
|
||||||
if (transition.isValid()) {
|
if (auto data = transition.auxiliaryData(transitionDurationProperty))
|
||||||
if (auto data = transition.auxiliaryData(transitionDurationProperty))
|
duration = data->toDouble();
|
||||||
duration = data->toDouble();
|
|
||||||
}
|
|
||||||
|
|
||||||
setDuration(duration);
|
setDuration(duration);
|
||||||
m_layout->addItem(m_rulerItem);
|
m_layout->addItem(m_rulerItem);
|
||||||
@@ -107,11 +105,9 @@ void TransitionEditorGraphicsLayout::setTransition(const ModelNode &transition)
|
|||||||
|
|
||||||
m_layout->invalidate();
|
m_layout->invalidate();
|
||||||
|
|
||||||
if (transition.isValid() && !transition.directSubModelNodes().isEmpty()) {
|
for (const ModelNode ¶llel : transition.directSubModelNodes()) {
|
||||||
for (const ModelNode ¶llel : transition.directSubModelNodes()) {
|
auto item = TransitionEditorSectionItem::create(parallel, this);
|
||||||
auto item = TransitionEditorSectionItem::create(parallel, this);
|
m_layout->addItem(item);
|
||||||
m_layout->addItem(item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_placeholder2->setParentItem(this);
|
m_placeholder2->setParentItem(this);
|
||||||
|
|||||||
@@ -126,8 +126,7 @@ void TransitionEditorGraphicsScene::invalidateLayout()
|
|||||||
|
|
||||||
void TransitionEditorGraphicsScene::setDuration(int duration)
|
void TransitionEditorGraphicsScene::setDuration(int duration)
|
||||||
{
|
{
|
||||||
if (m_transition.isValid())
|
m_transition.setAuxiliaryData(transitionDurationProperty, duration);
|
||||||
m_transition.setAuxiliaryData(transitionDurationProperty, duration);
|
|
||||||
m_layout->setDuration(duration);
|
m_layout->setDuration(duration);
|
||||||
qreal scaling = m_layout->rulerScaling();
|
qreal scaling = m_layout->rulerScaling();
|
||||||
setZoom(scaling);
|
setZoom(scaling);
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ AbstractView *TransitionEditorSectionItem::view() const
|
|||||||
|
|
||||||
bool TransitionEditorSectionItem::isSelected() const
|
bool TransitionEditorSectionItem::isSelected() const
|
||||||
{
|
{
|
||||||
return m_targetNode.isValid() && m_targetNode.isSelected();
|
return m_targetNode.isSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelNode TransitionEditorSectionItem::targetNode() const
|
ModelNode TransitionEditorSectionItem::targetNode() const
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ TransitionEditorSettingsDialog::TransitionEditorSettingsDialog(QWidget *parent,
|
|||||||
});
|
});
|
||||||
|
|
||||||
connect(transitionRemoveAction, &QAction::triggered, this, [this]() {
|
connect(transitionRemoveAction, &QAction::triggered, this, [this]() {
|
||||||
ModelNode transition = getTransitionFromTabWidget(ui->timelineTab);
|
if (ModelNode transition = getTransitionFromTabWidget(ui->timelineTab)) {
|
||||||
if (transition.isValid()) {
|
|
||||||
transition.destroy();
|
transition.destroy();
|
||||||
setupTransitions({});
|
setupTransitions({});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,11 +105,9 @@ QString TransitionEditorToolBar::currentTransitionId() const
|
|||||||
|
|
||||||
void TransitionEditorToolBar::updateComboBox(const ModelNode &root)
|
void TransitionEditorToolBar::updateComboBox(const ModelNode &root)
|
||||||
{
|
{
|
||||||
if (root.isValid() && root.hasProperty("transitions")) {
|
if (NodeAbstractProperty transitions = root.nodeAbstractProperty("transitions")) {
|
||||||
NodeAbstractProperty transitions = root.nodeAbstractProperty("transitions");
|
for (const ModelNode &transition : transitions.directSubNodes())
|
||||||
if (transitions.isValid())
|
m_transitionComboBox->addItem(transition.id());
|
||||||
for (const ModelNode &transition : transitions.directSubNodes())
|
|
||||||
m_transitionComboBox->addItem(transition.id());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ void TransitionEditorView::nodeRemoved(const ModelNode & removedNode,
|
|||||||
widget()->updateData(removedNode);
|
widget()->updateData(removedNode);
|
||||||
|
|
||||||
const ModelNode parent = parentProperty.parentModelNode();
|
const ModelNode parent = parentProperty.parentModelNode();
|
||||||
if (parent.isValid() && parent.metaInfo().isQtQuickTransition())
|
if (parent.metaInfo().isQtQuickTransition())
|
||||||
asyncUpdate(parent);
|
asyncUpdate(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ void TransitionEditorView::nodeReparented(const ModelNode &node,
|
|||||||
|
|
||||||
const ModelNode parent = newPropertyParent.parentModelNode();
|
const ModelNode parent = newPropertyParent.parentModelNode();
|
||||||
|
|
||||||
if (parent.isValid() && parent.metaInfo().isValid() && parent.metaInfo().isQtQuickTransition()) {
|
if (parent.metaInfo().isQtQuickTransition()) {
|
||||||
asyncUpdate(parent);
|
asyncUpdate(parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,10 +198,10 @@ ModelNode TransitionEditorView::addNewTransition()
|
|||||||
for (const QmlPropertyChanges & change : state.propertyChanges()) {
|
for (const QmlPropertyChanges & change : state.propertyChanges()) {
|
||||||
QStringList locList;
|
QStringList locList;
|
||||||
const ModelNode target = change.target();
|
const ModelNode target = change.target();
|
||||||
if (target.isValid() && target.hasMetaInfo()) {
|
if (auto targetMetaInfo = target.metaInfo()) {
|
||||||
const QString targetId = target.id();
|
const QString targetId = target.id();
|
||||||
for (const VariantProperty &property : change.modelNode().variantProperties()) {
|
for (const VariantProperty &property : change.modelNode().variantProperties()) {
|
||||||
auto type = target.metaInfo().property(property.name()).propertyType();
|
auto type = targetMetaInfo.property(property.name()).propertyType();
|
||||||
|
|
||||||
if (type.isInteger() || type.isColor() || type.isFloat())
|
if (type.isInteger() || type.isColor() || type.isFloat())
|
||||||
locList.append(QString::fromUtf8(property.name()));
|
locList.append(QString::fromUtf8(property.name()));
|
||||||
@@ -336,12 +336,7 @@ void TransitionEditorView::openSettingsDialog()
|
|||||||
|
|
||||||
QList<ModelNode> TransitionEditorView::allTransitions() const
|
QList<ModelNode> TransitionEditorView::allTransitions() const
|
||||||
{
|
{
|
||||||
if (rootModelNode().isValid() && rootModelNode().hasProperty("transitions")) {
|
return rootModelNode().nodeAbstractProperty("transitions").directSubNodes();
|
||||||
NodeAbstractProperty transitions = rootModelNode().nodeAbstractProperty("transitions");
|
|
||||||
if (transitions.isValid())
|
|
||||||
return transitions.directSubNodes();
|
|
||||||
}
|
|
||||||
return {};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransitionEditorView::asyncUpdate(const ModelNode &transition)
|
void TransitionEditorView::asyncUpdate(const ModelNode &transition)
|
||||||
|
|||||||
@@ -323,13 +323,10 @@ void TransitionEditorWidget::init(int zoom)
|
|||||||
ModelNode root = transitionEditorView()->rootModelNode();
|
ModelNode root = transitionEditorView()->rootModelNode();
|
||||||
ModelNode transition;
|
ModelNode transition;
|
||||||
|
|
||||||
if (root.isValid() && root.hasProperty("transitions")) {
|
if (NodeAbstractProperty transitions = root.nodeAbstractProperty("transitions")) {
|
||||||
NodeAbstractProperty transitions = root.nodeAbstractProperty("transitions");
|
const QList<ModelNode> directSubNodes = transitions.directSubNodes();
|
||||||
if (transitions.isValid()) {
|
if (!directSubNodes.isEmpty())
|
||||||
const QList<ModelNode> directSubNodes = transitions.directSubNodes();
|
transition = directSubNodes.constFirst();
|
||||||
if (!directSubNodes.isEmpty())
|
|
||||||
transition = directSubNodes.constFirst();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_graphicsScene->setTransition(transition);
|
m_graphicsScene->setTransition(transition);
|
||||||
@@ -342,10 +339,9 @@ void TransitionEditorWidget::init(int zoom)
|
|||||||
m_toolbar->setCurrentTransition(transition);
|
m_toolbar->setCurrentTransition(transition);
|
||||||
|
|
||||||
qreal duration = 2000;
|
qreal duration = 2000;
|
||||||
if (transition.isValid()) {
|
if (auto data = transition.auxiliaryData(transitionDurationProperty))
|
||||||
if (auto data = transition.auxiliaryData(transitionDurationProperty))
|
duration = data->toDouble();
|
||||||
duration = data->toDouble();
|
|
||||||
}
|
|
||||||
m_toolbar->setDuration(duration);
|
m_toolbar->setDuration(duration);
|
||||||
|
|
||||||
m_graphicsScene->setZoom(zoom);
|
m_graphicsScene->setZoom(zoom);
|
||||||
@@ -358,8 +354,7 @@ void TransitionEditorWidget::updateData(const ModelNode &transition)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transition.metaInfo().isValid()
|
if (transition.metaInfo().isQtQuickTransition()) {
|
||||||
&& transition.metaInfo().isQtQuickTransition()) {
|
|
||||||
if (transition.id() == m_toolbar->currentTransitionId()) {
|
if (transition.id() == m_toolbar->currentTransitionId()) {
|
||||||
m_graphicsScene->setTransition(transition);
|
m_graphicsScene->setTransition(transition);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -159,29 +159,27 @@ void TransitionForm::setupStatesLists()
|
|||||||
toList = m_transition.variantProperty("to").value().toString().split(",");
|
toList = m_transition.variantProperty("to").value().toString().split(",");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_transition.isValid()) {
|
if (const QmlItemNode root = m_transition.view()->rootModelNode()) {
|
||||||
const QmlItemNode root(m_transition.view()->rootModelNode());
|
const QmlModelStateGroup states = root.states();
|
||||||
if (root.isValid()) {
|
for (const QString &stateName : states.names()) {
|
||||||
const QmlModelStateGroup states = root.states();
|
auto itemTo = new QListWidgetItem(stateName, ui->listWidgetTo);
|
||||||
for (const QString &stateName : states.names()) {
|
ui->listWidgetTo->addItem(itemTo);
|
||||||
auto itemTo = new QListWidgetItem(stateName, ui->listWidgetTo);
|
itemTo->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||||
ui->listWidgetTo->addItem(itemTo);
|
if (starTo || toList.contains(stateName))
|
||||||
itemTo->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
itemTo->setCheckState(Qt::Checked);
|
||||||
if (starTo || toList.contains(stateName))
|
else
|
||||||
itemTo->setCheckState(Qt::Checked);
|
itemTo->setCheckState(Qt::Unchecked);
|
||||||
else
|
|
||||||
itemTo->setCheckState(Qt::Unchecked);
|
|
||||||
|
|
||||||
auto itemFrom = new QListWidgetItem(stateName, ui->listWidgetFrom);
|
auto itemFrom = new QListWidgetItem(stateName, ui->listWidgetFrom);
|
||||||
ui->listWidgetFrom->addItem(itemFrom);
|
ui->listWidgetFrom->addItem(itemFrom);
|
||||||
itemFrom->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
itemFrom->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||||
if (starFrom || fromList.contains(stateName))
|
if (starFrom || fromList.contains(stateName))
|
||||||
itemFrom->setCheckState(Qt::Checked);
|
itemFrom->setCheckState(Qt::Checked);
|
||||||
else
|
else
|
||||||
itemFrom->setCheckState(Qt::Unchecked);
|
itemFrom->setCheckState(Qt::Unchecked);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->listWidgetTo->blockSignals(bTo);
|
ui->listWidgetTo->blockSignals(bTo);
|
||||||
ui->listWidgetFrom->blockSignals(bFrom);
|
ui->listWidgetFrom->blockSignals(bFrom);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2004,32 +2004,52 @@ FilePaths QtVersionPrivate::qtCorePaths()
|
|||||||
const QString versionString = m_data.qtVersionString;
|
const QString versionString = m_data.qtVersionString;
|
||||||
|
|
||||||
const QDir::Filters filters = QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot;
|
const QDir::Filters filters = QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot;
|
||||||
|
static const QStringList nameFilters{"QtCore*.framework",
|
||||||
|
"libQtCore*",
|
||||||
|
"libQt5Core*",
|
||||||
|
"libQt6Core*",
|
||||||
|
"QtCore*",
|
||||||
|
"Qt5Core*",
|
||||||
|
"Qt6Core*"};
|
||||||
|
|
||||||
const FilePaths entries = m_data.libraryPath.dirEntries(filters)
|
const FilePaths entries = m_data.libraryPath.dirEntries({nameFilters, filters})
|
||||||
+ m_data.binPath.dirEntries(filters);
|
+ m_data.binPath.dirEntries(filters);
|
||||||
|
|
||||||
FilePaths staticLibs;
|
FilePaths staticLibs;
|
||||||
FilePaths dynamicLibs;
|
FilePaths dynamicLibs;
|
||||||
|
|
||||||
|
auto isDynamicLib = [&versionString](const QString &file) {
|
||||||
|
return file.endsWith(".dll") || file.endsWith(QString::fromLatin1(".so.") + versionString)
|
||||||
|
|| file.endsWith(".so")
|
||||||
|
#if defined(Q_OS_OPENBSD)
|
||||||
|
|| file.contains(QRegularExpression("\\.so\\.[0-9]+\\.[0-9]+$")) // QTCREATORBUG-23818
|
||||||
|
#endif
|
||||||
|
|| file.endsWith(QLatin1Char('.') + versionString + ".dylib");
|
||||||
|
};
|
||||||
|
|
||||||
|
auto isStaticLib = [](const QString &file) {
|
||||||
|
return file.endsWith(".a") || file.endsWith(".lib");
|
||||||
|
};
|
||||||
|
|
||||||
|
auto isFramework = [](const QString &file) {
|
||||||
|
return file.startsWith("QtCore") && file.endsWith(".framework");
|
||||||
|
};
|
||||||
|
|
||||||
|
auto isQtCore = [](const QString &file) {
|
||||||
|
return file.startsWith("libQtCore") || file.startsWith("QtCore")
|
||||||
|
|| file.startsWith("libQt5Core") || file.startsWith("Qt5Core")
|
||||||
|
|| file.startsWith("libQt6Core") || file.startsWith("Qt6Core");
|
||||||
|
};
|
||||||
|
|
||||||
for (const FilePath &entry : entries) {
|
for (const FilePath &entry : entries) {
|
||||||
const QString file = entry.fileName();
|
const QString file = entry.fileName();
|
||||||
if (file.startsWith("QtCore") && file.endsWith(".framework") && entry.isReadableDir()) {
|
if (isFramework(file) && entry.isReadableDir()) {
|
||||||
// handle Framework
|
|
||||||
dynamicLibs.append(entry.pathAppended(file.left(file.lastIndexOf('.'))));
|
dynamicLibs.append(entry.pathAppended(file.left(file.lastIndexOf('.'))));
|
||||||
} else if (file.startsWith("libQtCore") || file.startsWith("QtCore")
|
} else if (isQtCore(file)) {
|
||||||
|| file.startsWith("libQt5Core") || file.startsWith("Qt5Core")
|
if (isDynamicLib(file) && entry.isReadableFile())
|
||||||
|| file.startsWith("libQt6Core") || file.startsWith("Qt6Core")) {
|
dynamicLibs.append(entry);
|
||||||
if (entry.isReadableFile()) {
|
else if (isStaticLib(file) && entry.isReadableFile())
|
||||||
if (file.endsWith(".a") || file.endsWith(".lib"))
|
staticLibs.append(entry);
|
||||||
staticLibs.append(entry);
|
|
||||||
else if (file.endsWith(".dll")
|
|
||||||
|| file.endsWith(QString::fromLatin1(".so.") + versionString)
|
|
||||||
|| file.endsWith(".so")
|
|
||||||
#if defined(Q_OS_OPENBSD)
|
|
||||||
|| file.contains(QRegularExpression("\\.so\\.[0-9]+\\.[0-9]+$")) // QTCREATORBUG-23818
|
|
||||||
#endif
|
|
||||||
|| file.endsWith(QLatin1Char('.') + versionString + ".dylib"))
|
|
||||||
dynamicLibs.append(entry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Only handle static libs if we cannot find dynamic ones:
|
// Only handle static libs if we cannot find dynamic ones:
|
||||||
|
|||||||
@@ -304,6 +304,8 @@ Core::GeneratedFiles SquishFileGenerator::fileList(Utils::MacroExpander *expande
|
|||||||
const Utils::FilePath &projectDir,
|
const Utils::FilePath &projectDir,
|
||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(wizardDir)
|
||||||
|
|
||||||
errorMessage->clear();
|
errorMessage->clear();
|
||||||
// later on differentiate based on m_mode
|
// later on differentiate based on m_mode
|
||||||
QString aut = expander->expand(QString{"%{AUT}"});
|
QString aut = expander->expand(QString{"%{AUT}"});
|
||||||
@@ -335,6 +337,9 @@ bool SquishFileGenerator::writeFile(const ProjectExplorer::JsonWizard *,
|
|||||||
bool SquishFileGenerator::allDone(const ProjectExplorer::JsonWizard *wizard, Core::GeneratedFile *file,
|
bool SquishFileGenerator::allDone(const ProjectExplorer::JsonWizard *wizard, Core::GeneratedFile *file,
|
||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(wizard)
|
||||||
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
if (m_mode == "TestSuite") {
|
if (m_mode == "TestSuite") {
|
||||||
if (file->filePath().fileName() == "suite.conf")
|
if (file->filePath().fileName() == "suite.conf")
|
||||||
QTimer::singleShot(0, [filePath = file->filePath()] {
|
QTimer::singleShot(0, [filePath = file->filePath()] {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"version": 1,
|
"version": 2,
|
||||||
"cmakeMinimumRequired": {
|
"cmakeMinimumRequired": {
|
||||||
"major": 3,
|
"major": 3,
|
||||||
"minor": 19,
|
"minor": 20,
|
||||||
"patch": 0
|
"patch": 0
|
||||||
},
|
},
|
||||||
"configurePresets": [
|
"configurePresets": [
|
||||||
@@ -13,10 +13,10 @@
|
|||||||
"binaryDir": "${sourceDir}/build-${presetName}-release",
|
"binaryDir": "${sourceDir}/build-${presetName}-release",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_BUILD_TYPE": "Release",
|
"CMAKE_BUILD_TYPE": "Release",
|
||||||
"CMAKE_PREFIX_PATH": "c:/Qt/6.3.1/mingw_64"
|
"CMAKE_PREFIX_PATH": "c:/Qt/6.3.2/mingw_64"
|
||||||
},
|
},
|
||||||
"environment": {
|
"environment": {
|
||||||
"PATH": "c:/mingw64/bin;$penv{PATH}"
|
"PATH": "c:/Qt/Tools/mingw1120_64/bin;$penv{PATH}"
|
||||||
},
|
},
|
||||||
"debug" : {
|
"debug" : {
|
||||||
"find" : true
|
"find" : true
|
||||||
@@ -37,8 +37,38 @@
|
|||||||
"value": "x64"
|
"value": "x64"
|
||||||
},
|
},
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_PREFIX_PATH": "c:/Qt/6.3.1/msvc2019_64"
|
"CMAKE_PREFIX_PATH": "c:/Qt/6.3.2/msvc2019_64"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"buildPresets": [
|
||||||
|
{
|
||||||
|
"name": "mingw",
|
||||||
|
"displayName": "MinGW default",
|
||||||
|
"configurePreset": "mingw",
|
||||||
|
"targets": "${sourceDirName}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mingw-verbose",
|
||||||
|
"inherits": "mingw",
|
||||||
|
"displayName": "MinGW verbose",
|
||||||
|
"verbose": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mingw-make",
|
||||||
|
"displayName": "MinGW make 4 CPUs",
|
||||||
|
"configurePreset": "mingw-make",
|
||||||
|
"jobs": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "visualc-debug",
|
||||||
|
"configurePreset": "visualc",
|
||||||
|
"configuration": "Debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "visualc-relwithdebinfo",
|
||||||
|
"inherits": "visualc-debug",
|
||||||
|
"configuration": "RelWithDebInfo"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user