diff --git a/dist/changes-2.8.0 b/dist/changes-2.8.0 new file mode 100644 index 0000000000000000000000000000000000000000..87cfd4e83ad72f273e1ab8ac932d794a34cf3179 --- /dev/null +++ b/dist/changes-2.8.0 @@ -0,0 +1,231 @@ +Qt Creator version 2.8 contains bug fixes and new features. + +There is a total of about 1250 changes by 60 individual contributors. + +The most important changes are listed in this document. For a complete +list of changes, see the Git log for the Qt Creator sources that +you can check out from the public Git repository. For example: + +git clone git://gitorious.org/qt-creator/qt-creator.git +git log --cherry-pick --pretty=oneline v2.7.1..origin/2.8 + +General + * Moved progress information from mode selector to the bottom-right + of the main window + * Added option to hide detailed progress information and show + summary progress bar instead + * Added "-block" command line option that opens files in a running + Qt Creator and blocks the command line until the editors are closed + * Made mode selector hideable (Window > Show Mode Selector) + +Editing + * Added option to open extra editor windows (Window > Split New Window) + * Fixed that mouse cursor was hidden when pressing modifier key + * Added support for jumping to column with locator and Go to Line menu + * Added that clicking on line and column display opens locator with line and column filter + (QTCREATORBUG-8811) + * Added option to show file encoding next to line and column display + (QTCREATORBUG-8376) + +Managing Projects + * Fixed opening projects created with wizard even if version control + creation fails (QTCREATORBUG-8892) + +Compilers + * Fixed detection of PowerPC ABI + * Fixed detection of ARM-based Windows CE ABI + * Fixed compile output parsers cutting off last character (QTCREATORBUG-9032) + * Added support for new warnings and errors in compile output from GCC 4.8 + +Devices + * Fixed setting default device (QTCREATORBUG-7812) + * Added support for configuring Desktop device + (for example free ports for debugging) + +QMake Projects + * Added support for OBJECTIVE_HEADERS + +CMake Projects + * Fixed sorting of build targets + * Fixed CXXFLAGS detection when Ninja is used (QTCREATORBUG-9047) + +Qbs Projects + * Fixed defines that are passed to the C++ code model + * Added install build step + * Fixed several issues with project tree + * Added run configuration for products in the project + * Added building of single files + +Autotools Projects + * Added parsing of defines and C++ flags from Makefile + +Generic Projects + * Added filtering for files to add instead of only filtering for files to ignore when + importing projects (QTCREATORBUG-8805) + +Debugging + * GDB + * Added option to load system GDB pretty printers + * Made adding tasks for missing debug info packages optional + (QTCREATORBUG-8949) + * CDB + * Fixed stepping out of disassembled function + * Added warning when debugging release build + * Fixed and added nice display of several data types + (QPixmap, QChar, 64bit integers in containers, QString in QVariant) + * Fixed that debugger would sometimes stop at disabled breakpoints (QTCREATORBUG-9295) + * LLDB + * Added experimental support + * QML + * Fixed that a fixed port was used instead of using port from device settings + * Added support for IPv6 + +Analyzer + * Fixed that a fixed port was used instead of using port from device settings + * Added support for IPv6 + * Fixed attaching profiler to QML applications to use kits + +C++ Support + * Added refactoring action that moves function definition from header to + source (QTCREATORBUG-516) + * Added refactoring action that assigns a function return value or new expression + to local variable (QTCREATORBUG-9052) + * Added refactoring action that adds implementations for pure virtual methods + * Fixed parsing of try-catch in constructor initializer (QTCREATORBUG-9064) + * Fixed handling of non-arguments in function parameter scope (QTCREATORBUG-8316) + * Fixed crash when adding include for undefined identifier in file that + has no other include (QTCREATORBUG-8799) + * Fixed that system headers were not reparsed when project configuration + changes (QTCREATORBUG-9056) + * Fixed highlighting for template parameters for function calls + * Improved support for anonymous classes + (QTCREATORBUG-6497, QTCREATORBUG-8963, QTCREATORBUG-3610, QTCREATORBUG-7579) + * Fixed support for typedef of templated typedefs (QTCREATORBUG-8375) + * Fixed code completion with 'using' declaration inside functions (QTCREATORBUG-2668) + * Fixed highlighting of types when there is 'using Namespace::TypeName' (QTCREATORBUG-7903) + +Python Support + * Added an editor with highlighter and indenter + * Added file and class wizards + +Diff Viewer + * Enabled by default + * Added folding of skipped lines + * Added folding of files + * Added jumping to original file on double-click + * Added file list combo box + +Version Control Systems + * Added "Select All" to clean dialog + * Git + * Added new side-by-side diff viewer + * Added support for interactive rebase + * Added support for updating submodules + * Added support for checking out commit + * Added continue and abort for operations in progress + (rebase, cherry-pick etc.) + * Added support for fixing up previous commit + * Moved all change related actions to a single dialog + * Improved stash handling + * Added dialog for pushing to Gerrit + * Added tags to branches dialog + * Added ability to save repository location for Gerrit + * Added graph toggle button for log viewer + * ClearCase + * Removed useless hijack button for dynamic view + +FakeVim + * Fixed movement between views with Ctrl+W, Arrow + * Added setting for .vimrc location (QTCREATORBUG-8748) + * Fixed z., zz, zb and z- commands + * Added support for Vim macro recording + +Platform Specific + +Linux + * Made crash handler for debug builds optional + +Qt Support + * Fixed that Qt Creator preferred Qt 4 qmake over the system default + (QTCREATORBUG-9068) + +QNX + * Added warning for too big icons and splash screens + * Added more application permissions to bar descriptor editor + * Added check for device development mode before deploying + * Fixed certificate marshalling with newer BlackBerry NDKs + * Added auto-detection of device PIN for new debug tokens (QTCREATORBUG-9062) + * Enabled QML debugging for pure QNX devices + * Fixed that key generation locked up UI (QTCREATORBUG-9078) + * Added option to sign packages when creating them + +Android + * Fixed that Android device would show up even when no Android SDK + was configured + * Added support for mixed C++/QML debugging + * Added support for QML profiling + * Added more sanity checks for package names (QTCREATORBUG-9200) + * Added visual editor for Android manifest files + +Credits for these changes go to: + +Aaron McCarthy +Adrien Bustany +Alan Alpert +Alessandro Portale +Andreas Holzammer +André Hartmann +André Pönitz +Andrey M. Tokarev +Aurindam Jana +Christian Kandeler +Christian Stenger +Christian Strømme +Daniel Teske +David Schulz +Debao Zhang +Dmitry Savchenko +Eike Ziller +El Mehdi Fekari +Erik Verbruggen +Eskil Abrahamsen Blomfeldt +Fawzi Mohamed +Friedemann Kleint +Lukas Holecek +Hugues Delorme +Jaroslaw Kobus +Jesper K. Pedersen +Jörg Bornemann +J-P Nurmi +Kai Köhne +Knut Petter Svendsen +Laurent Montel +Leena Miettinen +Lorenz Haas +Lukas Holecek +Marc Mutz +Marco Bubke +Martin T. H. Sandsmark +Michal Klocek +Mitch Curtis +Montel Laurent +Morten Johan Sørvig +Nikolai Kosjar +Orgad Shaneh +Oswald Buddenhagen +Pawel Faron +Petar Perisin +Przemyslaw Gorszkowski +Rafael Roquetto +Robert Löhning +Sergey Belyashov +Sergey Shambir +Shane Peelar +Thiago Macieira +Thomas Hartmann +Tim Jenssen +Timo Jyrinki +Tobias Hunger +Tobias Nätterlund +Tor Arne Vestbø +Victor Ostashevsky diff --git a/doc/images/qtcreator-deploy-android.png b/doc/images/qtcreator-deploy-android.png index 01ad85c999d07dcdf7daa059f0f222f269dcbf93..253fbdfa4e0e9bf943644a26e25443d29f9e5634 100755 Binary files a/doc/images/qtcreator-deploy-android.png and b/doc/images/qtcreator-deploy-android.png differ diff --git a/doc/src/android/deploying-android.qdoc b/doc/src/android/deploying-android.qdoc index 918e419e66148254a3e141b66fb5b86fcfcee89f..4003ea457e5b00f4512fcca4c124786aeea6b8a4 100644 --- a/doc/src/android/deploying-android.qdoc +++ b/doc/src/android/deploying-android.qdoc @@ -92,8 +92,8 @@ \image qtcreator-deploy-android.png "Deploy configurations" To copy Qt libraries and files to the project directory and to bundle them - as part of the APK, select the \gui {Use Qt libraries from device} option - and the \gui {Use local Qt libraries} check box. This is the default option + as part of the APK, select the \gui {Bundle Qt libraries in APK} option. + This is the default option when developing with Qt 5. \section1 Using Ministro to Install Qt Libraries @@ -111,7 +111,7 @@ created by \QC. To use Ministro to install the Qt libraries, select the - \gui {Use Qt libraries from device} option (without any other options). + \gui {Use Ministro service to install Qt} option. This is the default option when developing with Qt 4. @@ -128,11 +128,16 @@ during development. Select \gui Projects > \gui Run > \gui {Deploy configurations} > - \gui Details, and then select the \gui {Deploy local Qt libraries} option - and the \gui {Use local Qt libraries} check box to deploy Qt libraries to + \gui Details, and then select the + \gui {Deploy local Qt libraries to temporary directory} option to deploy + Qt libraries to the \c{/data/local/tmp/qt} folder on the device and to run the application against them. + To deploy new Qt libraries to the device, select + \gui {Clean Temporary Libraries Directory on Device}. The next time you + deploy the application, Qt libraries are copied to the device again. + \section1 Installing Ministro The easiest way to install Ministro is to do it on the device via Google @@ -143,8 +148,7 @@ from the Google Market or from the \l{http://necessitas.kde.org/necessitas/ministro.php}{Ministro} home page. - Then select the \gui {Install Ministro, system-wide Qt shared - libraries installer} option in \gui Projects > \gui Run > + Then select \gui {Install Ministro from APK} in \gui Projects > \gui Run > \gui {Deploy configurations} > \gui Details. You can use this option also to install any Android package (.apk). diff --git a/qtcreator.pri b/qtcreator.pri index efc264bc3daebbfe8357d51a89560b6bf825bafc..5252de058c84c1f1600c1dd95fb5222c9349ec7b 100644 --- a/qtcreator.pri +++ b/qtcreator.pri @@ -1,7 +1,7 @@ !isEmpty(QTCREATOR_PRI_INCLUDED):error("qtcreator.pri already included") QTCREATOR_PRI_INCLUDED = 1 -QTCREATOR_VERSION = 2.7.81 +QTCREATOR_VERSION = 2.7.82 isEqual(QT_MAJOR_VERSION, 5) { diff --git a/qtcreator.qbs b/qtcreator.qbs index e773619b38d78898ef008cc8d79fb73a10d71653..1cf9dee47f6a21388695edd92a33cef912e7e2de 100644 --- a/qtcreator.qbs +++ b/qtcreator.qbs @@ -6,7 +6,7 @@ Project { property string ide_version_major: '2' property string ide_version_minor: '7' - property string ide_version_release: '81' + property string ide_version_release: '82' property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release property string ide_app_path: qbs.targetOS == "mac" ? "" : "bin" property string ide_app_target: qbs.targetOS == "mac" ? "Qt Creator" : "qtcreator" diff --git a/share/qtcreator/dumper/lbridge.py b/share/qtcreator/dumper/lbridge.py index 297b9b217d2b03393daf2122b859f765f485a8bd..5487d6359655a489cfe8c0d15df0808d3823afbf 100644 --- a/share/qtcreator/dumper/lbridge.py +++ b/share/qtcreator/dumper/lbridge.py @@ -325,7 +325,7 @@ lldb.SBType.unqualified = lambda self: self.GetUnqualifiedType() lldb.SBType.pointer = lambda self: self.GetPointerType() lldb.SBType.code = lambda self: self.GetTypeClass() lldb.SBType.sizeof = property(lambda self: self.GetByteSize()) -lldb.SBType.strip_typedefs = lambda self: self +lldb.SBType.strip_typedefs = lambda self: self.GetCanonicalType() def simpleEncoding(typeobj): code = typeobj.GetTypeClass() @@ -504,6 +504,8 @@ class Dumper: self.useLldbDumpers = False self.ns = "" self.autoDerefPointers = True + self.useDynamicType = True + self.useLoop = True self.currentIName = None self.currentValuePriority = -100 @@ -517,11 +519,13 @@ class Dumper: self.currentChildType = None self.currentChildNumChild = None + self.executable_ = None self.charType_ = None self.intType_ = None self.sizetType_ = None self.charPtrType_ = None self.voidType_ = None + self.isShuttingDown_ = False def extractTemplateArgument(self, typename, index): level = 0 @@ -564,12 +568,12 @@ class Dumper: def intType(self): if self.intType_ is None: - self.intType_ = self.target.GetModuleAtIndex(0).FindFirstType('int') + self.intType_ = self.target.FindFirstType('int') return self.intType_ def charType(self): if self.charType_ is None: - self.charType_ = self.target.GetModuleAtIndex(0).FindFirstType('char') + self.charType_ = self.target.FindFirstType('char') return self.charType_ def charPtrType(self): @@ -578,9 +582,11 @@ class Dumper: return self.charPtrType_ def voidPtrType(self): + return None return self.charPtrType() # FIXME def voidPtrSize(self): + return None return self.charPtrType().GetByteSize() def sizetType(self): @@ -676,43 +682,46 @@ class Dumper: return xrange(min(self.currentMaxNumChild, self.currentNumChild)) def lookupType(self, name): - #warn("LOOKUP: %s" % self.target.GetModuleAtIndex(0).FindFirstType(name)) - return self.target.GetModuleAtIndex(0).FindFirstType(name) + #warn("LOOKUP: %s" % self.target.FindFirstType(name)) + return self.target.FindFirstType(name) def setupInferior(self, args): - fileName = args['executable'] + executable = args['executable'] + self.executable_ = executable error = lldb.SBError() - self.target = self.debugger.CreateTarget(fileName, None, None, True, error) + self.target = self.debugger.CreateTarget(executable, None, None, True, error) + self.listener = self.target.GetDebugger().GetListener() + self.process = self.target.Launch(self.listener, None, None, + None, None, None, + None, 0, True, error) + self.broadcaster = self.process.GetBroadcaster() + rc = self.broadcaster.AddListener(self.listener, 15) + if rc != 15: + warn("ADDING LISTENER FAILED: %s" % rc) + + self.importDumpers() + if self.target.IsValid(): - self.report('state="inferiorsetupok",msg="%s",exe="%s"' % (error, fileName)) + self.report('state="inferiorsetupok",msg="%s",exe="%s"' % (error, executable)) else: - self.report('state="inferiorsetupfailed",msg="%s",exe="%s"' % (error, fileName)) - self.importDumpers() + self.report('state="inferiorsetupfailed",msg="%s",exe="%s"' % (error, executable)) + + warn("STATE AFTER LAUNCH: %s" % stateNames[self.process.GetState()]) def runEngine(self, _): error = lldb.SBError() - #launchInfo = lldb.SBLaunchInfo(["-s"]) - #self.process = self.target.Launch(self.listener, None, None, - # None, '/tmp/stdout.txt', None, - # None, 0, True, error) - self.listener = lldb.SBListener("event_Listener") - self.process = self.target.Launch(self.listener, None, None, - None, None, None, - os.getcwd(), - lldb.eLaunchFlagExec - + lldb.eLaunchFlagDebug - #+ lldb.eLaunchFlagDebug - #+ lldb.eLaunchFlagStopAtEntry - #+ lldb.eLaunchFlagDisableSTDIO - #+ lldb.eLaunchFlagLaunchInSeparateProcessGroup - , False, error) - self.reportError(error) self.pid = self.process.GetProcessID() self.report('pid="%s"' % self.pid) - self.report('state="enginerunok"') + self.consumeEvents() + error = self.process.Continue() + self.consumeEvents() + self.reportError(error) + + self.report('state="enginerunandinferiorrunok"') - s = threading.Thread(target=self.loop, args=[]) - s.start() + if self.useLoop: + s = threading.Thread(target=self.loop, args=[]) + s.start() def describeError(self, error): desc = lldb.SBStream() @@ -809,15 +818,16 @@ class Dumper: self.currentType = str(type) self.currentTypePriority = self.currentTypePriority + 1 - def readRawMemory(self, base, size): - error = lldb.SBError() + if size == 0: + return "" #warn("BASE: %s " % base) #warn("SIZE: %s " % size) base = int(base) & 0xFFFFFFFFFFFFFFFF size = int(size) & 0xFFFFFFFF #warn("BASEX: %s " % base) #warn("SIZEX: %s " % size) + error = lldb.SBError() contents = self.process.ReadMemory(base, size, error) return binascii.hexlify(contents) @@ -1010,18 +1020,26 @@ class Dumper: if state != self.eventState: self.report('state="%s"' % stateNames[state]) self.eventState = state - #if state == lldb.eStateExited: - # warn("PROCESS EXITED. %d: %s" - # % (self.process.GetExitStatus(), self.process.GetExitDescription())) + if state == lldb.eStateExited: + if self.isShuttingDown_: + self.report('state="inferiorshutdownok"') + else: + self.report('state="inferiorexited"') + self.report('exited={status="%s",desc="%s"}' + % (self.process.GetExitStatus(), self.process.GetExitDescription())) if type == lldb.SBProcess.eBroadcastBitStateChanged: - #if state == lldb.eStateStopped: self.reportData() elif type == lldb.SBProcess.eBroadcastBitInterrupt: pass elif type == lldb.SBProcess.eBroadcastBitSTDOUT: - pass + # FIXME: Size? + msg = self.process.GetSTDOUT(1024) + self.report('output={channel="stdout",data="%s"}' + % binascii.hexlify(msg)) elif type == lldb.SBProcess.eBroadcastBitSTDERR: - pass + msg = self.process.GetSTDERR(1024) + self.report('output={channel="stdout",data="%s"}' + % binascii.hexlify(msg)) elif type == lldb.SBProcess.eBroadcastBitProfileData: pass @@ -1127,7 +1145,8 @@ class Dumper: def listModules(self, args): result = 'modules=[' - for module in self.target.modules: + for i in xrange(self.target.GetNumModules()): + module = self.target.GetModuleAtIndex(i) result += '{file="%s"' % module.file.fullpath result += ',name="%s"' % module.file.basename result += ',addrsize="%s"' % module.addr_size @@ -1146,7 +1165,8 @@ class Dumper: moduleName = args['module'] #file = lldb.SBFileSpec(moduleName) #module = self.target.FindModule(file) - for module in self.target.modules: + for i in xrange(self.target.GetNumModules()): + module = self.target.GetModuleAtIndex(i) if module.file.fullpath == moduleName: break result = 'symbols={module="%s"' % moduleName @@ -1174,8 +1194,13 @@ class Dumper: def executeStep(self, _ = None): self.currentThread().StepInto() + def shutdownInferior(self, _ = None): + self.isShuttingDown_ = True + self.process.Kill() + def quit(self, _ = None): - self.debugger.Terminate() + self.report('state="engineshutdownok"') + self.process.Kill() def executeStepI(self, _ = None): self.currentThread().StepInstruction(lldb.eOnlyThisThread) @@ -1202,8 +1227,9 @@ class Dumper: self.currentThread().SetSelectedFrame(args['index']) self.reportData() - def selectThread(self, thread): - self.handleCommand("thread select " + thread) + def selectThread(self, args): + self.process.SetSelectedThreadByID(args['id']) + self.reportData() def requestModuleSymbols(self, frame): self.handleCommand("target module list " + frame) @@ -1213,12 +1239,8 @@ class Dumper: command = args['command'] self.debugger.GetCommandInterpreter().HandleCommand(command, result) success = result.Succeeded() - if success: - output = result.GetOutput() - error = '' - else: - output = '' - error = str(result.GetError()) + output = result.GetOutput() + error = str(result.GetError()) self.report('success="%d",output="%s",error="%s"' % (success, output, error)) def setOptions(self, args): @@ -1226,6 +1248,10 @@ class Dumper: def updateData(self, args): self.expandedINames = set(args['expanded'].split(',')) + self.autoDerefPointers = int(args['autoderef']) + self.useDynamicType = int(args['dyntype']) + # Keep always True for now. + #self.passExceptions = args['pe'] self.reportData() def disassemble(self, args): @@ -1279,19 +1305,42 @@ class Dumper: def execute(self, args): getattr(self, args['cmd'])(args) self.report('token="%s"' % args['token']) - try: + if 'continuation' in args: cont = args['continuation'] self.report('continuation="%s"' % cont) - except: - pass + + def consumeEvents(self): + event = lldb.SBEvent() + if self.listener and self.listener.PeekAtNextEvent(event): + self.listener.GetNextEvent(event) + self.handleEvent(event) + currentDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) execfile(os.path.join(currentDir, "qttypes.py")) -def doit(): +def doit1(): db = Dumper() + db.useLoop = False + db.report('state="enginesetupok"') + + while True: + db.consumeEvents() + + readable, _, _ = select.select([sys.stdin], [], [], 0.1) + if sys.stdin in readable: + line = raw_input() + if line.startswith("db "): + db.execute(eval(line[3:])) + + db.consumeEvents() + +def doit2(): + + db = Dumper() + db.useLoop = True db.report('state="enginesetupok"') while True: @@ -1304,9 +1353,9 @@ def doit(): db.execute(eval(line[3:])) - def testit(): db = Dumper() + db.useLoop = False error = lldb.SBError() db.target = db.debugger.CreateTarget(sys.argv[2], None, None, True, error) @@ -1344,4 +1393,4 @@ def testit(): if len(sys.argv) > 2: testit() else: - doit() + doit2() diff --git a/src/plugins/android/androiddeploystep.cpp b/src/plugins/android/androiddeploystep.cpp index 222da0e35c3a5f8b37ad5df0ec07e9eb695e5a16..c11ced5f1e493d6df4b90a08ccb391aad2d1e819 100644 --- a/src/plugins/android/androiddeploystep.cpp +++ b/src/plugins/android/androiddeploystep.cpp @@ -83,10 +83,9 @@ void AndroidDeployStep::ctor() setDefaultDisplayName(tr("Deploy to Android device")); m_deployAction = NoDeploy; - m_useLocalQtLibs = false; if (QtSupport::BaseQtVersion *qt = QtSupport::QtKitInformation::qtVersion(target()->kit())) if (qt->qtVersion() >= QtSupport::QtVersionNumber(5, 0, 0)) - m_useLocalQtLibs = true; + m_deployAction = BundleLibraries; } bool AndroidDeployStep::init() @@ -118,7 +117,6 @@ bool AndroidDeployStep::init() m_apkPathDebug = AndroidManager::apkPath(target(), AndroidManager::DebugBuild).toString(); m_apkPathRelease = AndroidManager::apkPath(target(), AndroidManager::ReleaseBuildSigned).toString(); m_buildDirectory = static_cast<Qt4Project *>(target()->project())->rootQt4ProjectNode()->buildDir(); - m_runQASIPackagePath = m_QASIPackagePath; m_runDeployAction = m_deployAction; ToolChain *tc = ToolChainKitInformation::toolChain(target()->kit()); if (!tc || tc->type() != QLatin1String(Constants::ANDROID_TOOLCHAIN_TYPE)) { @@ -148,15 +146,15 @@ AndroidDeployStep::AndroidDeployAction AndroidDeployStep::deployAction() return m_deployAction; } -bool AndroidDeployStep::useLocalQtLibs() -{ - return m_useLocalQtLibs; -} - bool AndroidDeployStep::fromMap(const QVariantMap &map) { - m_useLocalQtLibs = map.value(QLatin1String(USE_LOCAL_QT_KEY), false).toBool(); m_deployAction = AndroidDeployAction(map.value(QLatin1String(DEPLOY_ACTION_KEY), NoDeploy).toInt()); + QVariant useLocalQt = map.value(QLatin1String(USE_LOCAL_QT_KEY)); + if (useLocalQt.isValid()) { // old settings + if (useLocalQt.toBool() && m_deployAction == NoDeploy) + m_deployAction = BundleLibraries; + } + if (m_deployAction == InstallQASI) m_deployAction = NoDeploy; return ProjectExplorer::BuildStep::fromMap(map); @@ -165,7 +163,6 @@ bool AndroidDeployStep::fromMap(const QVariantMap &map) QVariantMap AndroidDeployStep::toMap() const { QVariantMap map = ProjectExplorer::BuildStep::toMap(); - map.insert(QLatin1String(USE_LOCAL_QT_KEY), m_useLocalQtLibs); map.insert(QLatin1String(DEPLOY_ACTION_KEY), m_deployAction); return map; } @@ -184,7 +181,7 @@ void AndroidDeployStep::cleanLibsOnDevice() QProcess *process = new QProcess(this); QStringList arguments = AndroidDeviceInfo::adbSelector(deviceSerialNumber); arguments << QLatin1String("shell") << QLatin1String("rm") << QLatin1String("-r") << QLatin1String("/data/local/tmp/qt"); - connect(process, SIGNAL(finished(int)), this, SLOT(cleanLibsFinished())); + connect(process, SIGNAL(finished(int)), this, SLOT(processFinished())); const QString adb = AndroidConfigurations::instance().adbToolPath().toString(); Core::MessageManager::instance()->printToOutputPane(adb + QLatin1String(" ") + arguments.join(QLatin1String(" ")), @@ -194,7 +191,7 @@ void AndroidDeployStep::cleanLibsOnDevice() delete process; } -void AndroidDeployStep::cleanLibsFinished() +void AndroidDeployStep::processFinished() { QProcess *process = qobject_cast<QProcess *>(sender()); QTC_ASSERT(process, return); @@ -204,22 +201,35 @@ void AndroidDeployStep::cleanLibsFinished() process->deleteLater(); } -void AndroidDeployStep::setDeployAction(AndroidDeployStep::AndroidDeployAction deploy) +void AndroidDeployStep::installQASIPackage(const QString &packagePath) { - m_deployAction = deploy; + const QString targetArch = AndroidManager::targetArch(target()); + const QString targetSDK = AndroidManager::targetSDK(target()); + int deviceAPILevel = targetSDK.mid(targetSDK.indexOf(QLatin1Char('-')) + 1).toInt(); + QString deviceSerialNumber = AndroidConfigurations::instance().getDeployDeviceSerialNumber(&deviceAPILevel, targetArch); + if (!deviceSerialNumber.length()) { + Core::MessageManager::instance()->printToOutputPane(tr("Could not run adb. No device found."), Core::MessageManager::NoModeSwitch); + return; + } - AndroidManager::updateDeploymentSettings(target()); -} + QProcess *process = new QProcess(this); + QStringList arguments = AndroidDeviceInfo::adbSelector(deviceSerialNumber); + arguments << QLatin1String("install") << QLatin1String("-r ") << packagePath; -void AndroidDeployStep::setDeployQASIPackagePath(const QString &package) -{ - m_QASIPackagePath = package; - setDeployAction(InstallQASI); + connect(process, SIGNAL(finished(int)), this, SLOT(processFinished())); + const QString adb = AndroidConfigurations::instance().adbToolPath().toString(); + Core::MessageManager::instance()->printToOutputPane(adb + QLatin1String(" ") + + arguments.join(QLatin1String(" ")), + Core::MessageManager::NoModeSwitch); + process->start(adb, arguments); + if (!process->waitForFinished(500)) + delete process; } -void AndroidDeployStep::setUseLocalQtLibs(bool useLocal) +void AndroidDeployStep::setDeployAction(AndroidDeployStep::AndroidDeployAction deploy) { - m_useLocalQtLibs = useLocal; + m_deployAction = deploy; + AndroidManager::updateDeploymentSettings(target()); } @@ -453,17 +463,6 @@ bool AndroidDeployStep::deployPackage() AndroidPackageCreationStep::removeDirectory(tempPath); } - if (m_runDeployAction == InstallQASI) { - if (!runCommand(deployProc, AndroidConfigurations::instance().adbToolPath().toString(), - AndroidDeviceInfo::adbSelector(m_deviceSerialNumber) - << QLatin1String("install") << QLatin1String("-r ") << m_runQASIPackagePath)) { - raiseError(tr("Qt Android smart installer installation failed")); - disconnect(deployProc, 0, this, 0); - deployProc->deleteLater(); - return false; - } - emit resetDelopyAction(); - } deployProc->setWorkingDirectory(m_androidDirPath.toString()); writeOutput(tr("Installing package onto %1.").arg(m_deviceSerialNumber)); diff --git a/src/plugins/android/androiddeploystep.h b/src/plugins/android/androiddeploystep.h index 0fa090aa54a2eeffd8189a4f0a6205842ce53aa7..ad922c46e1d24756972e186e3d700ec37290b37d 100644 --- a/src/plugins/android/androiddeploystep.h +++ b/src/plugins/android/androiddeploystep.h @@ -75,9 +75,10 @@ class AndroidDeployStep : public ProjectExplorer::BuildStep public: enum AndroidDeployAction { - NoDeploy, + NoDeploy, // use ministro DeployLocal, - InstallQASI + InstallQASI, // unused old value + BundleLibraries }; public: @@ -89,28 +90,25 @@ public: int deviceAPILevel(); AndroidDeployAction deployAction(); - bool useLocalQtLibs(); bool fromMap(const QVariantMap &map); QVariantMap toMap() const; void cleanLibsOnDevice(); + void installQASIPackage(const QString &packagePath); public slots: void setDeployAction(AndroidDeployAction deploy); - void setDeployQASIPackagePath(const QString &package); - void setUseLocalQtLibs(bool useLocal); signals: void done(); void error(); - void resetDelopyAction(); private slots: bool deployPackage(); void handleBuildOutput(); void handleBuildError(); - void cleanLibsFinished(); + void processFinished(); private: AndroidDeployStep(ProjectExplorer::BuildStepList *bc, @@ -140,7 +138,6 @@ private: QString m_QASIPackagePath; AndroidDeployAction m_deployAction; - bool m_useLocalQtLibs; // members to transfer data from init() to run QString m_packageName; diff --git a/src/plugins/android/androiddeploystepwidget.cpp b/src/plugins/android/androiddeploystepwidget.cpp index 45a8373b742b37529173b5dcc6fa83ec2696639b..482051342cd09d399e54efd04d23201360fc3556 100644 --- a/src/plugins/android/androiddeploystepwidget.cpp +++ b/src/plugins/android/androiddeploystepwidget.cpp @@ -47,21 +47,26 @@ AndroidDeployStepWidget::AndroidDeployStepWidget(AndroidDeployStep *step) : { ui->setupUi(this); - ui->useLocalQtLibs->setChecked(m_step->useLocalQtLibs()); switch (m_step->deployAction()) { + case AndroidDeployStep::NoDeploy: + ui->ministroOption->setChecked(true); + break; case AndroidDeployStep::DeployLocal: - ui->deployQtLibs->setChecked(true); + ui->temporaryQtOption->setChecked(true); + break; + case AndroidDeployStep::BundleLibraries: + ui->bundleQtOption->setChecked(true); break; default: - ui->devicesQtLibs->setChecked(true); + ui->ministroOption->setChecked(true); break; } - connect(m_step, SIGNAL(resetDelopyAction()), SLOT(resetAction())); - connect(ui->devicesQtLibs, SIGNAL(clicked()), SLOT(resetAction())); - connect(ui->deployQtLibs, SIGNAL(clicked()), SLOT(setDeployLocalQtLibs())); + connect(ui->ministroOption, SIGNAL(clicked()), SLOT(setMinistro())); + connect(ui->temporaryQtOption, SIGNAL(clicked()), SLOT(setDeployLocalQtLibs())); + connect(ui->bundleQtOption, SIGNAL(clicked()), SLOT(setBundleQtLibs())); + connect(ui->chooseButton, SIGNAL(clicked()), SLOT(setQASIPackagePath())); - connect(ui->useLocalQtLibs, SIGNAL(stateChanged(int)), SLOT(useLocalQtLibsStateChanged(int))); connect(ui->cleanLibsPushButton, SIGNAL(clicked()), SLOT(cleanLibsOnDevice())); } @@ -80,9 +85,8 @@ QString AndroidDeployStepWidget::summaryText() const return displayName(); } -void AndroidDeployStepWidget::resetAction() +void AndroidDeployStepWidget::setMinistro() { - ui->devicesQtLibs->setChecked(true); m_step->setDeployAction(AndroidDeployStep::NoDeploy); } @@ -91,19 +95,20 @@ void AndroidDeployStepWidget::setDeployLocalQtLibs() m_step->setDeployAction(AndroidDeployStep::DeployLocal); } +void AndroidDeployStepWidget::setBundleQtLibs() +{ + m_step->setDeployAction(AndroidDeployStep::BundleLibraries); +} + void AndroidDeployStepWidget::setQASIPackagePath() { QString packagePath = QFileDialog::getOpenFileName(this, tr("Qt Android Smart Installer"), QDir::homePath(), tr("Android package (*.apk)")); - if (packagePath.length()) - m_step->setDeployQASIPackagePath(packagePath); + if (!packagePath.isEmpty()) + m_step->installQASIPackage(packagePath); } -void AndroidDeployStepWidget::useLocalQtLibsStateChanged(int state) -{ - m_step->setUseLocalQtLibs(state == Qt::Checked); -} void AndroidDeployStepWidget::cleanLibsOnDevice() { diff --git a/src/plugins/android/androiddeploystepwidget.h b/src/plugins/android/androiddeploystepwidget.h index 90db7d43420d42299d95f054612d2019747055ad..8c05d0aa629f621029283b29928f090d1fe66f0e 100644 --- a/src/plugins/android/androiddeploystepwidget.h +++ b/src/plugins/android/androiddeploystepwidget.h @@ -49,10 +49,11 @@ public: ~AndroidDeployStepWidget(); private slots: - void resetAction(); + void setMinistro(); void setDeployLocalQtLibs(); + void setBundleQtLibs(); + void setQASIPackagePath(); - void useLocalQtLibsStateChanged(int); void cleanLibsOnDevice(); private: diff --git a/src/plugins/android/androiddeploystepwidget.ui b/src/plugins/android/androiddeploystepwidget.ui index 4458c49408184067501b7d16c42973f083655ab1..96ed9eb5330c3b76c2c44a59d95961f2a0cb1db5 100644 --- a/src/plugins/android/androiddeploystepwidget.ui +++ b/src/plugins/android/androiddeploystepwidget.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>560</width> - <height>145</height> + <width>678</width> + <height>155</height> </rect> </property> <property name="sizePolicy"> @@ -19,138 +19,88 @@ <property name="windowTitle"> <string>Form</string> </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QRadioButton" name="devicesQtLibs"> - <property name="toolTip"> - <string>Use Qt libraries from device</string> - </property> - <property name="text"> - <string>Use Qt libraries from device</string> - </property> - <property name="checked"> - <bool>true</bool> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Qt Deployment</string> </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QRadioButton" name="ministroOption"> + <property name="toolTip"> + <string>Use the external Ministro application to download and maintain Qt libraries.</string> + </property> + <property name="text"> + <string>Use Ministro service to install Qt</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="temporaryQtOption"> + <property name="toolTip"> + <string>Push local Qt libraries to device. You must have Qt libraries compiled for that platform. +The APK will not be usable on any other device.</string> + </property> + <property name="text"> + <string>Deploy local Qt libraries to temporary directory</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="bundleQtOption"> + <property name="toolTip"> + <string>Creates a standalone APK.</string> + </property> + <property name="text"> + <string>Bundle Qt libraries in APK</string> + </property> + </widget> + </item> + </layout> </widget> </item> - <item row="1" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QRadioButton" name="deployQtLibs"> - <property name="toolTip"> - <string>Push local Qt libraries to device. -You must have Qt libraries compiled for that platform</string> - </property> - <property name="text"> - <string>Deploy local Qt libraries</string> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="useLocalQtLibs"> - <property name="toolTip"> - <string>Check this option to force the application to use local Qt libraries instead of system libraries.</string> - </property> - <property name="text"> - <string>Use local Qt libraries</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="cleanLibsPushButton"> - <property name="text"> - <string>Clean Libs on Device</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="2" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QRadioButton" name="installQASI"> - <property name="toolTip"> - <string>Choose and install Ministro system wide Qt shared libraries. -This option is useful when you want to try your application on devices which don't have Android Market (e.g. Android Emulator).</string> - </property> - <property name="text"> - <string>Install Ministro, system-wide Qt shared libraries installer</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="chooseButton"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Choose APK</string> - </property> - </widget> - </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 row="3" column="0"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>41</height> - </size> + <item> + <widget class="QGroupBox" name="groupBox_2"> + <property name="title"> + <string>Advanced Actions</string> </property> - </spacer> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QPushButton" name="cleanLibsPushButton"> + <property name="text"> + <string>Clean Temporary Libraries Directory on Device</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="chooseButton"> + <property name="text"> + <string>Install Ministro from APK</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <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> </item> </layout> </widget> <resources/> - <connections> - <connection> - <sender>installQASI</sender> - <signal>toggled(bool)</signal> - <receiver>chooseButton</receiver> - <slot>setEnabled(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>119</x> - <y>68</y> - </hint> - <hint type="destinationlabel"> - <x>272</x> - <y>64</y> - </hint> - </hints> - </connection> - <connection> - <sender>deployQtLibs</sender> - <signal>clicked(bool)</signal> - <receiver>useLocalQtLibs</receiver> - <slot>setChecked(bool)</slot> - <hints> - <hint type="sourcelabel"> - <x>138</x> - <y>43</y> - </hint> - <hint type="destinationlabel"> - <x>343</x> - <y>44</y> - </hint> - </hints> - </connection> - </connections> + <connections/> </ui> diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index c712a0b06de45aeb5b985902e3ec2f562317d7bc..b17e044b80b5846a5b63e43daf7e71a14e6b9314 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -319,8 +319,7 @@ bool AndroidManager::bundleQt(ProjectExplorer::Target *target) AndroidRunConfiguration *androidRunConfiguration = qobject_cast<AndroidRunConfiguration *>(runConfiguration); if (androidRunConfiguration != 0) { AndroidDeployStep *deployStep = androidRunConfiguration->deployStep(); - return deployStep->deployAction() == AndroidDeployStep::NoDeploy - && deployStep->useLocalQtLibs(); + return deployStep->deployAction() == AndroidDeployStep::BundleLibraries; } return false; @@ -340,9 +339,10 @@ bool AndroidManager::updateDeploymentSettings(ProjectExplorer::Target *target) return false; AndroidDeployStep *deployStep = androidRunConfiguration->deployStep(); - bool useLocalLibs = deployStep->useLocalQtLibs(); - bool deployQtLibs = deployStep->deployAction() != AndroidDeployStep::NoDeploy; - bool bundleQtLibs = useLocalLibs && !deployQtLibs; + AndroidDeployStep::AndroidDeployAction deployAction = deployStep->deployAction(); + bool useLocalLibs = deployAction == AndroidDeployStep::DeployLocal + || deployAction == AndroidDeployStep::BundleLibraries; + bool bundleQtLibs = deployAction == AndroidDeployStep::BundleLibraries; QDomDocument doc; if (!openManifest(target, doc)) diff --git a/src/plugins/android/androidpackagecreationstep.cpp b/src/plugins/android/androidpackagecreationstep.cpp index 9ca9af55f10f3d78623179716f873fb0be473e9b..6dc511910303ceb8ba090b6d30c3b2950c731497 100644 --- a/src/plugins/android/androidpackagecreationstep.cpp +++ b/src/plugins/android/androidpackagecreationstep.cpp @@ -338,7 +338,7 @@ void AndroidPackageCreationStep::checkRequiredLibrariesForRun() QMetaObject::invokeMethod(this, "setQtLibs",Qt::BlockingQueuedConnection, Q_ARG(QStringList, m_qtLibsWithDependencies)); - QMetaObject::invokeMethod(this, "getBundleInformation"); + QMetaObject::invokeMethod(this, "getBundleInformation", Qt::BlockingQueuedConnection); emit updateRequiredLibrariesModels(); } diff --git a/src/plugins/android/androidpackagecreationwidget.cpp b/src/plugins/android/androidpackagecreationwidget.cpp index ac667ee1660389f0586b00fde573045515428c1a..5bb2876955968413a7140a3358cccef0b4d1b89a 100644 --- a/src/plugins/android/androidpackagecreationwidget.cpp +++ b/src/plugins/android/androidpackagecreationwidget.cpp @@ -234,7 +234,8 @@ void AndroidPackageCreationWidget::setQtLibs(QModelIndex, QModelIndex) { AndroidManager::setQtLibs(m_step->target(), m_qtLibsModel->checkedItems()); AndroidDeployStep * const deployStep = AndroidGlobal::buildStep<AndroidDeployStep>(m_step->target()->activeDeployConfiguration()); - if (deployStep->useLocalQtLibs()) + if (deployStep->deployAction() == AndroidDeployStep::DeployLocal + || deployStep->deployAction() == AndroidDeployStep::BundleLibraries) AndroidManager::updateDeploymentSettings(m_step->target()); } @@ -242,7 +243,8 @@ void AndroidPackageCreationWidget::setPrebundledLibs(QModelIndex, QModelIndex) { AndroidManager::setPrebundledLibs(m_step->target(), m_prebundledLibs->checkedItems()); AndroidDeployStep * const deployStep = AndroidGlobal::buildStep<AndroidDeployStep>(m_step->target()->activeDeployConfiguration()); - if (deployStep->useLocalQtLibs()) + if (deployStep->deployAction() == AndroidDeployStep::DeployLocal + || deployStep->deployAction() == AndroidDeployStep::BundleLibraries) AndroidManager::updateDeploymentSettings(m_step->target()); } diff --git a/src/plugins/android/androidrunner.cpp b/src/plugins/android/androidrunner.cpp index 471c380f3bc567991d2308ce6743d04984f308b5..a005e10fde65aec18ca68cf643521c270b50c6a3 100644 --- a/src/plugins/android/androidrunner.cpp +++ b/src/plugins/android/androidrunner.cpp @@ -74,7 +74,9 @@ AndroidRunner::AndroidRunner(QObject *parent, } ProjectExplorer::Target *target = runConfig->target(); AndroidDeployStep *ds = runConfig->deployStep(); - if ((m_useLocalQtLibs = ds->useLocalQtLibs())) { + m_useLocalQtLibs = ds->deployAction() == AndroidDeployStep::DeployLocal + || ds->deployAction() == AndroidDeployStep::BundleLibraries; + if (m_useLocalQtLibs) { m_localLibs = AndroidManager::loadLocalLibs(target, ds->deviceAPILevel()); m_localJars = AndroidManager::loadLocalJars(target, ds->deviceAPILevel()); m_localJarsInitClasses = AndroidManager::loadLocalJarsInitClasses(target, ds->deviceAPILevel()); diff --git a/src/plugins/bineditor/bineditor.cpp b/src/plugins/bineditor/bineditor.cpp index 2037b4542d03ebe3daee66a46beaba7090009cd2..25b12f0cc6e99e35ebe968e6efa7ae964aafedb2 100644 --- a/src/plugins/bineditor/bineditor.cpp +++ b/src/plugins/bineditor/bineditor.cpp @@ -31,6 +31,7 @@ #include <texteditor/fontsettings.h> #include <texteditor/texteditorconstants.h> +#include <texteditor/texteditorsettings.h> #include <coreplugin/editormanager/ieditor.h> #include <utils/fileutils.h> #include <utils/qtcassert.h> @@ -85,7 +86,7 @@ static QByteArray calculateHexPattern(const QByteArray &pattern) namespace BINEditor { -BinEditor::BinEditor(QWidget *parent) +BinEditorWidget::BinEditorWidget(QWidget *parent) : QAbstractScrollArea(parent) { m_bytesPerLine = 16; @@ -106,13 +107,20 @@ BinEditor::BinEditor(QWidget *parent) m_canRequestNewWindow = false; setFocusPolicy(Qt::WheelFocus); setFrameStyle(QFrame::Plain); + + // Font settings + TextEditor::TextEditorSettings *settings = TextEditor::TextEditorSettings::instance(); + setFontSettings(settings->fontSettings()); + connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)), + this, SLOT(setFontSettings(TextEditor::FontSettings))); + } -BinEditor::~BinEditor() +BinEditorWidget::~BinEditorWidget() { } -void BinEditor::init() +void BinEditorWidget::init() { const int addressStringWidth = 2*m_addressBytes + (m_addressBytes - 1) / 2; @@ -162,7 +170,7 @@ void BinEditor::init() } -void BinEditor::addData(quint64 block, const QByteArray &data) +void BinEditorWidget::addData(quint64 block, const QByteArray &data) { QTC_ASSERT(data.size() == m_blockSize, return); const quint64 addr = block * m_blockSize; @@ -176,7 +184,7 @@ void BinEditor::addData(quint64 block, const QByteArray &data) } } -bool BinEditor::requestDataAt(int pos) const +bool BinEditorWidget::requestDataAt(int pos) const { int block = pos / m_blockSize; BlockMap::const_iterator it = m_modifiedData.find(block); @@ -187,27 +195,27 @@ bool BinEditor::requestDataAt(int pos) const return true; if (!m_requests.contains(block)) { m_requests.insert(block); - emit const_cast<BinEditor*>(this)-> - dataRequested(editor(), m_baseAddr / m_blockSize + block); + emit const_cast<BinEditorWidget*>(this)-> + dataRequested(m_baseAddr / m_blockSize + block); return true; } return false; } -bool BinEditor::requestOldDataAt(int pos) const +bool BinEditorWidget::requestOldDataAt(int pos) const { int block = pos / m_blockSize; BlockMap::const_iterator it = m_oldData.find(block); return it != m_oldData.end(); } -char BinEditor::dataAt(int pos, bool old) const +char BinEditorWidget::dataAt(int pos, bool old) const { int block = pos / m_blockSize; return blockData(block, old).at(pos - block*m_blockSize); } -void BinEditor::changeDataAt(int pos, char c) +void BinEditorWidget::changeDataAt(int pos, char c) { int block = pos / m_blockSize; BlockMap::iterator it = m_modifiedData.find(block); @@ -222,10 +230,10 @@ void BinEditor::changeDataAt(int pos, char c) } } - emit dataChanged(editor(), m_baseAddr + pos, QByteArray(1, c)); + emit dataChanged(m_baseAddr + pos, QByteArray(1, c)); } -QByteArray BinEditor::dataMid(int from, int length, bool old) const +QByteArray BinEditorWidget::dataMid(int from, int length, bool old) const { int end = from + length; int block = from / m_blockSize; @@ -239,7 +247,7 @@ QByteArray BinEditor::dataMid(int from, int length, bool old) const return data.mid(from - ((from / m_blockSize) * m_blockSize), length); } -QByteArray BinEditor::blockData(int block, bool old) const +QByteArray BinEditorWidget::blockData(int block, bool old) const { if (old) { BlockMap::const_iterator it = m_modifiedData.find(block); @@ -251,12 +259,12 @@ QByteArray BinEditor::blockData(int block, bool old) const ? it.value() : m_data.value(block, m_emptyBlock); } -void BinEditor::setFontSettings(const TextEditor::FontSettings &fs) +void BinEditorWidget::setFontSettings(const TextEditor::FontSettings &fs) { setFont(fs.toTextCharFormat(TextEditor::C_TEXT).font()); } -void BinEditor::setBlinkingCursorEnabled(bool enable) +void BinEditorWidget::setBlinkingCursorEnabled(bool enable) { if (enable && QApplication::cursorFlashTime() > 0) m_cursorBlinkTimer.start(QApplication::cursorFlashTime() / 2, this); @@ -266,17 +274,17 @@ void BinEditor::setBlinkingCursorEnabled(bool enable) updateLines(); } -void BinEditor::focusInEvent(QFocusEvent *) +void BinEditorWidget::focusInEvent(QFocusEvent *) { setBlinkingCursorEnabled(true); } -void BinEditor::focusOutEvent(QFocusEvent *) +void BinEditorWidget::focusOutEvent(QFocusEvent *) { setBlinkingCursorEnabled(false); } -void BinEditor::timerEvent(QTimerEvent *e) +void BinEditorWidget::timerEvent(QTimerEvent *e) { if (e->timerId() == m_autoScrollTimer.timerId()) { QRect visible = viewport()->rect(); @@ -314,7 +322,7 @@ void BinEditor::timerEvent(QTimerEvent *e) } -void BinEditor::setModified(bool modified) +void BinEditorWidget::setModified(bool modified) { int unmodifiedState = modified ? -1 : m_undoStack.size(); if (unmodifiedState == m_unmodifiedState) @@ -323,22 +331,22 @@ void BinEditor::setModified(bool modified) emit modificationChanged(m_undoStack.size() != m_unmodifiedState); } -bool BinEditor::isModified() const +bool BinEditorWidget::isModified() const { return (m_undoStack.size() != m_unmodifiedState); } -void BinEditor::setReadOnly(bool readOnly) +void BinEditorWidget::setReadOnly(bool readOnly) { m_readOnly = readOnly; } -bool BinEditor::isReadOnly() const +bool BinEditorWidget::isReadOnly() const { return m_readOnly; } -bool BinEditor::save(QString *errorString, const QString &oldFileName, const QString &newFileName) +bool BinEditorWidget::save(QString *errorString, const QString &oldFileName, const QString &newFileName) { if (oldFileName != newFileName) { QString tmpName; @@ -381,7 +389,7 @@ bool BinEditor::save(QString *errorString, const QString &oldFileName, const QSt return true; } -void BinEditor::setSizes(quint64 startAddr, int range, int blockSize) +void BinEditorWidget::setSizes(quint64 startAddr, int range, int blockSize) { int newBlockSize = blockSize; QTC_ASSERT((blockSize/m_bytesPerLine) * m_bytesPerLine == blockSize, @@ -423,23 +431,23 @@ void BinEditor::setSizes(quint64 startAddr, int range, int blockSize) viewport()->update(); } -void BinEditor::resizeEvent(QResizeEvent *) +void BinEditorWidget::resizeEvent(QResizeEvent *) { init(); } -void BinEditor::scrollContentsBy(int dx, int dy) +void BinEditorWidget::scrollContentsBy(int dx, int dy) { viewport()->scroll(isRightToLeft() ? -dx : dx, dy * m_lineHeight); const QScrollBar * const scrollBar = verticalScrollBar(); const int scrollPos = scrollBar->value(); if (dy <= 0 && scrollPos == scrollBar->maximum()) - emit newRangeRequested(editor(), baseAddress() + m_size); + emit newRangeRequested(baseAddress() + m_size); else if (dy >= 0 && scrollPos == scrollBar->minimum()) - emit newRangeRequested(editor(), baseAddress()); + emit newRangeRequested(baseAddress()); } -void BinEditor::changeEvent(QEvent *e) +void BinEditorWidget::changeEvent(QEvent *e) { QAbstractScrollArea::changeEvent(e); if (e->type() == QEvent::ActivationChange) { @@ -451,7 +459,7 @@ void BinEditor::changeEvent(QEvent *e) } -void BinEditor::wheelEvent(QWheelEvent *e) +void BinEditorWidget::wheelEvent(QWheelEvent *e) { if (e->modifiers() & Qt::ControlModifier) { const int delta = e->delta(); @@ -466,7 +474,7 @@ void BinEditor::wheelEvent(QWheelEvent *e) -QRect BinEditor::cursorRect() const +QRect BinEditorWidget::cursorRect() const { int topLine = verticalScrollBar()->value(); int line = m_cursorPosition / m_bytesPerLine; @@ -481,7 +489,7 @@ QRect BinEditor::cursorRect() const return QRect(x, y, w, m_lineHeight); } -int BinEditor::posAt(const QPoint &pos) const +int BinEditorWidget::posAt(const QPoint &pos) const { int xoffset = horizontalScrollBar()->value(); int x = xoffset + pos.x() - m_margin - m_labelWidth; @@ -508,19 +516,19 @@ int BinEditor::posAt(const QPoint &pos) const return qMin(m_size, qMin(m_numLines, topLine + line) * m_bytesPerLine) + column; } -bool BinEditor::inTextArea(const QPoint &pos) const +bool BinEditorWidget::inTextArea(const QPoint &pos) const { int xoffset = horizontalScrollBar()->value(); int x = xoffset + pos.x() - m_margin - m_labelWidth; return (x > m_bytesPerLine * m_columnWidth + m_charWidth/2); } -void BinEditor::updateLines() +void BinEditorWidget::updateLines() { updateLines(m_cursorPosition, m_cursorPosition); } -void BinEditor::updateLines(int fromPosition, int toPosition) +void BinEditorWidget::updateLines(int fromPosition, int toPosition) { int topLine = verticalScrollBar()->value(); int firstLine = qMin(fromPosition, toPosition) / m_bytesPerLine; @@ -531,7 +539,7 @@ void BinEditor::updateLines(int fromPosition, int toPosition) viewport()->update(0, y, viewport()->width(), h); } -int BinEditor::dataIndexOf(const QByteArray &pattern, int from, bool caseSensitive) const +int BinEditorWidget::dataIndexOf(const QByteArray &pattern, int from, bool caseSensitive) const { int trailing = pattern.size(); if (trailing > m_blockSize) @@ -564,7 +572,7 @@ int BinEditor::dataIndexOf(const QByteArray &pattern, int from, bool caseSensiti return end == m_size ? -1 : -2; } -int BinEditor::dataLastIndexOf(const QByteArray &pattern, int from, bool caseSensitive) const +int BinEditorWidget::dataLastIndexOf(const QByteArray &pattern, int from, bool caseSensitive) const { int trailing = pattern.size(); if (trailing > m_blockSize) @@ -596,7 +604,7 @@ int BinEditor::dataLastIndexOf(const QByteArray &pattern, int from, bool caseSen } -int BinEditor::find(const QByteArray &pattern_arg, int from, +int BinEditorWidget::find(const QByteArray &pattern_arg, int from, QTextDocument::FindFlags findFlags) { if (pattern_arg.isEmpty()) @@ -633,7 +641,7 @@ int BinEditor::find(const QByteArray &pattern_arg, int from, return pos; } -int BinEditor::findPattern(const QByteArray &data, const QByteArray &dataHex, +int BinEditorWidget::findPattern(const QByteArray &data, const QByteArray &dataHex, int from, int offset, int *match) { if (m_searchPattern.isEmpty()) @@ -658,7 +666,7 @@ int BinEditor::findPattern(const QByteArray &data, const QByteArray &dataHex, } -void BinEditor::drawItems(QPainter *painter, int x, int y, const QString &itemString) +void BinEditorWidget::drawItems(QPainter *painter, int x, int y, const QString &itemString) { if (m_isMonospacedFont) { painter->drawText(x, y, itemString); @@ -668,7 +676,7 @@ void BinEditor::drawItems(QPainter *painter, int x, int y, const QString &itemSt } } -void BinEditor::drawChanges(QPainter *painter, int x, int y, const char *changes) +void BinEditorWidget::drawChanges(QPainter *painter, int x, int y, const char *changes) { const QBrush red(QColor(250, 150, 150)); for (int i = 0; i < m_bytesPerLine; ++i) { @@ -679,7 +687,7 @@ void BinEditor::drawChanges(QPainter *painter, int x, int y, const char *changes } } -QString BinEditor::addressString(quint64 address) +QString BinEditorWidget::addressString(quint64 address) { QChar *addressStringData = m_addressString.data(); const char *hex = "0123456789abcdef"; @@ -698,7 +706,7 @@ QString BinEditor::addressString(quint64 address) return m_addressString; } -void BinEditor::paintEvent(QPaintEvent *e) +void BinEditorWidget::paintEvent(QPaintEvent *e) { QPainter painter(viewport()); const int topLine = verticalScrollBar()->value(); @@ -930,12 +938,12 @@ void BinEditor::paintEvent(QPaintEvent *e) } -int BinEditor::cursorPosition() const +int BinEditorWidget::cursorPosition() const { return m_cursorPosition; } -void BinEditor::setCursorPosition(int pos, MoveMode moveMode) +void BinEditorWidget::setCursorPosition(int pos, MoveMode moveMode) { pos = qMin(m_size-1, qMax(0, pos)); int oldCursorPosition = m_cursorPosition; @@ -957,7 +965,7 @@ void BinEditor::setCursorPosition(int pos, MoveMode moveMode) } -void BinEditor::ensureCursorVisible() +void BinEditorWidget::ensureCursorVisible() { QRect cr = cursorRect(); QRect vr = viewport()->rect(); @@ -969,7 +977,7 @@ void BinEditor::ensureCursorVisible() } } -void BinEditor::mousePressEvent(QMouseEvent *e) +void BinEditorWidget::mousePressEvent(QMouseEvent *e) { if (e->button() != Qt::LeftButton) return; @@ -982,7 +990,7 @@ void BinEditor::mousePressEvent(QMouseEvent *e) } } -void BinEditor::mouseMoveEvent(QMouseEvent *e) +void BinEditorWidget::mouseMoveEvent(QMouseEvent *e) { if (!(e->buttons() & Qt::LeftButton)) return; @@ -998,7 +1006,7 @@ void BinEditor::mouseMoveEvent(QMouseEvent *e) m_autoScrollTimer.start(100, this); } -void BinEditor::mouseReleaseEvent(QMouseEvent *) +void BinEditorWidget::mouseReleaseEvent(QMouseEvent *) { if (m_autoScrollTimer.isActive()) { m_autoScrollTimer.stop(); @@ -1006,13 +1014,13 @@ void BinEditor::mouseReleaseEvent(QMouseEvent *) } } -void BinEditor::selectAll() +void BinEditorWidget::selectAll() { setCursorPosition(0); setCursorPosition(m_size-1, KeepAnchor); } -void BinEditor::clear() +void BinEditorWidget::clear() { m_baseAddr = 0; m_data.clear(); @@ -1034,7 +1042,7 @@ void BinEditor::clear() viewport()->update(); } -bool BinEditor::event(QEvent *e) +bool BinEditorWidget::event(QEvent *e) { switch (e->type()) { case QEvent::KeyPress: @@ -1050,7 +1058,7 @@ bool BinEditor::event(QEvent *e) const QScrollBar * const scrollBar = verticalScrollBar(); const int maximum = scrollBar->maximum(); if (maximum && scrollBar->value() >= maximum - 1) { - emit newRangeRequested(editor(), baseAddress() + m_size); + emit newRangeRequested(baseAddress() + m_size); return true; } break; @@ -1075,7 +1083,7 @@ bool BinEditor::event(QEvent *e) return QAbstractScrollArea::event(e); } -QString BinEditor::toolTip(const QHelpEvent *helpEvent) const +QString BinEditorWidget::toolTip(const QHelpEvent *helpEvent) const { // Selection if mouse is in, else 1 byte at cursor int selStart = selectionStart(); @@ -1257,7 +1265,7 @@ QString BinEditor::toolTip(const QHelpEvent *helpEvent) const return msg; } -void BinEditor::keyPressEvent(QKeyEvent *e) +void BinEditorWidget::keyPressEvent(QKeyEvent *e) { if (e == QKeySequence::SelectAll) { @@ -1356,7 +1364,7 @@ void BinEditor::keyPressEvent(QKeyEvent *e) e->accept(); } -void BinEditor::zoomIn(int range) +void BinEditorWidget::zoomIn(int range) { QFont f = font(); const int newSize = f.pointSize() + range; @@ -1366,12 +1374,12 @@ void BinEditor::zoomIn(int range) setFont(f); } -void BinEditor::zoomOut(int range) +void BinEditorWidget::zoomOut(int range) { zoomIn(-range); } -void BinEditor::copy(bool raw) +void BinEditorWidget::copy(bool raw) { int selStart = selectionStart(); int selEnd = selectionEnd(); @@ -1400,7 +1408,7 @@ void BinEditor::copy(bool raw) QApplication::clipboard()->setText(hexString); } -void BinEditor::highlightSearchResults(const QByteArray &pattern, QTextDocument::FindFlags findFlags) +void BinEditorWidget::highlightSearchResults(const QByteArray &pattern, QTextDocument::FindFlags findFlags) { if (m_searchPattern == pattern) return; @@ -1412,7 +1420,7 @@ void BinEditor::highlightSearchResults(const QByteArray &pattern, QTextDocument: viewport()->update(); } -void BinEditor::changeData(int position, uchar character, bool highNibble) +void BinEditorWidget::changeData(int position, uchar character, bool highNibble) { if (!requestDataAt(position)) return; @@ -1444,7 +1452,7 @@ void BinEditor::changeData(int position, uchar character, bool highNibble) } -void BinEditor::undo() +void BinEditorWidget::undo() { if (m_undoStack.isEmpty()) return; @@ -1464,7 +1472,7 @@ void BinEditor::undo() emit redoAvailable(true); } -void BinEditor::redo() +void BinEditorWidget::redo() { if (m_redoStack.isEmpty()) return; @@ -1483,7 +1491,7 @@ void BinEditor::redo() emit redoAvailable(false); } -void BinEditor::contextMenuEvent(QContextMenuEvent *event) +void BinEditorWidget::contextMenuEvent(QContextMenuEvent *event) { const int selStart = selectionStart(); const int byteCount = selectionEnd() - selStart + 1; @@ -1545,7 +1553,7 @@ void BinEditor::contextMenuEvent(QContextMenuEvent *event) delete contextMenu; } -void BinEditor::setupJumpToMenuAction(QMenu *menu, QAction *actionHere, +void BinEditorWidget::setupJumpToMenuAction(QMenu *menu, QAction *actionHere, QAction *actionNew, quint64 addr) { actionHere->setText(tr("Jump to Address 0x%1 in This Window") @@ -1558,34 +1566,34 @@ void BinEditor::setupJumpToMenuAction(QMenu *menu, QAction *actionHere, actionNew->setEnabled(false); } -void BinEditor::jumpToAddress(quint64 address) +void BinEditorWidget::jumpToAddress(quint64 address) { if (address >= m_baseAddr && address < m_baseAddr + m_size) setCursorPosition(address - m_baseAddr); else - emit newRangeRequested(editor(), address); + emit newRangeRequested(address); } -void BinEditor::setNewWindowRequestAllowed(bool c) +void BinEditorWidget::setNewWindowRequestAllowed(bool c) { m_canRequestNewWindow = c; } -void BinEditor::updateContents() +void BinEditorWidget::updateContents() { m_oldData = m_data; m_data.clear(); setSizes(baseAddress() + cursorPosition(), m_size, m_blockSize); } -QPoint BinEditor::offsetToPos(int offset) const +QPoint BinEditorWidget::offsetToPos(int offset) const { const int x = m_labelWidth + (offset % m_bytesPerLine) * m_columnWidth; const int y = (offset / m_bytesPerLine - verticalScrollBar()->value()) * m_lineHeight; return QPoint(x, y); } -void BinEditor::asFloat(int offset, float &value, bool old) const +void BinEditorWidget::asFloat(int offset, float &value, bool old) const { value = 0; const QByteArray data = dataMid(offset, sizeof(float), old); @@ -1594,7 +1602,7 @@ void BinEditor::asFloat(int offset, float &value, bool old) const value = *f; } -void BinEditor::asDouble(int offset, double &value, bool old) const +void BinEditorWidget::asDouble(int offset, double &value, bool old) const { value = 0; const QByteArray data = dataMid(offset, sizeof(double), old); @@ -1603,7 +1611,7 @@ void BinEditor::asDouble(int offset, double &value, bool old) const value = *f; } -void BinEditor::asIntegers(int offset, int count, quint64 &bigEndianValue, +void BinEditorWidget::asIntegers(int offset, int count, quint64 &bigEndianValue, quint64 &littleEndianValue, bool old) const { bigEndianValue = littleEndianValue = 0; @@ -1615,12 +1623,12 @@ void BinEditor::asIntegers(int offset, int count, quint64 &bigEndianValue, } } -bool BinEditor::isMemoryView() const +bool BinEditorWidget::isMemoryView() const { return editor()->property("MemoryView").toBool(); } -void BinEditor::setMarkup(const QList<Markup> &markup) +void BinEditorWidget::setMarkup(const QList<Markup> &markup) { m_markup = markup; viewport()->update(); diff --git a/src/plugins/bineditor/bineditor.h b/src/plugins/bineditor/bineditor.h index 9242a5b00f96b5d92b112eefe571014a59bf3d26..81b4b330453f435cafbad7209351dd910c9ab5a6 100644 --- a/src/plugins/bineditor/bineditor.h +++ b/src/plugins/bineditor/bineditor.h @@ -55,16 +55,17 @@ class FontSettings; namespace BINEditor { -class BinEditor : public QAbstractScrollArea +class BinEditorWidget : public QAbstractScrollArea { Q_OBJECT Q_PROPERTY(bool modified READ isModified WRITE setModified DESIGNABLE false) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly DESIGNABLE false) Q_PROPERTY(QList<BINEditor::Markup> markup READ markup WRITE setMarkup DESIGNABLE false) Q_PROPERTY(bool newWindowRequestAllowed READ newWindowRequestAllowed WRITE setNewWindowRequestAllowed DESIGNABLE false) + public: - BinEditor(QWidget *parent = 0); - ~BinEditor(); + BinEditorWidget(QWidget *parent = 0); + ~BinEditorWidget(); quint64 baseAddress() const { return m_baseAddr; } @@ -138,11 +139,11 @@ Q_SIGNALS: void redoAvailable(bool); void cursorPositionChanged(int position); - void dataRequested(Core::IEditor *editor, quint64 block); + void dataRequested(quint64 block); void newWindowRequested(quint64 address); - void newRangeRequested(Core::IEditor *, quint64 address); + void newRangeRequested(quint64 address); void addWatchpointRequested(quint64 address, uint size); - void dataChanged(Core::IEditor *, quint64 address, const QByteArray &data); + void dataChanged(quint64 address, const QByteArray &data); protected: void scrollContentsBy(int dx, int dy); diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index f6e401dae7ea10102df98db742f33d206ead75e5..dbfd7e219e476b18651239ca0b9e29a71675e81e 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -58,8 +58,6 @@ #include <coreplugin/mimedatabase.h> #include <extensionsystem/pluginmanager.h> #include <find/ifindsupport.h> -#include <texteditor/fontsettings.h> -#include <texteditor/texteditorsettings.h> #include <utils/reloadpromptutils.h> #include <utils/qtcassert.h> @@ -70,15 +68,18 @@ using namespace BINEditor::Internal; class BinEditorFind : public Find::IFindSupport { Q_OBJECT + public: - BinEditorFind(BinEditor *editor) + BinEditorFind(BinEditorWidget *widget) { - m_editor = editor; + m_widget = widget; m_incrementalStartPos = m_contPos = -1; } - ~BinEditorFind() {} bool supportsReplace() const { return false; } + QString currentFindString() const { return QString(); } + QString completedFindString() const { return QString(); } + Find::FindFlags supportedFindFlags() const { return Find::FindBackward | Find::FindCaseSensitively; @@ -91,21 +92,22 @@ public: virtual void highlightAll(const QString &txt, Find::FindFlags findFlags) { - m_editor->highlightSearchResults(txt.toLatin1(), Find::textDocumentFlagsForFindFlags(findFlags)); + m_widget->highlightSearchResults(txt.toLatin1(), Find::textDocumentFlagsForFindFlags(findFlags)); } - void clearResults() { m_editor->highlightSearchResults(QByteArray()); } - QString currentFindString() const { return QString(); } - QString completedFindString() const { return QString(); } - + void clearResults() + { + m_widget->highlightSearchResults(QByteArray()); + } - int find(const QByteArray &pattern, int pos, Find::FindFlags findFlags) { + int find(const QByteArray &pattern, int pos, Find::FindFlags findFlags) + { if (pattern.isEmpty()) { - m_editor->setCursorPosition(pos); + m_widget->setCursorPosition(pos); return pos; } - return m_editor->find(pattern, pos, Find::textDocumentFlagsForFindFlags(findFlags)); + return m_widget->find(pattern, pos, Find::textDocumentFlagsForFindFlags(findFlags)); } Result findIncremental(const QString &txt, Find::FindFlags findFlags) { @@ -114,25 +116,25 @@ public: resetIncrementalSearch(); // Because we don't search for nibbles. m_lastPattern = pattern; if (m_incrementalStartPos < 0) - m_incrementalStartPos = m_editor->selectionStart(); + m_incrementalStartPos = m_widget->selectionStart(); if (m_contPos == -1) m_contPos = m_incrementalStartPos; int found = find(pattern, m_contPos, findFlags); Result result; if (found >= 0) { result = Found; - m_editor->highlightSearchResults(pattern, Find::textDocumentFlagsForFindFlags(findFlags)); + m_widget->highlightSearchResults(pattern, Find::textDocumentFlagsForFindFlags(findFlags)); m_contPos = -1; } else { if (found == -2) { result = NotYetFound; m_contPos += findFlags & Find::FindBackward - ? -BinEditor::SearchStride : BinEditor::SearchStride; + ? -BinEditorWidget::SearchStride : BinEditorWidget::SearchStride; } else { result = NotFound; m_contPos = -1; - m_editor->highlightSearchResults(QByteArray(), 0); + m_widget->highlightSearchResults(QByteArray(), 0); } } return result; @@ -142,9 +144,9 @@ public: QByteArray pattern = txt.toLatin1(); bool wasReset = (m_incrementalStartPos < 0); if (m_contPos == -1) { - m_contPos = m_editor->cursorPosition(); + m_contPos = m_widget->cursorPosition(); if (findFlags & Find::FindBackward) - m_contPos = m_editor->selectionStart()-1; + m_contPos = m_widget->selectionStart()-1; } int found = find(pattern, m_contPos, findFlags); Result result; @@ -153,11 +155,11 @@ public: m_incrementalStartPos = found; m_contPos = -1; if (wasReset) - m_editor->highlightSearchResults(pattern, Find::textDocumentFlagsForFindFlags(findFlags)); + m_widget->highlightSearchResults(pattern, Find::textDocumentFlagsForFindFlags(findFlags)); } else if (found == -2) { result = NotYetFound; m_contPos += findFlags & Find::FindBackward - ? -BinEditor::SearchStride : BinEditor::SearchStride; + ? -BinEditorWidget::SearchStride : BinEditorWidget::SearchStride; } else { result = NotFound; m_contPos = -1; @@ -167,7 +169,7 @@ public: } private: - BinEditor *m_editor; + BinEditorWidget *m_widget; int m_incrementalStartPos; int m_contPos; // Only valid if last result was NotYetFound. QByteArray m_lastPattern; @@ -178,14 +180,14 @@ class BinEditorDocument : public Core::IDocument { Q_OBJECT public: - BinEditorDocument(BinEditor *parent) : + BinEditorDocument(BinEditorWidget *parent) : Core::IDocument(parent) { - m_editor = parent; - connect(m_editor, SIGNAL(dataRequested(Core::IEditor*,quint64)), - this, SLOT(provideData(Core::IEditor*,quint64))); - connect(m_editor, SIGNAL(newRangeRequested(Core::IEditor*,quint64)), - this, SLOT(provideNewRange(Core::IEditor*,quint64))); + m_widget = parent; + connect(m_widget, SIGNAL(dataRequested(quint64)), + this, SLOT(provideData(quint64))); + connect(m_widget, SIGNAL(newRangeRequested(quint64)), + this, SLOT(provideNewRange(quint64))); } ~BinEditorDocument() {} @@ -198,9 +200,9 @@ public: QTC_ASSERT(!autoSave, return true); // bineditor does not support autosave - it would be a bit expensive const QString fileNameToUse = fileName.isEmpty() ? m_fileName : fileName; - if (m_editor->save(errorString, m_fileName, fileNameToUse)) { + if (m_widget->save(errorString, m_fileName, fileNameToUse)) { m_fileName = fileNameToUse; - m_editor->editor()->setDisplayName(QFileInfo(fileNameToUse).fileName()); + m_widget->editor()->setDisplayName(QFileInfo(fileNameToUse).fileName()); emit changed(); return true; } else { @@ -210,7 +212,7 @@ public: void rename(const QString &newName) { m_fileName = newName; - m_editor->editor()->setDisplayName(QFileInfo(fileName()).fileName()); + m_widget->editor()->setDisplayName(QFileInfo(fileName()).fileName()); emit changed(); } @@ -230,8 +232,8 @@ public: if (file.open(QIODevice::ReadOnly)) { file.close(); m_fileName = fileName; - m_editor->setSizes(offset, file.size()); - m_editor->editor()->setDisplayName(QFileInfo(fileName).fileName()); + m_widget->setSizes(offset, file.size()); + m_widget->editor()->setDisplayName(QFileInfo(fileName).fileName()); return true; } QString errStr = tr("Cannot open %1: %2").arg( @@ -244,19 +246,20 @@ public: } private slots: - void provideData(Core::IEditor *, quint64 block) { + void provideData(quint64 block) + { if (m_fileName.isEmpty()) return; QFile file(m_fileName); if (file.open(QIODevice::ReadOnly)) { - int blockSize = m_editor->dataBlockSize(); + int blockSize = m_widget->dataBlockSize(); file.seek(block * blockSize); QByteArray data = file.read(blockSize); file.close(); const int dataSize = data.size(); if (dataSize != blockSize) data += QByteArray(blockSize - dataSize, 0); - m_editor->addData(block, data); + m_widget->addData(block, data); } else { QMessageBox::critical(Core::ICore::mainWindow(), tr("File Error"), tr("Cannot open %1: %2").arg( @@ -264,7 +267,8 @@ private slots: } } - void provideNewRange(Core::IEditor *, quint64 offset) { + void provideNewRange(quint64 offset) + { open(0, m_fileName, offset); } @@ -280,10 +284,10 @@ public: QString suggestedFileName() const { return QString(); } - bool isModified() const { return m_editor->isMemoryView() ? false : m_editor->isModified(); } + bool isModified() const { return m_widget->isMemoryView() ? false : m_widget->isModified(); } bool isFileReadOnly() const { - if (m_editor->isMemoryView() || m_fileName.isEmpty()) + if (m_widget->isMemoryView() || m_fileName.isEmpty()) return false; const QFileInfo fi(m_fileName); return !fi.isWritable(); @@ -306,19 +310,19 @@ public: } private: - BinEditor *m_editor; + BinEditorWidget *m_widget; QString m_fileName; }; -class BinEditorInterface : public Core::IEditor +class BinEditor : public Core::IEditor { Q_OBJECT public: - BinEditorInterface(BinEditor *editor) + BinEditor(BinEditorWidget *widget) { - setWidget(editor); - m_editor = editor; - m_file = new BinEditorDocument(m_editor); + setWidget(widget); + m_widget = widget; + m_file = new BinEditorDocument(m_widget); m_context.add(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID); m_context.add(Constants::C_BINEDITOR); m_addressEdit = new QLineEdit; @@ -339,19 +343,21 @@ public: m_toolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); m_toolBar->addWidget(w); - connect(m_editor, SIGNAL(cursorPositionChanged(int)), this, - SLOT(updateCursorPosition(int))); - connect(m_file, SIGNAL(changed()), this, SIGNAL(changed())); - connect(m_addressEdit, SIGNAL(editingFinished()), this, - SLOT(jumpToAddress())); - updateCursorPosition(m_editor->cursorPosition()); + widget->setEditor(this); + + connect(m_widget, SIGNAL(cursorPositionChanged(int)), SLOT(updateCursorPosition(int))); + connect(m_file, SIGNAL(changed()), SIGNAL(changed())); + connect(m_addressEdit, SIGNAL(editingFinished()), SLOT(jumpToAddress())); + connect(m_widget, SIGNAL(modificationChanged(bool)), SIGNAL(changed())); + updateCursorPosition(m_widget->cursorPosition()); } - ~BinEditorInterface() { - delete m_editor; + + ~BinEditor() { + delete m_widget; } bool createNew(const QString & /* contents */ = QString()) { - m_editor->clear(); + m_widget->clear(); m_file->setFilename(QString()); return true; } @@ -366,20 +372,20 @@ public: QWidget *toolBar() { return m_toolBar; } - bool isTemporary() const { return m_editor->isMemoryView(); } + bool isTemporary() const { return m_widget->isMemoryView(); } private slots: void updateCursorPosition(int position) { - m_addressEdit->setText(QString::number(m_editor->baseAddress() + position, 16)); + m_addressEdit->setText(QString::number(m_widget->baseAddress() + position, 16)); } void jumpToAddress() { - m_editor->jumpToAddress(m_addressEdit->text().toULongLong(0, 16)); - updateCursorPosition(m_editor->cursorPosition()); + m_widget->jumpToAddress(m_addressEdit->text().toULongLong(0, 16)); + updateCursorPosition(m_widget->cursorPosition()); } private: - BinEditor *m_editor; + BinEditorWidget *m_widget; QString m_displayName; BinEditorDocument *m_file; QToolBar *m_toolBar; @@ -408,9 +414,11 @@ QString BinEditorFactory::displayName() const Core::IEditor *BinEditorFactory::createEditor(QWidget *parent) { - BinEditor *editor = new BinEditor(parent); - m_owner->initializeEditor(editor); - return editor->editor(); + BinEditorWidget *widget = new BinEditorWidget(parent); + BinEditor *editor = new BinEditor(widget); + + m_owner->initializeEditor(widget); + return editor; } QStringList BinEditorFactory::mimeTypes() const @@ -433,7 +441,7 @@ BinEditorWidgetFactory::BinEditorWidgetFactory(QObject *parent) : QWidget *BinEditorWidgetFactory::createWidget(QWidget *parent) { - return new BinEditor(parent); + return new BinEditorWidget(parent); } ///////////////////////////////// BinEditorPlugin ////////////////////////////////// @@ -467,12 +475,8 @@ QAction *BinEditorPlugin::registerNewAction(Core::Id id, return rc; } -void BinEditorPlugin::initializeEditor(BinEditor *editor) +void BinEditorPlugin::initializeEditor(BinEditorWidget *widget) { - BinEditorInterface *editorInterface = new BinEditorInterface(editor); - QObject::connect(editor, SIGNAL(modificationChanged(bool)), editorInterface, SIGNAL(changed())); - editor->setEditor(editorInterface); - m_context.add(Constants::C_BINEDITOR); if (!m_undoAction) { m_undoAction = registerNewAction(Core::Constants::UNDO, this, SLOT(undoAction()), tr("&Undo")); @@ -481,19 +485,13 @@ void BinEditorPlugin::initializeEditor(BinEditor *editor) m_selectAllAction = registerNewAction(Core::Constants::SELECTALL, this, SLOT(selectAllAction())); } - // Font settings - TextEditor::TextEditorSettings *settings = TextEditor::TextEditorSettings::instance(); - editor->setFontSettings(settings->fontSettings()); - connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)), - editor, SLOT(setFontSettings(TextEditor::FontSettings))); - - QObject::connect(editor, SIGNAL(undoAvailable(bool)), this, SLOT(updateActions())); - QObject::connect(editor, SIGNAL(redoAvailable(bool)), this, SLOT(updateActions())); + QObject::connect(widget, SIGNAL(undoAvailable(bool)), this, SLOT(updateActions())); + QObject::connect(widget, SIGNAL(redoAvailable(bool)), this, SLOT(updateActions())); Aggregation::Aggregate *aggregate = new Aggregation::Aggregate; - BinEditorFind *binEditorFind = new BinEditorFind(editor); + BinEditorFind *binEditorFind = new BinEditorFind(widget); aggregate->add(binEditorFind); - aggregate->add(editor); + aggregate->add(widget); } bool BinEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage) @@ -515,9 +513,9 @@ void BinEditorPlugin::extensionsInitialized() void BinEditorPlugin::updateCurrentEditor(Core::IEditor *editor) { - BinEditor *binEditor = 0; + BinEditorWidget *binEditor = 0; if (editor) - binEditor = qobject_cast<BinEditor *>(editor->widget()); + binEditor = qobject_cast<BinEditorWidget *>(editor->widget()); if (m_currentEditor == binEditor) return; m_currentEditor = binEditor; diff --git a/src/plugins/bineditor/bineditorplugin.h b/src/plugins/bineditor/bineditorplugin.h index 7c383d2ff75153e2efc5ee882735b053f6abbbce..0adf0f62b43c7d5230dd2656f1afa1cb9bcfde1a 100644 --- a/src/plugins/bineditor/bineditorplugin.h +++ b/src/plugins/bineditor/bineditorplugin.h @@ -40,7 +40,7 @@ #include <QAction> namespace BINEditor { -class BinEditor; +class BinEditorWidget; class BinEditorWidgetFactory : public QObject { @@ -67,7 +67,7 @@ public: void extensionsInitialized(); // Connect editor to settings changed signals. - void initializeEditor(BinEditor *editor); + void initializeEditor(BinEditorWidget *editor); private slots: void undoAction(); @@ -92,7 +92,7 @@ private: Core::IEditor *createEditor(QWidget *parent); BinEditorFactory *m_factory; - QPointer<BinEditor> m_currentEditor; + QPointer<BinEditorWidget> m_currentEditor; }; class BinEditorFactory : public Core::IEditorFactory diff --git a/src/plugins/classview/classviewnavigationwidgetfactory.cpp b/src/plugins/classview/classviewnavigationwidgetfactory.cpp index bc3664b9a54b4cafbf883b928e26b240fcf1e7ad..b85a9213c6337ef69dccece5a10b21c85d03557d 100644 --- a/src/plugins/classview/classviewnavigationwidgetfactory.cpp +++ b/src/plugins/classview/classviewnavigationwidgetfactory.cpp @@ -123,14 +123,11 @@ void NavigationWidgetFactory::saveSettings(int position, QWidget *widget) NavigationWidget *pw = qobject_cast<NavigationWidget *>(widget); QTC_ASSERT(pw, return); - QSettings *settings = Core::ICore::settings(); - QTC_ASSERT(settings, return); - // .beginGroup is not used - to prevent simultaneous access QString group = settingsPrefix(position); - // save settings - settings->setValue(group, pw->flatMode()); + // Save settings + Core::ICore::settings()->setValue(group, pw->flatMode()); } void NavigationWidgetFactory::restoreSettings(int position, QWidget *widget) @@ -138,14 +135,11 @@ void NavigationWidgetFactory::restoreSettings(int position, QWidget *widget) NavigationWidget *pw = qobject_cast<NavigationWidget *>(widget); QTC_ASSERT(pw, return); - QSettings *settings = Core::ICore::settings(); - QTC_ASSERT(settings, return); - // .beginGroup is not used - to prevent simultaneous access QString group = settingsPrefix(position); - // load settings - pw->setFlatMode(settings->value(group, false).toBool()); + // Load settings + pw->setFlatMode(Core::ICore::settings()->value(group, false).toBool()); } } // namespace Internal diff --git a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp index e86b2b6b57b2f071de5968a024b76cab6e899c10..66d86e973ae51d95ed88cef0cd348dda730cbd50 100644 --- a/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp +++ b/src/plugins/coreplugin/dialogs/readonlyfilesdialog.cpp @@ -248,7 +248,7 @@ int ReadOnlyFilesDialog::exec() if (QDialog::exec() != QDialog::Accepted) return RO_Cancel; - ReadOnlyResult result; + ReadOnlyResult result = RO_Cancel; QStringList failedToMakeWritable; foreach (ReadOnlyFilesDialogPrivate::ButtonGroupForFile buttengroup, d->buttonGroups) { result = static_cast<ReadOnlyResult>(buttengroup.group->checkedId()); @@ -313,7 +313,7 @@ void ReadOnlyFilesDialog::setAll(int index) return; // Get the selected type from the select all combo box. - ReadOnlyFilesTreeColumn type; + ReadOnlyFilesTreeColumn type = NumberOfColumns; if (index == d->setAllIndexForOperation[MakeWritable]) type = MakeWritable; else if (index == d->setAllIndexForOperation[OpenWithVCS]) diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 2fba5d0ed3f969aa03b5fe63070628f631dc47c8..ead28c556a4a3578cf2d84c5d0d73d96b9ebf8c3 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -107,14 +107,12 @@ QWidget *GeneralSettings::createPage(QWidget *parent) m_widget = new QWidget(parent); m_page->setupUi(m_widget); - QSettings *settings = Core::ICore::settings(); - Q_UNUSED(settings) // Windows - fillLanguageBox(); m_page->colorButton->setColor(StyleHelper::requestedBaseColor()); m_page->reloadBehavior->setCurrentIndex(EditorManager::instance()->reloadSetting()); if (HostOsInfo::isAnyUnixHost()) { + QSettings *settings = Core::ICore::settings(); const QStringList availableTerminals = ConsoleProcess::availableTerminalEmulators(); const QString currentTerminal = ConsoleProcess::terminalEmulator(settings, false); const QString currentTerminalExplicit = ConsoleProcess::terminalEmulator(settings, true); @@ -128,6 +126,7 @@ QWidget *GeneralSettings::createPage(QWidget *parent) } if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()) { + QSettings *settings = Core::ICore::settings(); m_page->externalFileBrowserEdit->setText(UnixUtils::fileBrowser(settings)); } else { m_page->externalFileBrowserLabel->hide(); diff --git a/src/plugins/cpaster/codepastersettings.cpp b/src/plugins/cpaster/codepastersettings.cpp index 63ff59648db248477585a3474528ce9994474008..4f2e4558e60eb2e09c2ac5a55830036a7a0a6ce6 100644 --- a/src/plugins/cpaster/codepastersettings.cpp +++ b/src/plugins/cpaster/codepastersettings.cpp @@ -52,11 +52,8 @@ CodePasterSettingsPage::CodePasterSettingsPage() setDisplayCategory(QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY)); - m_settings = Core::ICore::settings(); - if (m_settings) { - const QString keyRoot = QLatin1String(settingsGroupC) + QLatin1Char('/'); - m_host = m_settings->value(keyRoot + QLatin1String(serverKeyC), QString()).toString(); - } + const QString keyRoot = QLatin1String(settingsGroupC) + QLatin1Char('/'); + m_host = Core::ICore::settings()->value(keyRoot + QLatin1String(serverKeyC), QString()).toString(); } QWidget *CodePasterSettingsPage::createPage(QWidget *parent) @@ -83,12 +80,11 @@ QWidget *CodePasterSettingsPage::createPage(QWidget *parent) void CodePasterSettingsPage::apply() { - if (!m_settings) - return; - - m_settings->beginGroup(QLatin1String(settingsGroupC)); - m_settings->setValue(QLatin1String(serverKeyC), m_host); - m_settings->endGroup(); + QSettings *settings = Core::ICore::settings(); + const QString keyRoot = QLatin1String(settingsGroupC) + QLatin1Char('/'); + settings->beginGroup(QLatin1String(settingsGroupC)); + settings->setValue(QLatin1String(serverKeyC), m_host); + settings->endGroup(); } void CodePasterSettingsPage::serverChanged(const QString &host) diff --git a/src/plugins/cpaster/codepastersettings.h b/src/plugins/cpaster/codepastersettings.h index 22f342b61deedf5cafa53eae1eab3f9c06b4adb7..ebc58d45ab9e74a33efa8596cf173b846f769233 100644 --- a/src/plugins/cpaster/codepastersettings.h +++ b/src/plugins/cpaster/codepastersettings.h @@ -55,7 +55,6 @@ public slots: void serverChanged(const QString &host); private: - QSettings *m_settings; QString m_host; }; diff --git a/src/plugins/cpptools/cppcodestylesettingspage.cpp b/src/plugins/cpptools/cppcodestylesettingspage.cpp index 820332135587f30adb27b9b51cda94f30eab59b4..01a0589eb5e5facb2fe4834f159c4ec48509d36a 100644 --- a/src/plugins/cpptools/cppcodestylesettingspage.cpp +++ b/src/plugins/cpptools/cppcodestylesettingspage.cpp @@ -590,18 +590,15 @@ void CppCodeStyleSettingsPage::apply() CppCodeStylePreferences *originalCppCodeStylePreferences = CppToolsSettings::instance()->cppCodeStyle(); if (originalCppCodeStylePreferences->codeStyleSettings() != m_pageCppCodeStylePreferences->codeStyleSettings()) { originalCppCodeStylePreferences->setCodeStyleSettings(m_pageCppCodeStylePreferences->codeStyleSettings()); - if (s) - originalCppCodeStylePreferences->toSettings(QLatin1String(CppTools::Constants::CPP_SETTINGS_ID), s); + originalCppCodeStylePreferences->toSettings(QLatin1String(CppTools::Constants::CPP_SETTINGS_ID), s); } if (originalCppCodeStylePreferences->tabSettings() != m_pageCppCodeStylePreferences->tabSettings()) { originalCppCodeStylePreferences->setTabSettings(m_pageCppCodeStylePreferences->tabSettings()); - if (s) - originalCppCodeStylePreferences->toSettings(QLatin1String(CppTools::Constants::CPP_SETTINGS_ID), s); + originalCppCodeStylePreferences->toSettings(QLatin1String(CppTools::Constants::CPP_SETTINGS_ID), s); } if (originalCppCodeStylePreferences->currentDelegate() != m_pageCppCodeStylePreferences->currentDelegate()) { originalCppCodeStylePreferences->setCurrentDelegate(m_pageCppCodeStylePreferences->currentDelegate()); - if (s) - originalCppCodeStylePreferences->toSettings(QLatin1String(CppTools::Constants::CPP_SETTINGS_ID), s); + originalCppCodeStylePreferences->toSettings(QLatin1String(CppTools::Constants::CPP_SETTINGS_ID), s); } } } diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.cpp b/src/plugins/cpptools/cppmodelmanagerinterface.cpp index 0de4f6e425a38c09532efa1fca63ae9fd950a7fc..c6b535d98d94a8bb71d7c811bd63cc4986d49ff6 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.cpp +++ b/src/plugins/cpptools/cppmodelmanagerinterface.cpp @@ -79,25 +79,25 @@ void ProjectPart::evaluateToolchain(const ToolChain *tc, ToolChain::CompilerFlags c = (cxxflags == cflags) ? cxx : tc->compilerFlags(cflags); - if (c | ToolChain::StandardC11) + if (c & ToolChain::StandardC11) cVersion = C11; - else if (c | ToolChain::StandardC99) + else if (c & ToolChain::StandardC99) cVersion = C99; else cVersion = C89; - if (cxx | ToolChain::StandardCxx11) + if (cxx & ToolChain::StandardCxx11) cxxVersion = CXX11; else cxxVersion = CXX98; - if (cxx | ToolChain::BorlandExtensions) + if (cxx & ToolChain::BorlandExtensions) cxxExtensions |= BorlandExtensions; - if (cxx | ToolChain::GnuExtensions) + if (cxx & ToolChain::GnuExtensions) cxxExtensions |= GnuExtensions; - if (cxx | ToolChain::MicrosoftExtensions) + if (cxx & ToolChain::MicrosoftExtensions) cxxExtensions |= MicrosoftExtensions; - if (cxx | ToolChain::OpenMP) + if (cxx & ToolChain::OpenMP) cxxExtensions |= OpenMP; cWarningFlags = tc->warningFlags(cflags); diff --git a/src/plugins/cpptools/cpptoolssettings.cpp b/src/plugins/cpptools/cpptoolssettings.cpp index 605487ffcba8d44f6667e13a75b976805affd267..2f034bac91d78805da9d7e376b288184611d680f 100644 --- a/src/plugins/cpptools/cpptoolssettings.cpp +++ b/src/plugins/cpptools/cpptoolssettings.cpp @@ -172,7 +172,7 @@ CppToolsSettings::CppToolsSettings(QObject *parent) // load global settings (after built-in settings are added to the pool) QSettings *s = Core::ICore::settings(); - d->m_globalCodeStyle->fromSettings(QLatin1String(CppTools::Constants::CPP_SETTINGS_ID), Core::ICore::settings()); + d->m_globalCodeStyle->fromSettings(QLatin1String(CppTools::Constants::CPP_SETTINGS_ID), s); // legacy handling start (Qt Creator Version < 2.4) const bool legacyTransformed = diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 00454c6089f3a78f424ad555fabd49af0686b097..b3cadb5e17388e18931cf9c024921ff411fa18cb 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -233,8 +233,7 @@ bool CvsPlugin::initialize(const QStringList &arguments, QString *errorMessage) if (!ICore::mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.cvs/CVS.mimetypes.xml"), errorMessage)) return false; - if (QSettings *settings = ICore::settings()) - m_settings.fromSettings(settings); + m_settings.fromSettings(ICore::settings()); addAutoReleasedObject(new SettingsPage); @@ -1299,8 +1298,7 @@ void CvsPlugin::setSettings(const CvsSettings &s) { if (s != m_settings) { m_settings = s; - if (QSettings *settings = ICore::settings()) - m_settings.toSettings(settings); + m_settings.toSettings(ICore::settings()); cvsVersionControl()->emitConfigurationChanged(); } } diff --git a/src/plugins/debugger/cdb/cdboptionspage.cpp b/src/plugins/debugger/cdb/cdboptionspage.cpp index 2b25ede46ba6dc008e8634c9cd1aef1e6a2c94e3..648a4cd746c0b8ae551c6021bc7ef28b240fb9d6 100644 --- a/src/plugins/debugger/cdb/cdboptionspage.cpp +++ b/src/plugins/debugger/cdb/cdboptionspage.cpp @@ -261,6 +261,7 @@ bool CdbOptionsPage::matches(const QString &s) const class CdbPathsPageWidget : public QWidget { + Q_OBJECT public: Utils::SavedActionSet group; @@ -346,3 +347,5 @@ bool CdbPathsPage::matches(const QString &searchKeyWord) const } // namespace Internal } // namespace Debugger + +#include "cdboptionspage.moc" diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index aa8d22e74d020fa03fd675b3556ecb8c4220eb4e..5e7f8059267576ebde3f4a18901648ca355f4638 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -552,8 +552,6 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode) void DebuggerMainWindow::writeSettings() const { QSettings *settings = ICore::settings(); - QTC_ASSERT(settings, return); - settings->beginGroup(QLatin1String("DebugMode.CppMode")); QHashIterator<QString, QVariant> it(d->m_dockWidgetActiveStateCpp); while (it.hasNext()) { @@ -574,8 +572,6 @@ void DebuggerMainWindow::writeSettings() const void DebuggerMainWindow::readSettings() { QSettings *settings = ICore::settings(); - QTC_ASSERT(settings, return); - d->m_dockWidgetActiveStateCpp.clear(); d->m_dockWidgetActiveStateQmlCpp.clear(); diff --git a/src/plugins/debugger/lldb/lldbengine.cpp b/src/plugins/debugger/lldb/lldbengine.cpp index 119382b8781d9e67e41d272d208667c9f19472a3..2b3af11a48425e560904cee864e4965b841df86a 100644 --- a/src/plugins/debugger/lldb/lldbengine.cpp +++ b/src/plugins/debugger/lldb/lldbengine.cpp @@ -84,6 +84,17 @@ LldbEngine::LldbEngine(const DebuggerStartParameters &startParameters) m_lastAgentId = 0; m_lastToken = 0; setObjectName(QLatin1String("LldbEngine")); + + connect(debuggerCore()->action(AutoDerefPointers), SIGNAL(valueChanged(QVariant)), + SLOT(updateLocals())); + connect(debuggerCore()->action(CreateFullBacktrace), SIGNAL(triggered()), + SLOT(updateAll())); + connect(debuggerCore()->action(UseDebuggingHelpers), SIGNAL(valueChanged(QVariant)), + SLOT(updateLocals())); + connect(debuggerCore()->action(UseDynamicType), SIGNAL(valueChanged(QVariant)), + SLOT(updateLocals())); + connect(debuggerCore()->action(IntelFlavor), SIGNAL(valueChanged(QVariant)), + SLOT(updateAll())); } LldbEngine::~LldbEngine() @@ -108,7 +119,7 @@ void LldbEngine::runCommand(const Command &command) void LldbEngine::shutdownInferior() { QTC_ASSERT(state() == InferiorShutdownRequested, qDebug() << state()); - notifyInferiorShutdownOk(); + runCommand(Command("shutdownInferior")); } void LldbEngine::shutdownEngine() @@ -249,6 +260,8 @@ void LldbEngine::handleResponse(const QByteArray &response) refreshSymbols(item); else if (name == "bkpts") refreshBreakpoints(item); + else if (name == "output") + refreshOutput(item); else if (name == "disassembly") refreshDisassembly(item); else if (name == "memory") @@ -483,6 +496,18 @@ void LldbEngine::refreshMemory(const GdbMi &data) } } +void LldbEngine::refreshOutput(const GdbMi &output) +{ + QByteArray channel = output["channel"].data(); + QByteArray data = QByteArray::fromHex(output["data"].data()); + LogChannel ch = AppStuff; + if (channel == "stdout") + ch = AppOutput; + else if (channel == "stderr") + ch = AppError; + showMessage(QString::fromUtf8(data), ch); +} + void LldbEngine::refreshBreakpoints(const GdbMi &bkpts) { BreakHandler *handler = breakHandler(); @@ -640,6 +665,10 @@ bool LldbEngine::setToolTipExpression(const QPoint &mousePos, return false; } +void LldbEngine::updateAll() +{ + updateLocals(); +} ////////////////////////////////////////////////////////////////////// // @@ -663,6 +692,11 @@ void LldbEngine::updateWatchData(const WatchData &data, const WatchUpdateFlags & { Q_UNUSED(data); Q_UNUSED(flags); + updateLocals(); +} + +void LldbEngine::updateLocals() +{ WatchHandler *handler = watchHandler(); Command cmd("updateData"); @@ -787,7 +821,7 @@ void LldbEngine::readLldbStandardError() qDebug() << "\nLLDB STDERR" << err; //qWarning() << "Unexpected lldb stderr:" << err; showMessage(_("Lldb stderr: " + err)); - //handleOutput(err); + m_lldbProc.kill(); } void LldbEngine::readLldbStandardOutput() @@ -859,11 +893,6 @@ QByteArray LldbEngine::currentOptions() const return result; } -void LldbEngine::updateAll() -{ - runCommand("reportData"); -} - void LldbEngine::refreshLocals(const GdbMi &vars) { //const bool partial = response.cookie.toBool(); @@ -985,8 +1014,20 @@ void LldbEngine::refreshState(const GdbMi &reportedState) notifyInferiorSpontaneousStop(); else if (newState == "inferiorsetupok") notifyInferiorSetupOk(); - else if (newState == "enginerunok") + else if (newState == "enginerunandinferiorrunok") notifyEngineRunAndInferiorRunOk(); + else if (newState == "enginerunandinferiorstopok") + notifyEngineRunAndInferiorStopOk(); + else if (newState == "inferiorshutdownok") + notifyInferiorShutdownOk(); + else if (newState == "inferiorshutdownfailed") + notifyInferiorShutdownFailed(); + else if (newState == "engineshutdownok") + notifyEngineShutdownOk(); + else if (newState == "engineshutdownfailed") + notifyEngineShutdownFailed(); + else if (newState == "inferiorexited") + notifyInferiorExited(); } void LldbEngine::refreshLocation(const GdbMi &reportedLocation) diff --git a/src/plugins/debugger/lldb/lldbengine.h b/src/plugins/debugger/lldb/lldbengine.h index 818ee91ca6411cbbd5dd5b0d0d96ef174d8c7a57..fe44c1940ad68dac5d0dd4d412f025f1a289956d 100644 --- a/src/plugins/debugger/lldb/lldbengine.h +++ b/src/plugins/debugger/lldb/lldbengine.h @@ -153,21 +153,22 @@ private: Q_SLOT void readLldbStandardError(); Q_SLOT void handleResponse(const QByteArray &data); Q_SLOT void runEngine2(); + Q_SLOT void updateAll(); + Q_SLOT void updateLocals(); void refreshAll(const GdbMi &all); void refreshThreads(const GdbMi &threads); void refreshStack(const GdbMi &stack); - void refreshRegisters(const GdbMi &stack); + void refreshRegisters(const GdbMi ®isters); void refreshLocals(const GdbMi &vars); void refreshTypeInfo(const GdbMi &typeInfo); void refreshState(const GdbMi &state); void refreshLocation(const GdbMi &location); void refreshModules(const GdbMi &modules); void refreshSymbols(const GdbMi &symbols); + void refreshOutput(const GdbMi &output); void refreshBreakpoints(const GdbMi &bkpts); void runContinuation(const GdbMi &data); - void updateAll(); - typedef void (LldbEngine::*LldbCommandContinuation)(); QByteArray currentOptions() const; diff --git a/src/plugins/debugger/memoryagent.cpp b/src/plugins/debugger/memoryagent.cpp index 0d045a4679a6ac975b47e7952a2488cfae7c6573..5289b502728a7f5497208f63a7c5426ff43d8e26 100644 --- a/src/plugins/debugger/memoryagent.cpp +++ b/src/plugins/debugger/memoryagent.cpp @@ -129,24 +129,12 @@ void MemoryAgent::updateMemoryView(quint64 address, quint64 length) void MemoryAgent::connectBinEditorWidget(QWidget *w) { - connect(w, - SIGNAL(dataRequested(Core::IEditor*,quint64)), - SLOT(fetchLazyData(Core::IEditor*,quint64))); - connect(w, - SIGNAL(newWindowRequested(quint64)), - SLOT(createBinEditor(quint64))); - connect(w, - SIGNAL(newRangeRequested(Core::IEditor*,quint64)), - SLOT(provideNewRange(Core::IEditor*,quint64))); - connect(w, - SIGNAL(dataChanged(Core::IEditor*,quint64,QByteArray)), - SLOT(handleDataChanged(Core::IEditor*,quint64,QByteArray))); - connect(w, - SIGNAL(dataChanged(Core::IEditor*,quint64,QByteArray)), - SLOT(handleDataChanged(Core::IEditor*,quint64,QByteArray))); - connect(w, - SIGNAL(addWatchpointRequested(quint64,uint)), - SLOT(handleWatchpointRequest(quint64,uint))); + connect(w, SIGNAL(dataRequested(quint64)), SLOT(fetchLazyData(quint64))); + connect(w, SIGNAL(newWindowRequested(quint64)), SLOT(createBinEditor(quint64))); + connect(w, SIGNAL(newRangeRequested(quint64)), SLOT(provideNewRange(quint64))); + connect(w, SIGNAL(dataChanged(quint64,QByteArray)), SLOT(handleDataChanged(quint64,QByteArray))); + connect(w, SIGNAL(dataChanged(quint64,QByteArray)), SLOT(handleDataChanged(quint64,QByteArray))); + connect(w, SIGNAL(addWatchpointRequested(quint64,uint)), SLOT(handleWatchpointRequest(quint64,uint))); } bool MemoryAgent::doCreateBinEditor(quint64 addr, unsigned flags, @@ -222,7 +210,7 @@ void MemoryAgent::createBinEditor(quint64 addr) createBinEditor(addr, 0, QList<MemoryMarkup>(), QPoint(), QString(), 0); } -void MemoryAgent::fetchLazyData(IEditor *, quint64 block) +void MemoryAgent::fetchLazyData(quint64 block) { m_engine->fetchMemory(this, sender(), BinBlockSize * block, BinBlockSize); } @@ -235,15 +223,14 @@ void MemoryAgent::addLazyData(QObject *editorToken, quint64 addr, MemoryView::binEditorAddData(w, addr, ba); } -void MemoryAgent::provideNewRange(IEditor *, quint64 address) +void MemoryAgent::provideNewRange(quint64 address) { QWidget *w = qobject_cast<QWidget *>(sender()); QTC_ASSERT(w, return); MemoryView::setBinEditorRange(w, address, DataRange, BinBlockSize); } -void MemoryAgent::handleDataChanged(IEditor *, - quint64 addr, const QByteArray &data) +void MemoryAgent::handleDataChanged(quint64 addr, const QByteArray &data) { m_engine->changeMemory(this, sender(), addr, data); } diff --git a/src/plugins/debugger/memoryagent.h b/src/plugins/debugger/memoryagent.h index f44df5d2f1e7b940afe9a97cd3f91d9c1ee9c17d..5046e0753ab0fb236b1c4092fc446930a269ad00 100644 --- a/src/plugins/debugger/memoryagent.h +++ b/src/plugins/debugger/memoryagent.h @@ -95,10 +95,9 @@ public slots: void closeViews(); private slots: - void fetchLazyData(Core::IEditor *, quint64 block); - void provideNewRange(Core::IEditor *editor, quint64 address); - void handleDataChanged(Core::IEditor *editor, quint64 address, - const QByteArray &data); + void fetchLazyData(quint64 block); + void provideNewRange(quint64 address); + void handleDataChanged(quint64 address, const QByteArray &data); void handleWatchpointRequest(quint64 address, uint size); void updateMemoryView(quint64 address, quint64 length); void engineStateChanged(Debugger::DebuggerState s); diff --git a/src/plugins/debugger/shared/symbolpathsdialog.ui b/src/plugins/debugger/shared/symbolpathsdialog.ui index 4059bb31acd8e1a575941da975d443ecc42330a8..c74d985f2d67cabcedab8f0dbe549c7b9ea55be0 100644 --- a/src/plugins/debugger/shared/symbolpathsdialog.ui +++ b/src/plugins/debugger/shared/symbolpathsdialog.ui @@ -44,11 +44,7 @@ </sizepolicy> </property> <property name="text"> - <string><html><head/><body> -<p>The debugger is not configured to use the public Microsoft Symbol Server.<br>This is recommended for retrieval of the symbols of the operating system libraries.</p> -<p><span style=" font-style:italic;">Note:</span> It is recommended, that if you use the Microsoft Symbol Server, to also use a local symbol cache.<br>Also, a fast internet connection is required for this to work smoothly,<br>and a delay might occur when connecting for the first time, when caching the symbols for the first time.</p> -<p>Would you like to set it up?</p> -</body></html></string> + <string><html><head/><body><p>The debugger is not configured to use the public Microsoft Symbol Server.<br/>This is recommended for retrieval of the symbols of the operating system libraries.</p><p><span style=" font-style:italic;">Note:</span> It is recommended, that if you use the Microsoft Symbol Server, to also use a local symbol cache.<br/>A fast internet connection is required for this to work smoothly,<br/>and a delay might occur when connecting for the first time and caching the symbols.</p><p>What would you like to set up?</p></body></html></string> </property> <property name="textFormat"> <enum>Qt::RichText</enum> diff --git a/src/plugins/designer/settingsmanager.cpp b/src/plugins/designer/settingsmanager.cpp index 3710c3100a6ce185b1022f44afcedd14ce9d5484..ba71a26bf41c26948df8f3c91c162790fa2844c7 100644 --- a/src/plugins/designer/settingsmanager.cpp +++ b/src/plugins/designer/settingsmanager.cpp @@ -37,61 +37,40 @@ using namespace Designer::Internal; -static inline QSettings *coreSettings() -{ - if (Core::ICore::instance()) - return Core::ICore::settings(); - return 0; -} - void SettingsManager::beginGroup(const QString &prefix) { - QSettings *settings = coreSettings(); - QTC_ASSERT(settings, return); - settings->beginGroup(addPrefix(prefix)); + Core::ICore::settings()->beginGroup(addPrefix(prefix)); } void SettingsManager::endGroup() { - QSettings *settings = coreSettings(); - QTC_ASSERT(settings, return); - settings->endGroup(); + Core::ICore::settings()->endGroup(); } bool SettingsManager::contains(const QString &key) const { - const QSettings *settings = coreSettings(); - QTC_ASSERT(settings, return false); - return settings->contains(addPrefix(key)); + return Core::ICore::settings()->contains(addPrefix(key)); } void SettingsManager::setValue(const QString &key, const QVariant &value) { - QSettings *settings = coreSettings(); - QTC_ASSERT(settings, return); - settings->setValue(addPrefix(key), value); + Core::ICore::settings()->setValue(addPrefix(key), value); } QVariant SettingsManager::value(const QString &key, const QVariant &defaultValue) const { - const QSettings *settings = coreSettings(); - QTC_ASSERT(settings, return QVariant()); - return settings->value(addPrefix(key), defaultValue); + return Core::ICore::settings()->value(addPrefix(key), defaultValue); } void SettingsManager::remove(const QString &key) { - QSettings *settings = coreSettings(); - QTC_ASSERT(settings, return); - settings->remove(addPrefix(key)); + Core::ICore::settings()->remove(addPrefix(key)); } QString SettingsManager::addPrefix(const QString &name) const { - const QSettings *settings = coreSettings(); - QTC_ASSERT(settings, return name); QString result = name; - if (settings->group().isEmpty()) + if (Core::ICore::settings()->group().isEmpty()) result.prepend(QLatin1String("Designer")); return result; } diff --git a/src/plugins/find/searchresultwindow.cpp b/src/plugins/find/searchresultwindow.cpp index 61523af26504cdbe33db3f8ef3d3dc8c4d62c102..cda06a6464e5a61513470b3d8ba9a44aaee5f118 100644 --- a/src/plugins/find/searchresultwindow.cpp +++ b/src/plugins/find/searchresultwindow.cpp @@ -508,11 +508,9 @@ void SearchResultWindow::handleExpandCollapseToolButton(bool checked) void SearchResultWindow::readSettings() { QSettings *s = Core::ICore::settings(); - if (s) { - s->beginGroup(QLatin1String(SETTINGSKEYSECTIONNAME)); - d->m_expandCollapseAction->setChecked(s->value(QLatin1String(SETTINGSKEYEXPANDRESULTS), d->m_initiallyExpand).toBool()); - s->endGroup(); - } + s->beginGroup(QLatin1String(SETTINGSKEYSECTIONNAME)); + d->m_expandCollapseAction->setChecked(s->value(QLatin1String(SETTINGSKEYEXPANDRESULTS), d->m_initiallyExpand).toBool()); + s->endGroup(); } /*! @@ -521,11 +519,9 @@ void SearchResultWindow::readSettings() void SearchResultWindow::writeSettings() { QSettings *s = Core::ICore::settings(); - if (s) { - s->beginGroup(QLatin1String(SETTINGSKEYSECTIONNAME)); - s->setValue(QLatin1String(SETTINGSKEYEXPANDRESULTS), d->m_expandCollapseAction->isChecked()); - s->endGroup(); - } + s->beginGroup(QLatin1String(SETTINGSKEYSECTIONNAME)); + s->setValue(QLatin1String(SETTINGSKEYEXPANDRESULTS), d->m_expandCollapseAction->isChecked()); + s->endGroup(); } /*! diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp index 71637952f00989c5392d72d01a57313cd5809d6e..c1687fb7971f7f3407cf2f90815f1c2286456d7a 100644 --- a/src/plugins/git/gerrit/gerritplugin.cpp +++ b/src/plugins/git/gerrit/gerritplugin.cpp @@ -511,21 +511,19 @@ void GerritPlugin::fetch(const QSharedPointer<Gerrit::Internal::GerritChange> &c } } - if (!verifiedRepository && QFile::exists(repository + QLatin1String("/.gitmodules"))) { - QMap<QString,QString> submodules = gitClient->synchronousSubmoduleList(repository); - - QMap<QString,QString>::const_iterator i = submodules.constBegin(); - while (i != submodules.constEnd()) { - QString remote = i.value(); + if (!verifiedRepository) { + Git::Internal::SubmoduleDataMap submodules = gitClient->submoduleList(repository); + foreach (const Git::Internal::SubmoduleData &submoduleData, submodules) { + QString remote = submoduleData.url; if (remote.endsWith(QLatin1String(".git"))) remote.chop(4); if (remote.contains(m_parameters->host) && remote.endsWith(change->project) - && QFile::exists(repository + QLatin1Char('/') + i.key())) { - repository = QDir::cleanPath(repository + QLatin1Char('/') + i.key()); + && QFile::exists(repository + QLatin1Char('/') + submoduleData.dir)) { + repository = QDir::cleanPath(repository + QLatin1Char('/') + + submoduleData.dir); verifiedRepository = true; break; } - ++i; } } diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 15befd0406a434eca8f129799b916f624c77c1e2..ed2172c60573a338145e190d1c529afa74056151 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1962,21 +1962,59 @@ QMap<QString,QString> GitClient::synchronousRemotesList(const QString &workingDi return result; } -// function returns submodules in format path=url -QMap<QString,QString> GitClient::synchronousSubmoduleList(const QString &workingDirectory) +SubmoduleDataMap GitClient::submoduleList(const QString &workingDirectory) { - QMap<QString,QString> result; - if (!QFile::exists(workingDirectory + QLatin1String("/.gitmodules"))) + SubmoduleDataMap result; + QString gitmodulesFileName = workingDirectory + QLatin1String("/.gitmodules"); + if (!QFile::exists(gitmodulesFileName)) return result; - QSettings gitmodulesFile(workingDirectory + QLatin1String("/.gitmodules"), QSettings::IniFormat); + static QMap<QString, SubmoduleDataMap> cachedSubmoduleData; + + if (cachedSubmoduleData.contains(workingDirectory)) + return cachedSubmoduleData.value(workingDirectory); + QStringList args(QLatin1String("-l")); + + QStringList allConfigs = readConfig(workingDirectory, args).split(QLatin1Char('\n')); + const QString submoduleLineStart = QLatin1String("submodule."); + foreach (const QString &configLine, allConfigs) { + if (!configLine.startsWith(submoduleLineStart)) + continue; + + int nameStart = submoduleLineStart.size(); + int nameEnd = configLine.indexOf(QLatin1Char('.'), nameStart); + + QString submoduleName = configLine.mid(nameStart, nameEnd - nameStart); + + SubmoduleData submoduleData; + if (result.contains(submoduleName)) + submoduleData = result[submoduleName]; - foreach (const QString &submoduleGroup, gitmodulesFile.childGroups()) { - gitmodulesFile.beginGroup(submoduleGroup); - result.insertMulti(gitmodulesFile.value(QLatin1String("path")).toString(), - gitmodulesFile.value(QLatin1String("url")).toString()); - gitmodulesFile.endGroup(); + if (configLine.mid(nameEnd, 5) == QLatin1String(".url=")) + submoduleData.url = configLine.mid(nameEnd + 5); + else if (configLine.mid(nameEnd, 8) == QLatin1String(".ignore=")) + submoduleData.ignore = configLine.mid(nameEnd + 8); + else + continue; + + result.insert(submoduleName, submoduleData); + } + + // if config found submodules + if (!result.isEmpty()) { + QSettings gitmodulesFile(gitmodulesFileName, QSettings::IniFormat); + + foreach (const QString &submoduleName, result.keys()) { + gitmodulesFile.beginGroup(QLatin1String("submodule \"") + + submoduleName + QLatin1Char('"')); + result[submoduleName].dir = gitmodulesFile.value(QLatin1String("path")).toString(); + QString ignore = gitmodulesFile.value(QLatin1String("ignore")).toString(); + if (!ignore.isEmpty() && result[submoduleName].ignore.isEmpty()) + result[submoduleName].ignore = ignore; + gitmodulesFile.endGroup(); + } } + cachedSubmoduleData.insert(workingDirectory, result); return result; } @@ -2172,7 +2210,7 @@ void GitClient::submoduleUpdate(const QString &workingDirectory) void GitClient::promptSubmoduleUpdate(const QString &workingDirectory) { - if (!QFile::exists(workingDirectory + QLatin1String("/.gitmodules"))) + if (submoduleList(workingDirectory).isEmpty()) return; if (QMessageBox::question(Core::ICore::mainWindow(), tr("Submodules Found"), diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h index d71b47ac888f831075b22cd4f3de46b45f7db94f..414efe65216b7ba4e4cff578ae018748a8e66871 100644 --- a/src/plugins/git/gitclient.h +++ b/src/plugins/git/gitclient.h @@ -86,6 +86,16 @@ enum StashFlag { NoPrompt = 0x02 }; +class SubmoduleData +{ +public: + QString dir; + QString url; + QString ignore; +}; + +typedef QMap<QString, SubmoduleData> SubmoduleDataMap; + class GitClient : public QObject { Q_OBJECT @@ -200,7 +210,7 @@ public: QMap<QString,QString> synchronousRemotesList(const QString &workingDirectory, QString *errorMessage = 0); - QMap<QString,QString> synchronousSubmoduleList(const QString &workingDirectory); + SubmoduleDataMap submoduleList(const QString &workingDirectory); bool synchronousShow(const QString &workingDirectory, const QString &id, QString *output, QString *errorMessage); diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 55dcce5364895a7e0a64aad5d40b1a17b884b04a..665c332b21036f705928885b564471ef2be8efaa 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -233,7 +233,8 @@ ActionCommandPair { QAction *action = new QAction(text, this); Core::Command *command = Core::ActionManager::registerAction(action, id, context); - ac->addAction(command); + if (ac) + ac->addAction(command); m_repositoryActions.push_back(action); if (addToLocator) m_commandLocator->appendCommand(command); @@ -439,7 +440,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) globalcontext, false, SLOT(resetRepository())); createRepositoryAction(localRepositoryMenu, - tr("Interactive Rebase..."), Core::Id("Git.Rebase"), + tr("Interactive Rebase..."), Core::Id("Git.InteractiveRebase"), globalcontext, true, SLOT(startRebase())); createRepositoryAction(localRepositoryMenu, @@ -591,6 +592,29 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) // -------------- + /* Actions only in locator */ + createRepositoryAction(0, tr("Show..."), Core::Id("Git.Show"), + globalcontext, true, SLOT(startChangeRelatedAction())); + + createRepositoryAction(0, tr("Revert..."), Core::Id("Git.Revert"), + globalcontext, true, SLOT(startChangeRelatedAction())); + + createRepositoryAction(0, tr("Cherry Pick..."), Core::Id("Git.CherryPick"), + globalcontext, true, SLOT(startChangeRelatedAction())); + + createRepositoryAction(0, tr("Checkout..."), Core::Id("Git.Checkout"), + globalcontext, true, SLOT(startChangeRelatedAction())); + + createRepositoryAction(0, tr("Rebase..."), Core::Id("Git.Rebase"), + globalcontext, true, SLOT(branchList())); + + createRepositoryAction(0, tr("Merge..."), Core::Id("Git.Merge"), + globalcontext, true, SLOT(branchList())); + + /* \Actions only in locator */ + + // -------------- + /* "Git Tools" menu */ Core::ActionContainer *gitToolsMenu = Core::ActionManager::createMenu(Core::Id("Git.GitToolsMenu")); gitToolsMenu->menu()->setTitle(tr("Git &Tools")); @@ -1323,8 +1347,9 @@ void GitPlugin::updateActions(VcsBase::VcsBasePlugin::ActionState as) foreach (QAction *repositoryAction, m_repositoryActions) repositoryAction->setEnabled(repositoryEnabled); + m_submoduleUpdateAction->setVisible(repositoryEnabled - && QFile::exists(currentState().topLevel() + QLatin1String("/.gitmodules"))); + && !m_gitClient->submoduleList(currentState().topLevel()).isEmpty()); updateContinueAndAbortCommands(); updateRepositoryBrowserAction(); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index ece65886ff3c5511107662eba15fe9ec21ccab1c..e89ce9496771a6ad0f5742f546b224640d94f43d 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1274,37 +1274,35 @@ void ProjectExplorerPlugin::savePersistentSettings() } QSettings *s = Core::ICore::settings(); - if (s) { - s->setValue(QLatin1String("ProjectExplorer/StartupSession"), d->m_session->activeSession()); - s->remove(QLatin1String("ProjectExplorer/RecentProjects/Files")); - - QStringList fileNames; - QStringList displayNames; - QList<QPair<QString, QString> >::const_iterator it, end; - end = d->m_recentProjects.constEnd(); - for (it = d->m_recentProjects.constBegin(); it != end; ++it) { - fileNames << (*it).first; - displayNames << (*it).second; - } - - s->setValue(QLatin1String("ProjectExplorer/RecentProjects/FileNames"), fileNames); - s->setValue(QLatin1String("ProjectExplorer/RecentProjects/DisplayNames"), displayNames); - - s->setValue(QLatin1String("ProjectExplorer/Settings/BuildBeforeDeploy"), d->m_projectExplorerSettings.buildBeforeDeploy); - s->setValue(QLatin1String("ProjectExplorer/Settings/DeployBeforeRun"), d->m_projectExplorerSettings.deployBeforeRun); - s->setValue(QLatin1String("ProjectExplorer/Settings/SaveBeforeBuild"), d->m_projectExplorerSettings.saveBeforeBuild); - s->setValue(QLatin1String("ProjectExplorer/Settings/ShowCompilerOutput"), d->m_projectExplorerSettings.showCompilerOutput); - s->setValue(QLatin1String("ProjectExplorer/Settings/ShowRunOutput"), d->m_projectExplorerSettings.showRunOutput); - s->setValue(QLatin1String("ProjectExplorer/Settings/ShowDebugOutput"), d->m_projectExplorerSettings.showDebugOutput); - s->setValue(QLatin1String("ProjectExplorer/Settings/CleanOldAppOutput"), d->m_projectExplorerSettings.cleanOldAppOutput); - s->setValue(QLatin1String("ProjectExplorer/Settings/MergeStdErrAndStdOut"), d->m_projectExplorerSettings.mergeStdErrAndStdOut); - s->setValue(QLatin1String("ProjectExplorer/Settings/WrapAppOutput"), d->m_projectExplorerSettings.wrapAppOutput); - s->setValue(QLatin1String("ProjectExplorer/Settings/UseJom"), d->m_projectExplorerSettings.useJom); - s->setValue(QLatin1String("ProjectExplorer/Settings/AutoRestoreLastSession"), d->m_projectExplorerSettings.autorestoreLastSession); - s->setValue(QLatin1String("ProjectExplorer/Settings/PromptToStopRunControl"), d->m_projectExplorerSettings.prompToStopRunControl); - s->setValue(QLatin1String("ProjectExplorer/Settings/MaxAppOutputLines"), d->m_projectExplorerSettings.maxAppOutputLines); - s->setValue(QLatin1String("ProjectExplorer/Settings/EnvironmentId"), d->m_projectExplorerSettings.environmentId.toByteArray()); - } + s->setValue(QLatin1String("ProjectExplorer/StartupSession"), d->m_session->activeSession()); + s->remove(QLatin1String("ProjectExplorer/RecentProjects/Files")); + + QStringList fileNames; + QStringList displayNames; + QList<QPair<QString, QString> >::const_iterator it, end; + end = d->m_recentProjects.constEnd(); + for (it = d->m_recentProjects.constBegin(); it != end; ++it) { + fileNames << (*it).first; + displayNames << (*it).second; + } + + s->setValue(QLatin1String("ProjectExplorer/RecentProjects/FileNames"), fileNames); + s->setValue(QLatin1String("ProjectExplorer/RecentProjects/DisplayNames"), displayNames); + + s->setValue(QLatin1String("ProjectExplorer/Settings/BuildBeforeDeploy"), d->m_projectExplorerSettings.buildBeforeDeploy); + s->setValue(QLatin1String("ProjectExplorer/Settings/DeployBeforeRun"), d->m_projectExplorerSettings.deployBeforeRun); + s->setValue(QLatin1String("ProjectExplorer/Settings/SaveBeforeBuild"), d->m_projectExplorerSettings.saveBeforeBuild); + s->setValue(QLatin1String("ProjectExplorer/Settings/ShowCompilerOutput"), d->m_projectExplorerSettings.showCompilerOutput); + s->setValue(QLatin1String("ProjectExplorer/Settings/ShowRunOutput"), d->m_projectExplorerSettings.showRunOutput); + s->setValue(QLatin1String("ProjectExplorer/Settings/ShowDebugOutput"), d->m_projectExplorerSettings.showDebugOutput); + s->setValue(QLatin1String("ProjectExplorer/Settings/CleanOldAppOutput"), d->m_projectExplorerSettings.cleanOldAppOutput); + s->setValue(QLatin1String("ProjectExplorer/Settings/MergeStdErrAndStdOut"), d->m_projectExplorerSettings.mergeStdErrAndStdOut); + s->setValue(QLatin1String("ProjectExplorer/Settings/WrapAppOutput"), d->m_projectExplorerSettings.wrapAppOutput); + s->setValue(QLatin1String("ProjectExplorer/Settings/UseJom"), d->m_projectExplorerSettings.useJom); + s->setValue(QLatin1String("ProjectExplorer/Settings/AutoRestoreLastSession"), d->m_projectExplorerSettings.autorestoreLastSession); + s->setValue(QLatin1String("ProjectExplorer/Settings/PromptToStopRunControl"), d->m_projectExplorerSettings.prompToStopRunControl); + s->setValue(QLatin1String("ProjectExplorer/Settings/MaxAppOutputLines"), d->m_projectExplorerSettings.maxAppOutputLines); + s->setValue(QLatin1String("ProjectExplorer/Settings/EnvironmentId"), d->m_projectExplorerSettings.environmentId.toByteArray()); } void ProjectExplorerPlugin::openProjectWelcomePage(const QString &fileName) diff --git a/src/plugins/projectexplorer/projectexplorer.qbs b/src/plugins/projectexplorer/projectexplorer.qbs index d7519ee6ef769c6aee1709ffaa61f14ea880777b..c8b5785c808d116d8ff87597de1229d2574fa326 100644 --- a/src/plugins/projectexplorer/projectexplorer.qbs +++ b/src/plugins/projectexplorer/projectexplorer.qbs @@ -319,8 +319,6 @@ QtcPlugin { "images/targetleftbutton.png", "images/targetpanel_bottom.png", "images/targetpanel_gradient.png", - "images/targetremovebutton.png", - "images/targetremovebuttondark.png", "images/targetrightbutton.png", "images/targetrunselected.png", "images/targetseparatorbackground.png", diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index f6fb277c5a9009d98ee3d0d4e4c55c02cb297441..d18d7fd464495db31b15d7fdcc5b5eff4fc0aa8a 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -658,8 +658,10 @@ void Target::updateDefaultRunConfigurations() } // Do actual changes: - foreach (RunConfiguration *rc, toRemove) + foreach (RunConfiguration *rc, toRemove) { removeRunConfiguration(rc); + existingConfigured.removeOne(rc); // make sure to also remove them from existingConfigured! + } if (removeExistingUnconfigured) { foreach (RunConfiguration *rc, existingUnconfigured) diff --git a/src/plugins/projectexplorer/taskhub.h b/src/plugins/projectexplorer/taskhub.h index 1355705e61f139bf1f318378d32483544837e8bf..90f77abd75eb9b5c012a941b2bf0b9624548cf94 100644 --- a/src/plugins/projectexplorer/taskhub.h +++ b/src/plugins/projectexplorer/taskhub.h @@ -45,10 +45,13 @@ public: TaskHub(); virtual ~TaskHub(); +public slots: void addCategory(const Core::Id &categoryId, const QString &displayName, bool visible = true); - void addTask(Task task); + void addTask(ProjectExplorer::Task task); void clearTasks(const Core::Id &categoryId = Core::Id()); - void removeTask(const Task &task); + void removeTask(const ProjectExplorer::Task &task); + +public: void updateTaskFileName(unsigned int id, const QString &fileName); void updateTaskLineNumber(unsigned int id, int line); void taskMarkClicked(unsigned int id); @@ -58,6 +61,7 @@ public: void requestPopup(); QIcon taskTypeIcon(ProjectExplorer::Task::TaskType t) const; + signals: void categoryAdded(const Core::Id &categoryId, const QString &displayName, bool visible); void taskAdded(const ProjectExplorer::Task &task); diff --git a/src/plugins/pythoneditor/pythoneditor.pro b/src/plugins/pythoneditor/pythoneditor.pro index 9d33f9f8a226694750df584e66a739a0d04e8447..614f7708830ac41302023045b946e08c80005d2d 100644 --- a/src/plugins/pythoneditor/pythoneditor.pro +++ b/src/plugins/pythoneditor/pythoneditor.pro @@ -3,7 +3,7 @@ include(../../qtcreatorplugin.pri) DEFINES += \ PYTHONEDITOR_LIBRARY -OTHER_FILES += PythonEditor.pluginspec.in \ +OTHER_FILES += \ pythoneditor.mimetypes.xml RESOURCES += \ diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp index 2a1126b3bdf023125bac22b1c1417b9ac66370dc..37304766d6927a4ba653b039b791fe631939d83e 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.cpp +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.cpp @@ -135,8 +135,6 @@ void QbsBuildStep::run(QFutureInterface<bool> &fi) this, SLOT(handleProgress(int))); connect(m_job, SIGNAL(reportCommandDescription(QString,QString)), this, SLOT(handleCommandDescriptionReport(QString,QString))); - connect(m_job, SIGNAL(reportWarning(qbs::Error)), - this, SLOT(handleWarningReport(qbs::Error))); connect(m_job, SIGNAL(reportProcessResult(qbs::ProcessResult)), this, SLOT(handleProcessResultReport(qbs::ProcessResult))); } @@ -248,14 +246,6 @@ void QbsBuildStep::handleProgress(int value) m_fi->setProgressValue(m_progressBase + value); } -void QbsBuildStep::handleWarningReport(const qbs::Error &error) -{ - foreach (const qbs::ErrorData &data, error.entries()) { - createTaskAndOutput(ProjectExplorer::Task::Warning, data.description(), - data.codeLocation().fileName(), data.codeLocation().line()); - } -} - void QbsBuildStep::handleCommandDescriptionReport(const QString &highlight, const QString &message) { Q_UNUSED(highlight); diff --git a/src/plugins/qbsprojectmanager/qbsbuildstep.h b/src/plugins/qbsprojectmanager/qbsbuildstep.h index 62406f994443897ced4db384c7f655a64b5bd41d..a916b9d91cb685270e105b3e9d2787216b4f4517 100644 --- a/src/plugins/qbsprojectmanager/qbsbuildstep.h +++ b/src/plugins/qbsprojectmanager/qbsbuildstep.h @@ -79,7 +79,6 @@ private slots: void buildingDone(bool success); void handleTaskStarted(const QString &desciption, int max); void handleProgress(int value); - void handleWarningReport(const qbs::Error &error); void handleCommandDescriptionReport(const QString &highlight, const QString &message); void handleProcessResultReport(const qbs::ProcessResult &result); diff --git a/src/plugins/qbsprojectmanager/qbslogsink.cpp b/src/plugins/qbsprojectmanager/qbslogsink.cpp index 48939435a2c5a3370dacd33771fb649767ef29c7..3d7ac94eae49d8c754d8b449a791d14caa29c8cc 100644 --- a/src/plugins/qbsprojectmanager/qbslogsink.cpp +++ b/src/plugins/qbsprojectmanager/qbslogsink.cpp @@ -32,6 +32,9 @@ #include <qbs.h> #include <coreplugin/messagemanager.h> +#include <projectexplorer/projectexplorer.h> +#include <projectexplorer/taskhub.h> +#include <utils/fileutils.h> #include <QCoreApplication> #include <QMutexLocker> @@ -46,6 +49,9 @@ namespace Internal { QbsLogSink::QbsLogSink(QObject *parent) : QObject(parent) { + ProjectExplorer::TaskHub *hub = ProjectExplorer::ProjectExplorerPlugin::instance()->taskHub(); + connect(this, SIGNAL(newTask(ProjectExplorer::Task)), + hub, SLOT(addTask(ProjectExplorer::Task)), Qt::QueuedConnection); } void QbsLogSink::sendMessages() @@ -62,6 +68,16 @@ void QbsLogSink::sendMessages() mm->printToOutputPane(msg, Core::MessageManager::NoModeSwitch); } +void QbsLogSink::doPrintWarning(const qbs::Error &warning) +{ + foreach (const qbs::ErrorData &data, warning.entries()) + emit newTask(ProjectExplorer::Task(ProjectExplorer::Task::Warning, + data.description(), + Utils::FileName::fromString(data.codeLocation().fileName()), + data.codeLocation().line(), + ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM)); +} + void QbsLogSink::doPrintMessage(qbs::LoggerLevel level, const QString &message, const QString &tag) { Q_UNUSED(tag); diff --git a/src/plugins/qbsprojectmanager/qbslogsink.h b/src/plugins/qbsprojectmanager/qbslogsink.h index cfbfc1b1d00e717e2837cbddbf32ae15293eabe4..fe40101e884279c54d1f7fb55690adc212c3cbfe 100644 --- a/src/plugins/qbsprojectmanager/qbslogsink.h +++ b/src/plugins/qbsprojectmanager/qbslogsink.h @@ -30,6 +30,8 @@ #ifndef QBSLOGSINK_H #define QBSLOGSINK_H +#include <projectexplorer/task.h> + #include <qbs.h> #include <QMutex> @@ -45,10 +47,14 @@ class QbsLogSink : public QObject, public qbs::ILogSink public: QbsLogSink(QObject *parent = 0); +signals: + void newTask(const ProjectExplorer::Task &task); + private slots: void sendMessages(); private: + void doPrintWarning(const qbs::Error &warning); void doPrintMessage(qbs::LoggerLevel level, const QString &message, const QString &tag); QStringList m_messages; diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml index 3fa325c1890a181ea6be94899da98fc23e3767f6..95101e35996d9c3d9de3ba2aec5ed9d83256dc4f 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/ButtonSpecifics.qml @@ -86,6 +86,21 @@ QWidget { } } + QWidget { + layout: HorizontalLayout { + Label { + text: qsTr("Enabled") + toolTip: qsTr("Determines whether the button is enabled or not.") + } + CheckBox { + text: backendValues.enabled.value + backendValue: backendValues.enabled + baseStateFlag: isBaseState + checkable: true + } + } + } + QWidget { layout: HorizontalLayout { Label { diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/CheckBoxSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/CheckBoxSpecifics.qml index 12486b9067ba20da145a3c2b2125e0df6884991c..412fdeb95bfea14fc374a02aa51c867d2aa4a90f 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/CheckBoxSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/CheckBoxSpecifics.qml @@ -42,6 +42,7 @@ GroupBox { LineEdit { backendValue: backendValues.text baseStateFlag: isBaseState + translation: true } } } diff --git a/src/plugins/qmldesigner/componentsplugin/Controls/RadioButtonSpecifics.qml b/src/plugins/qmldesigner/componentsplugin/Controls/RadioButtonSpecifics.qml index d006c3d9634b3a483f14061481589fe3258df43b..25ed160c0f4122758498f1c3f2b2f4f0f22bac61 100644 --- a/src/plugins/qmldesigner/componentsplugin/Controls/RadioButtonSpecifics.qml +++ b/src/plugins/qmldesigner/componentsplugin/Controls/RadioButtonSpecifics.qml @@ -43,6 +43,7 @@ GroupBox { LineEdit { backendValue: backendValues.text baseStateFlag: isBaseState + translation: true } } } diff --git a/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h b/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h index 552b5b1fb2eded067c2876e99d97e141701a39af..bbbecdbe6f522cf1a337d43cc045dc40bbf32acb 100644 --- a/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h +++ b/src/plugins/qmldesigner/designercore/include/qmlobjectnode.h @@ -72,6 +72,8 @@ public: bool instanceHasBinding(const PropertyName &name) const; bool propertyAffectedByCurrentState(const PropertyName &name) const; QVariant modelValue(const PropertyName &name) const; + bool isTranslatableText(const PropertyName &name) const; + QString stripedTranslatableText(const PropertyName &name) const; QString expression(const PropertyName &name) const; bool isInBaseState() const; QmlPropertyChanges propertyChangeForCurrentState() const; @@ -98,6 +100,8 @@ public: static QVariant instanceValue(const ModelNode &modelNode, const PropertyName &name); + static QString generateTranslatableText(const QString& text); + protected: NodeInstance nodeInstance() const; QmlObjectNode nodeForInstance(const NodeInstance &instance) const; diff --git a/src/plugins/qmldesigner/designercore/include/rewritingexception.h b/src/plugins/qmldesigner/designercore/include/rewritingexception.h index 51eadee4e6ded78e848a7ae1bf43ffaf4eebc297..48abe9b96c69b128633badb9756018aa416b80c6 100644 --- a/src/plugins/qmldesigner/designercore/include/rewritingexception.h +++ b/src/plugins/qmldesigner/designercore/include/rewritingexception.h @@ -34,7 +34,7 @@ namespace QmlDesigner { -class RewritingException: public Exception +class QMLDESIGNERCORE_EXPORT RewritingException: public Exception { public: RewritingException(int line, diff --git a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp index c5fb89d1e803a9a1e27b62eb8b5b6ebd19523746..f366abbb012064e909c0a7986470f13845e86036 100644 --- a/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp +++ b/src/plugins/qmldesigner/designercore/instances/nodeinstanceserverproxy.cpp @@ -156,11 +156,15 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV if (!envImportPath.isEmpty()) applicationPath = envImportPath; - QProcessEnvironment enviroment = QProcessEnvironment::systemEnvironment(); + QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); + +#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) && (defined(Q_OS_MAC) || defined(Q_OS_LINUX)) + environment.insert(QLatin1String("DESIGNER_DONT_USE_SHARED_MEMORY"), QLatin1String("1")); +#endif if (QFileInfo(applicationPath).exists()) { m_qmlPuppetEditorProcess = new QProcess; - m_qmlPuppetEditorProcess->setProcessEnvironment(enviroment); + m_qmlPuppetEditorProcess->setProcessEnvironment(environment); m_qmlPuppetEditorProcess->setObjectName("EditorProcess"); connect(m_qmlPuppetEditorProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus))); connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetEditorProcess.data(), SLOT(kill())); @@ -171,7 +175,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV if (runModus == NormalModus) { m_qmlPuppetPreviewProcess = new QProcess; - m_qmlPuppetPreviewProcess->setProcessEnvironment(enviroment); + m_qmlPuppetPreviewProcess->setProcessEnvironment(environment); m_qmlPuppetPreviewProcess->setObjectName("PreviewProcess"); connect(m_qmlPuppetPreviewProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus))); connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetPreviewProcess.data(), SLOT(kill())); @@ -180,7 +184,7 @@ NodeInstanceServerProxy::NodeInstanceServerProxy(NodeInstanceView *nodeInstanceV m_qmlPuppetPreviewProcess->start(applicationPath, QStringList() << socketToken << "previewmode" << "-graphicssystem raster"); m_qmlPuppetRenderProcess = new QProcess; - m_qmlPuppetRenderProcess->setProcessEnvironment(enviroment); + m_qmlPuppetRenderProcess->setProcessEnvironment(environment); m_qmlPuppetRenderProcess->setObjectName("RenderProcess"); connect(m_qmlPuppetRenderProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus))); connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), m_qmlPuppetRenderProcess.data(), SLOT(kill())); diff --git a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp index 0681f2f3f5a34b634b44fe0717d442d827601b57..42643ed82fb747c47b5afc7e4fed566bc357a280 100644 --- a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp +++ b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp @@ -175,6 +175,34 @@ QVariant QmlObjectNode::modelValue(const PropertyName &name) const return propertyChanges.modelNode().variantProperty(name).value(); } +bool QmlObjectNode::isTranslatableText(const PropertyName &name) const +{ + if (modelNode().metaInfo().isValid() && modelNode().metaInfo().hasProperty(name)) + if (modelNode().metaInfo().propertyTypeName(name) == "QString" || modelNode().metaInfo().propertyTypeName(name) == "string") { + if (modelNode().hasBindingProperty(name)) { + static QRegExp regularExpressionPatter("qsTr\\((\".*\")\\)"); + return regularExpressionPatter.exactMatch(modelNode().bindingProperty(name).expression()); + } + + return false; + } + + return false; +} + +QString QmlObjectNode::stripedTranslatableText(const PropertyName &name) const +{ + if (modelNode().hasBindingProperty(name)) { + static QRegExp regularExpressionPatter("qsTr\\(\"(.*)\"\\)"); + if (regularExpressionPatter.exactMatch(modelNode().bindingProperty(name).expression())) + return regularExpressionPatter.cap(1); + } else { + return modelNode().variantProperty(name).value().toString(); + } + + return QString(); +} + QString QmlObjectNode::expression(const PropertyName &name) const { if (!isValid()) @@ -387,6 +415,11 @@ QVariant QmlObjectNode::instanceValue(const ModelNode &modelNode, const Property return modelView->instanceForModelNode(modelNode).property(name); } +QString QmlObjectNode::generateTranslatableText(const QString &text) +{ + return QString("qsTr(\"%1\")").arg(text); +} + TypeName QmlObjectNode::instanceType(const PropertyName &name) const { return nodeInstance().instanceType(name); diff --git a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp index baf3b523d8484c09bb1190ef934f1ff38e7f5a84..bb1fbe755b7400aa25f7dc2b95ae76059c91517b 100644 --- a/src/plugins/qmljstools/qmljscodestylesettingspage.cpp +++ b/src/plugins/qmljstools/qmljscodestylesettingspage.cpp @@ -196,13 +196,11 @@ void QmlJSCodeStyleSettingsPage::apply() TextEditor::SimpleCodeStylePreferences *originalTabPreferences = QmlJSToolsSettings::globalCodeStyle(); if (originalTabPreferences->tabSettings() != m_pageTabPreferences->tabSettings()) { originalTabPreferences->setTabSettings(m_pageTabPreferences->tabSettings()); - if (s) - originalTabPreferences->toSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID), s); + originalTabPreferences->toSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID), s); } if (originalTabPreferences->currentDelegate() != m_pageTabPreferences->currentDelegate()) { originalTabPreferences->setCurrentDelegate(m_pageTabPreferences->currentDelegate()); - if (s) - originalTabPreferences->toSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID), s); + originalTabPreferences->toSettings(QLatin1String(QmlJSTools::Constants::QML_JS_SETTINGS_ID), s); } } } diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index 5893c972d7113060bac1151927bbaf01c3bce87e..07e9ec06c12f475ad13e1553a8d4d3af7ad693e0 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -925,6 +925,7 @@ void ModelManager::updateCppQmlTypes(QFutureInterface<void> &interface, FindExportedCppTypes finder(snapshot); + bool hasNewInfo = false; typedef QPair<CPlusPlus::Document::Ptr, bool> DocScanPair; foreach (const DocScanPair &pair, documents) { if (interface.isCanceled()) @@ -934,7 +935,7 @@ void ModelManager::updateCppQmlTypes(QFutureInterface<void> &interface, const bool scan = pair.second; const QString fileName = doc->fileName(); if (!scan) { - newData.remove(fileName); + hasNewInfo = hasNewInfo || newData.remove(fileName) > 0; continue; } @@ -943,9 +944,11 @@ void ModelManager::updateCppQmlTypes(QFutureInterface<void> &interface, QList<LanguageUtils::FakeMetaObject::ConstPtr> exported = finder.exportedTypes(); QHash<QString, QString> contextProperties = finder.contextProperties(); if (exported.isEmpty() && contextProperties.isEmpty()) { - newData.remove(fileName); + hasNewInfo = hasNewInfo || newData.remove(fileName) > 0; } else { CppData &data = newData[fileName]; + // currently we have no simple way to compare, so we assume the worse + hasNewInfo = true; data.exportedTypes = exported; data.contextProperties = contextProperties; } @@ -955,6 +958,9 @@ void ModelManager::updateCppQmlTypes(QFutureInterface<void> &interface, QMutexLocker locker(&qmlModelManager->m_cppDataMutex); qmlModelManager->m_cppDataHash = newData; + if (hasNewInfo) + // one could get away with re-linking the cpp types... + QMetaObject::invokeMethod(qmlModelManager, "resetCodeModel"); } ModelManager::CppDataHash ModelManager::cppData() const diff --git a/src/plugins/qnx/blackberryconfiguration.cpp b/src/plugins/qnx/blackberryconfiguration.cpp index 34889388c0bddab083e4d8e2ed728d2bf3223905..eceaee1916de1482d4d717493f9aa6ffeb4f4e1b 100644 --- a/src/plugins/qnx/blackberryconfiguration.cpp +++ b/src/plugins/qnx/blackberryconfiguration.cpp @@ -131,7 +131,7 @@ bool BlackBerryConfiguration::refresh() void BlackBerryConfiguration::loadCertificates() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(SettingsGroup); settings->beginGroup(CertificateGroup); @@ -158,7 +158,7 @@ void BlackBerryConfiguration::loadCertificates() void BlackBerryConfiguration::loadNdkSettings() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(SettingsGroup); setNdkPath(settings->value(NDKLocationKey).toString()); @@ -167,7 +167,7 @@ void BlackBerryConfiguration::loadNdkSettings() void BlackBerryConfiguration::saveCertificates() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(SettingsGroup); settings->beginGroup(CertificateGroup); @@ -194,7 +194,7 @@ void BlackBerryConfiguration::saveNdkSettings() if (m_config.ndkPath.isEmpty()) return; - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(SettingsGroup); settings->setValue(NDKLocationKey, m_config.ndkPath); settings->endGroup(); @@ -396,7 +396,7 @@ void BlackBerryConfiguration::saveSettings() void BlackBerryConfiguration::clearNdkSettings() { - QSettings *settings = Core::ICore::instance()->settings(); + QSettings *settings = Core::ICore::settings(); settings->beginGroup(SettingsGroup); settings->remove(NDKLocationKey); settings->endGroup(); diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 047210732b01fb4f8c5da738366647ecddb9c792..1565adf12805b436465f675504d6e5de1f395767 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -572,6 +572,7 @@ void SubversionPlugin::svnDiff(const Subversion::Internal::SubversionDiffParamet QFileInfo(p.files.front()).fileName() : p.diffName; QStringList args(QLatin1String("diff")); + args.append(QLatin1String("--internal-diff")); args.append(p.arguments); args << p.files; diff --git a/src/plugins/texteditor/texteditor.qbs b/src/plugins/texteditor/texteditor.qbs index 28451cae8df694b44637330d76156f4a8f05641a..9792f6a884f189f7d23e6f8aa8fcaf804adea4ff 100644 --- a/src/plugins/texteditor/texteditor.qbs +++ b/src/plugins/texteditor/texteditor.qbs @@ -188,7 +188,6 @@ QtcPlugin { "ifunctionhintproposalmodel.h", "igenericproposalmodel.cpp", "igenericproposalmodel.h", - "ikeywords.h", "keywordscompletionassist.cpp", "keywordscompletionassist.h", "quickfixassistprocessor.cpp", diff --git a/src/shared/qbs b/src/shared/qbs index 32ae53690c01e5269ac2a9ad0dadf549ce04ee3f..5df624fa5884ba7ca9d1d0666484ad24c1c0b70b 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 32ae53690c01e5269ac2a9ad0dadf549ce04ee3f +Subproject commit 5df624fa5884ba7ca9d1d0666484ad24c1c0b70b diff --git a/tests/system/shared/debugger.py b/tests/system/shared/debugger.py index 29b79c776188b63539e1ba425defcbccc270c278..849fab459ddd070c3d519dfa7feba42096ea0679 100644 --- a/tests/system/shared/debugger.py +++ b/tests/system/shared/debugger.py @@ -33,14 +33,14 @@ def handleDebuggerWarnings(config, isMsvcBuild=False): if isMsvcBuild: try: popup = waitForObject("{name='msgLabel' text?='<html><head/><body>*' type='QLabel' visible='1' window=':Dialog_Debugger::Internal::SymbolPathsDialog'}", 10000) - symServerNotConfiged = ("<html><head/><body>\n<p>The debugger is not configured to use the public " - "Microsoft Symbol Server.<br>" - "This is recommended for retrieval of the symbols of the operating system libraries.</p>\n" - "<p><span style=\" font-style:italic;\">Note:</span> It is recommended, that if you use the Microsoft Symbol Server, " - "to also use a local symbol cache.<br>" - "Also, a fast internet connection is required for this to work smoothly,<br>" - "and a delay might occur when connecting for the first time, when caching the symbols for the first time.</p>\n" - "<p>Would you like to set it up?</p>\n</body></html>") + symServerNotConfiged = ("<html><head/><body><p>The debugger is not configured to use the public " + "Microsoft Symbol Server.<br/>" + "This is recommended for retrieval of the symbols of the operating system libraries.</p>" + "<p><span style=\" font-style:italic;\">Note:</span> It is recommended, that if you use the Microsoft Symbol Server, " + "to also use a local symbol cache.<br/>" + "A fast internet connection is required for this to work smoothly,<br/>" + "and a delay might occur when connecting for the first time and caching the symbols.</p>" + "<p>What would you like to set up?</p></body></html>") if popup.text == symServerNotConfiged: test.log("Creator warned about the debugger not being configured to use the public Microsoft Symbol Server.") else: diff --git a/tests/system/shared/fs_utils.py b/tests/system/shared/fs_utils.py index 5a0c22ea15d6b9594ed02515fd1cb8501395fa85..8a5c8e345110315c4c65c8f7c97c3a5318909b16 100644 --- a/tests/system/shared/fs_utils.py +++ b/tests/system/shared/fs_utils.py @@ -50,9 +50,15 @@ def changeFilePermissions(dirPath, readPerm, writePerm, excludeFileNames=None): return False filePaths = [os.path.join(dirPath, fileName) for fileName in os.listdir(dirPath) if fileName not in excludeFileNames] + result = True for filePath in filter(os.path.isfile, filePaths): - os.chmod(filePath, permission) - return True + try: + os.chmod(filePath, permission) + except: + t,v = sys.exc_info()[:2] + test.log("Error: %s(%s)" % (str(t), str(v))) + result = False + return result def isWritable(pathToFile): if os.path.exists(pathToFile): diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 401acbe963d00872b6b343f0f2aba14871c2e1b1..2e8d5ce2dcefd9b535439b6abe515b64b63bc55a 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -647,3 +647,6 @@ def readFile(filename): content = f.read() f.close() return content + +def simpleFileName(navigatorFileName): + return ".".join(navigatorFileName.split(".")[-2:]).replace("\\","") diff --git a/tests/system/suite_editors/tst_modify_readonly/test.py b/tests/system/suite_editors/tst_modify_readonly/test.py index 7d2a05f5aaacb51a1a30164d7acfda33b208962a..d31b244b0c0291017f320e7907344e45cc9498a8 100644 --- a/tests/system/suite_editors/tst_modify_readonly/test.py +++ b/tests/system/suite_editors/tst_modify_readonly/test.py @@ -149,9 +149,6 @@ def checkUnsavedChangesContains(model, filePaths): test.compare(set(foundItems), set(filePaths), "Verifying whether modified (unsaved) files do match expected.") -def simpleFileName(navigatorFileName): - return ".".join(navigatorFileName.split(".")[-2:]).replace("\\","") - def cleanup(): global testFolder if testFolder: diff --git a/tests/system/suite_editors/tst_rename_macros/test.py b/tests/system/suite_editors/tst_rename_macros/test.py index a8c15e5ab12e49515d5fb40586f90fb9ffd4e251..d82b0f666dc5359c5b69cfa186d74fb01e89e7f1 100644 --- a/tests/system/suite_editors/tst_rename_macros/test.py +++ b/tests/system/suite_editors/tst_rename_macros/test.py @@ -166,6 +166,3 @@ def revertChanges(files): "Maybe it has not been changed at all.") else: test.fail("Could not open %s for reverting changes" % simpleName) - -def simpleFileName(navigatorFileName): - return ".".join(navigatorFileName.split(".")[-2:]).replace("\\","") diff --git a/tests/system/suite_editors/tst_revert_changes/test.py b/tests/system/suite_editors/tst_revert_changes/test.py index d9dfdfcc53363d445b114b342aa82fdbc6d61e89..670adcccde6b44aeca9652295db28269da5382d3 100644 --- a/tests/system/suite_editors/tst_revert_changes/test.py +++ b/tests/system/suite_editors/tst_revert_changes/test.py @@ -140,6 +140,3 @@ def compareFileToOriginal(fileName): origFile.close() test.compare(originalContent, currentContent, "Comparing original to reverted file content for '%s'" % fileName) - -def simpleFileName(navigatorFileName): - return ".".join(navigatorFileName.split(".")[-2:]).replace("\\","") diff --git a/tests/system/suite_qtquick/tst_qml_outline/test.py b/tests/system/suite_qtquick/tst_qml_outline/test.py index da41920494f759247352b99f04dcf331cdd62262..2580fcf6de8f1539b156202527e6ca3d6d36df31 100644 --- a/tests/system/suite_qtquick/tst_qml_outline/test.py +++ b/tests/system/suite_qtquick/tst_qml_outline/test.py @@ -147,6 +147,3 @@ def verifyOutline(outlinePseudoTree, datasetFileName): return test.passes("All nodes (%d) inside outline match expected nodes for '%s'." % (len(expected), fileName)) - -def simpleFileName(navigatorFileName): - return ".".join(navigatorFileName.split(".")[-2:]).replace("\\", "")