forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.4'
This commit is contained in:
@@ -805,16 +805,6 @@
|
||||
Format the lambda according to the following rules:
|
||||
|
||||
\list
|
||||
\li Always write parentheses for the parameter list, even if the function does not take
|
||||
parameters.
|
||||
\code
|
||||
[]() { doSomething(); }
|
||||
|
||||
-NOT
|
||||
|
||||
[] { doSomething(); }
|
||||
\endcode
|
||||
|
||||
\li Place the capture-list, parameter list, return type, and opening brace on the first line,
|
||||
the body indented on the following lines, and the closing brace on a new line.
|
||||
\code
|
||||
@@ -859,9 +849,9 @@
|
||||
|
||||
\li Optionally, place the lambda completely on one line if it fits.
|
||||
\code
|
||||
foo([]() { return true; });
|
||||
foo([] { return true; });
|
||||
|
||||
if (foo([]() { return true; })) {
|
||||
if (foo([] { return true; })) {
|
||||
...
|
||||
}
|
||||
\endcode
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
\section1 Attaching to Running Qt Quick Applications
|
||||
|
||||
To profile Qt Quick applications that are not launched by \QC, select
|
||||
\uicontrol {Analyze > QML Profiler (External)}. You must enable QML debugging for
|
||||
\uicontrol {Analyze > QML Profiler (External)}. You must enable QML debugging and profiling for
|
||||
the application in the project build settings. For more information, see
|
||||
\l{Setting Up QML Debugging}.
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
|
||||
\li Debugging is enabled by default for Qt 4.8, or later. For Qt 4.7,
|
||||
select \uicontrol Projects, and then select the
|
||||
\uicontrol {Enable QML debugging} check box in the \uicontrol qmake section
|
||||
in \uicontrol {Build Steps}.
|
||||
\uicontrol {Enable QML debugging and profiling} check box in the \uicontrol qmake
|
||||
section in \uicontrol {Build Steps}.
|
||||
|
||||
You might have to compile the library first, by selecting the
|
||||
\uicontrol Compile link.
|
||||
|
||||
@@ -410,13 +410,15 @@
|
||||
\section2 Project
|
||||
|
||||
A Project page has the \c typeId value \c Project. It contains no data or an
|
||||
empty object.
|
||||
object with the \c trDescription property which will be shown on the generated
|
||||
page.
|
||||
|
||||
\code
|
||||
{
|
||||
"trDisplayName": "Project Location",
|
||||
"trShortTitle": "Location",
|
||||
"typeId": "Project"
|
||||
"typeId": "Project",
|
||||
"data": { "trDescription": "A description of the wizard" }
|
||||
},
|
||||
\endcode
|
||||
|
||||
|
||||
@@ -228,7 +228,6 @@ class Dumper(DumperBase):
|
||||
self.isShuttingDown_ = False
|
||||
self.isInterrupting_ = False
|
||||
self.dummyValue = None
|
||||
self.breakpointsToCheck = set([])
|
||||
self.qmlBreakpointResolvers = {}
|
||||
self.qmlTriggeredBreakpoint = None
|
||||
|
||||
@@ -796,14 +795,6 @@ class Dumper(DumperBase):
|
||||
result += '],current-thread-id="%s"},' % self.currentThread().id
|
||||
self.report(result)
|
||||
|
||||
def reportChangedBreakpoints(self):
|
||||
for i in xrange(0, self.target.GetNumBreakpoints()):
|
||||
bp = self.target.GetBreakpointAtIndex(i)
|
||||
if bp.GetID() in self.breakpointsToCheck:
|
||||
if bp.GetNumLocations():
|
||||
self.breakpointsToCheck.remove(bp.GetID())
|
||||
self.report('breakpoint-changed={%s}' % self.describeBreakpoint(bp))
|
||||
|
||||
def firstUsableFrame(self, thread):
|
||||
for i in xrange(10):
|
||||
frame = thread.GetFrameAtIndex(i)
|
||||
@@ -880,6 +871,11 @@ class Dumper(DumperBase):
|
||||
result += ',limit="%d"' % limit
|
||||
result += '}'
|
||||
self.report(result)
|
||||
self.reportContinuation(args)
|
||||
|
||||
def reportContinuation(self, args):
|
||||
if "continuation" in args:
|
||||
self.report('continuation=\"%s\"' % args["continuation"])
|
||||
|
||||
def reportStackPosition(self):
|
||||
thread = self.currentThread()
|
||||
@@ -943,7 +939,7 @@ class Dumper(DumperBase):
|
||||
|
||||
def putSubItem(self, component, value, tryDynamic=True):
|
||||
if not value.IsValid():
|
||||
warn("INVALID SUBITEM: %s" % value.GetName())
|
||||
self.warn("INVALID SUBITEM: %s" % value.GetName())
|
||||
return
|
||||
with SubItem(self, component):
|
||||
self.putItem(value, tryDynamic)
|
||||
@@ -1325,7 +1321,6 @@ class Dumper(DumperBase):
|
||||
self.reportStackTop()
|
||||
self.reportThreads()
|
||||
self.reportLocation()
|
||||
self.reportChangedBreakpoints()
|
||||
elif eventType == lldb.SBProcess.eBroadcastBitInterrupt: # 2
|
||||
pass
|
||||
elif eventType == lldb.SBProcess.eBroadcastBitSTDOUT:
|
||||
@@ -1441,7 +1436,6 @@ class Dumper(DumperBase):
|
||||
bp.SetEnabled(int(args["enabled"]))
|
||||
if hasattr(bp, 'SetOneShot'):
|
||||
bp.SetOneShot(int(args["oneshot"]))
|
||||
self.breakpointsToCheck.add(bp.GetID())
|
||||
self.report('breakpoint-added={%s,modelid="%s"}' % (self.describeBreakpoint(bp), modelId))
|
||||
|
||||
def changeBreakpoint(self, args):
|
||||
|
||||
@@ -1715,6 +1715,21 @@ def qform__QStack():
|
||||
def qdump__QStack(d, value):
|
||||
qdump__QVector(d, value)
|
||||
|
||||
def qdump__QPolygonF(d, value):
|
||||
qdump__QVector(d, value.cast(d.directBaseClass(value.type, 0)))
|
||||
d.putBetterType(d.currentType)
|
||||
|
||||
def qdump__QPolygon(d, value):
|
||||
qdump__QVector(d, value.cast(d.directBaseClass(value.type, 0)))
|
||||
d.putBetterType(d.currentType)
|
||||
|
||||
def qdump__QGraphicsPolygonItem(d, value):
|
||||
dptr = d.extractPointer(d.addressOf(value) + d.ptrSize()) # Skip vtable
|
||||
# Assume sizeof(QGraphicsPolygonItemPrivate) == 400
|
||||
offset = 308 if d.is32bit() else 384
|
||||
data, size, alloc = d.vectorDataHelper(d.extractPointer(dptr + offset))
|
||||
d.putItemCount(size)
|
||||
d.putPlotData(data, size, d.lookupQtType("QPointF"))
|
||||
|
||||
def qdump__QStandardItem(d, value):
|
||||
d.putBetterType(d.currentType)
|
||||
|
||||
@@ -1217,6 +1217,17 @@ void NodeInstanceServer::sendDebugOutput(DebugOutputCommand::Type type, const QS
|
||||
nodeInstanceClient()->debugOutput(command);
|
||||
}
|
||||
|
||||
void NodeInstanceServer::removeInstanceRelationsipForDeletedObject(QObject *object)
|
||||
{
|
||||
if (m_objectInstanceHash.contains(object)) {
|
||||
ServerNodeInstance instance = instanceForObject(object);
|
||||
m_objectInstanceHash.remove(object);
|
||||
|
||||
if (m_idInstanceHash.contains(instance.instanceId()))
|
||||
m_idInstanceHash.remove(instance.instanceId());
|
||||
}
|
||||
}
|
||||
|
||||
QStringList NodeInstanceServer::dummyDataDirectories(const QString& directoryPath)
|
||||
{
|
||||
QStringList dummyDataDirectoryList;
|
||||
|
||||
@@ -131,6 +131,7 @@ public:
|
||||
void sendDebugOutput(DebugOutputCommand::Type type, const QString &message, qint32 instanceId);
|
||||
void sendDebugOutput(DebugOutputCommand::Type type, const QString &message, const QVector<qint32> &instanceIds);
|
||||
|
||||
void removeInstanceRelationsipForDeletedObject(QObject *object);
|
||||
public slots:
|
||||
void refreshLocalFileProperty(const QString &path);
|
||||
void refreshDummyData(const QString &path);
|
||||
|
||||
@@ -111,7 +111,15 @@ ObjectNodeInstance::ObjectNodeInstance(QObject *object)
|
||||
m_deleteHeldInstance(true),
|
||||
m_isInLayoutable(false)
|
||||
{
|
||||
if (object)
|
||||
QObject::connect(m_object.data(), &QObject::destroyed, [=] {
|
||||
|
||||
/*This lambda is save because m_nodeInstanceServer
|
||||
is a smartpointer and object is a dangling pointer anyway.*/
|
||||
|
||||
if (m_nodeInstanceServer)
|
||||
m_nodeInstanceServer->removeInstanceRelationsipForDeletedObject(object);
|
||||
});
|
||||
}
|
||||
|
||||
ObjectNodeInstance::~ObjectNodeInstance()
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"featuresRequired": [ "Plugin.QmlJSEditor", "QtSupport.Wizards.FeatureQtQuick.UiFiles" ],
|
||||
|
||||
"options" : [
|
||||
{ "key": "QmlFile", "value": "%{Class}.%{JS: Util.preferredSuffix('application/x-qml')}" },
|
||||
{ "key": "QmlFile", "value": "%{Class}.%{JS: Util.preferredSuffix('text/x-qml')}" },
|
||||
{ "key": "UiFile", "value": "%{FormClass}.%{JS: Util.preferredSuffix('application/x-qt.ui+qml')}" }
|
||||
],
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"data":
|
||||
{
|
||||
"source": "file.qml",
|
||||
"target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('application/x-qml')}')}",
|
||||
"target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-qml')}')}",
|
||||
"openInEditor": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"data":
|
||||
{
|
||||
"source": "file.qml",
|
||||
"target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('application/x-qml')}')}",
|
||||
"target": "%{JS: Util.fileName('%{TargetPath}', '%{JS: Util.preferredSuffix('text/x-qml')}')}",
|
||||
"openInEditor": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
{
|
||||
"trDisplayName": "Project Location",
|
||||
"trShortTitle": "Location",
|
||||
"typeId": "Project"
|
||||
"typeId": "Project",
|
||||
"data": { "trDescription": "This wizard creates an empty .pro file." }
|
||||
},
|
||||
{
|
||||
"trDisplayName": "Kit Selection",
|
||||
|
||||
6
src/libs/3rdparty/cplusplus/Token.h
vendored
6
src/libs/3rdparty/cplusplus/Token.h
vendored
@@ -396,6 +396,12 @@ public:
|
||||
struct LanguageFeatures
|
||||
{
|
||||
LanguageFeatures() : flags(0) {}
|
||||
static LanguageFeatures defaultFeatures()
|
||||
{
|
||||
LanguageFeatures features;
|
||||
features.flags = 0xffffffff; // Enable all flags
|
||||
return features;
|
||||
}
|
||||
|
||||
union {
|
||||
unsigned int flags;
|
||||
|
||||
@@ -283,15 +283,8 @@ Document::Document(const QString &fileName)
|
||||
const QByteArray localFileName = fileName.toUtf8();
|
||||
const StringLiteral *fileId = _control->stringLiteral(localFileName.constData(),
|
||||
localFileName.size());
|
||||
LanguageFeatures features;
|
||||
features.qtEnabled = true;
|
||||
features.qtMocRunEnabled = true;
|
||||
features.qtKeywordsEnabled = true;
|
||||
features.cxx11Enabled = true;
|
||||
features.objCEnabled = true;
|
||||
features.c99Enabled = true;
|
||||
_translationUnit = new TranslationUnit(_control, fileId);
|
||||
_translationUnit->setLanguageFeatures(features);
|
||||
_translationUnit->setLanguageFeatures(LanguageFeatures::defaultFeatures());
|
||||
(void) _control->switchTranslationUnit(_translationUnit);
|
||||
}
|
||||
|
||||
@@ -596,6 +589,19 @@ void Document::setUtf8Source(const QByteArray &source)
|
||||
_translationUnit->setSource(_source.constBegin(), _source.size());
|
||||
}
|
||||
|
||||
LanguageFeatures Document::languageFeatures() const
|
||||
{
|
||||
if (TranslationUnit *tu = translationUnit())
|
||||
return tu->languageFeatures();
|
||||
return LanguageFeatures::defaultFeatures();
|
||||
}
|
||||
|
||||
void Document::setLanguageFeatures(LanguageFeatures features)
|
||||
{
|
||||
if (TranslationUnit *tu = translationUnit())
|
||||
tu->setLanguageFeatures(features);
|
||||
}
|
||||
|
||||
void Document::startSkippingBlocks(unsigned utf16charsOffset)
|
||||
{
|
||||
_skippedBlocks.append(Block(0, 0, utf16charsOffset, 0));
|
||||
@@ -767,6 +773,7 @@ Document::Ptr Snapshot::preprocessedDocument(const QByteArray &source,
|
||||
newDoc->_lastModified = thisDocument->_lastModified;
|
||||
newDoc->_resolvedIncludes = thisDocument->_resolvedIncludes;
|
||||
newDoc->_unresolvedIncludes = thisDocument->_unresolvedIncludes;
|
||||
newDoc->setLanguageFeatures(thisDocument->languageFeatures());
|
||||
}
|
||||
|
||||
FastPreprocessor pp(*this);
|
||||
@@ -788,6 +795,7 @@ Document::Ptr Snapshot::documentFromSource(const QByteArray &preprocessedCode,
|
||||
newDoc->_unresolvedIncludes = thisDocument->_unresolvedIncludes;
|
||||
newDoc->_definedMacros = thisDocument->_definedMacros;
|
||||
newDoc->_macroUses = thisDocument->_macroUses;
|
||||
newDoc->setLanguageFeatures(thisDocument->languageFeatures());
|
||||
}
|
||||
|
||||
newDoc->setUtf8Source(preprocessedCode);
|
||||
|
||||
@@ -115,6 +115,9 @@ public:
|
||||
void setFingerprint(const QByteArray &fingerprint)
|
||||
{ m_fingerprint = fingerprint; }
|
||||
|
||||
LanguageFeatures languageFeatures() const;
|
||||
void setLanguageFeatures(LanguageFeatures features);
|
||||
|
||||
void startSkippingBlocks(unsigned utf16charsOffset);
|
||||
void stopSkippingBlocks(unsigned utf16charsOffset);
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ void InvokerBase::invoke(QObject *t, const char *slot)
|
||||
if (paramCount)
|
||||
sig.append(',');
|
||||
const char *type = arg[paramCount].name();
|
||||
sig.append(type, strlen(type));
|
||||
sig.append(type, int(strlen(type)));
|
||||
}
|
||||
sig.append(')');
|
||||
sig.append('\0');
|
||||
|
||||
@@ -94,16 +94,20 @@ inline const char *botanSha1Name() { return "SHA-1"; }
|
||||
|
||||
inline const char *botanHMacAlgoName(const QByteArray &rfcAlgoName)
|
||||
{
|
||||
Q_ASSERT(rfcAlgoName == SshCapabilities::HMacSha1);
|
||||
Q_UNUSED(rfcAlgoName);
|
||||
Q_ASSERT(rfcAlgoName == SshCapabilities::HMacSha1
|
||||
|| rfcAlgoName == SshCapabilities::HMacSha256);
|
||||
if (rfcAlgoName == SshCapabilities::HMacSha1)
|
||||
return botanSha1Name();
|
||||
return "SHA-256";
|
||||
}
|
||||
|
||||
inline quint32 botanHMacKeyLen(const QByteArray &rfcAlgoName)
|
||||
{
|
||||
Q_ASSERT(rfcAlgoName == SshCapabilities::HMacSha1);
|
||||
Q_UNUSED(rfcAlgoName);
|
||||
Q_ASSERT(rfcAlgoName == SshCapabilities::HMacSha1
|
||||
|| rfcAlgoName == SshCapabilities::HMacSha256);
|
||||
if (rfcAlgoName == SshCapabilities::HMacSha1)
|
||||
return 20;
|
||||
return 32;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -78,8 +78,10 @@ const QList<QByteArray> SshCapabilities::EncryptionAlgorithms
|
||||
|
||||
const QByteArray SshCapabilities::HMacSha1("hmac-sha1");
|
||||
const QByteArray SshCapabilities::HMacSha196("hmac-sha1-96");
|
||||
const QByteArray SshCapabilities::HMacSha256("hmac-sha2-256");
|
||||
const QList<QByteArray> SshCapabilities::MacAlgorithms
|
||||
= QList<QByteArray>() /* << SshCapabilities::HMacSha196 */
|
||||
<< SshCapabilities::HMacSha256 // Recommended as per RFC 6668
|
||||
<< SshCapabilities::HMacSha1;
|
||||
|
||||
const QList<QByteArray> SshCapabilities::CompressionAlgorithms
|
||||
|
||||
@@ -58,6 +58,7 @@ public:
|
||||
|
||||
static const QByteArray HMacSha1;
|
||||
static const QByteArray HMacSha196;
|
||||
static const QByteArray HMacSha256;
|
||||
static const QList<QByteArray> MacAlgorithms;
|
||||
|
||||
static const QList<QByteArray> CompressionAlgorithms;
|
||||
|
||||
@@ -956,8 +956,5 @@ void MimeXMLProvider::addMagicMatcher(const MimeMagicRuleMatcher &matcher)
|
||||
void MimeXMLProvider::addFile(const QString &filePath)
|
||||
{
|
||||
m_additionalFiles.append(filePath);
|
||||
if (m_loaded) {
|
||||
m_allFiles.append(filePath);
|
||||
load(filePath);
|
||||
} // else: will be loaded in ensureLoaded()
|
||||
m_loaded = false; // force reload to ensure correct load order for overridden mime types
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="nameLabel">
|
||||
<property name="text">
|
||||
|
||||
@@ -705,6 +705,8 @@ void TreeItem::insertChild(int pos, TreeItem *item)
|
||||
m_model->endInsertRows();
|
||||
} else {
|
||||
item->m_parent = this;
|
||||
if (m_model)
|
||||
item->propagateModel(m_model);
|
||||
m_children.insert(m_children.begin() + pos, item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,14 +153,8 @@ public:
|
||||
void handleToolFinished();
|
||||
void saveToolSettings(Id toolId);
|
||||
void loadToolSettings(Id toolId);
|
||||
|
||||
// Convenience.
|
||||
bool isActionRunnable(AnalyzerAction *action) const;
|
||||
|
||||
public slots:
|
||||
void startTool();
|
||||
void selectToolboxAction(int);
|
||||
void selectMenuAction();
|
||||
void modeChanged(IMode *mode);
|
||||
void resetLayout();
|
||||
void updateRunActions();
|
||||
@@ -424,20 +418,10 @@ bool AnalyzerManagerPrivate::showPromptDialog(const QString &title, const QStrin
|
||||
return messageBox.clickedStandardButton() == QDialogButtonBox::Yes;
|
||||
}
|
||||
|
||||
bool AnalyzerManagerPrivate::isActionRunnable(AnalyzerAction *action) const
|
||||
{
|
||||
if (!action || m_isRunning)
|
||||
return false;
|
||||
if (action->startMode() == StartRemote)
|
||||
return true;
|
||||
|
||||
return ProjectExplorerPlugin::canRun(SessionManager::startupProject(), action->runMode(), 0);
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::startTool()
|
||||
{
|
||||
QTC_ASSERT(m_currentAction, return);
|
||||
m_currentAction->toolStarter()(m_currentAction->startMode());
|
||||
m_currentAction->toolStarter()();
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::modeChanged(IMode *mode)
|
||||
@@ -472,15 +456,6 @@ void AnalyzerManagerPrivate::selectSavedTool()
|
||||
selectAction(m_actions.first());
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::selectMenuAction()
|
||||
{
|
||||
AnalyzerManager::showMode();
|
||||
AnalyzerAction *action = qobject_cast<AnalyzerAction *>(sender());
|
||||
QTC_ASSERT(action, return);
|
||||
selectAction(action);
|
||||
startTool();
|
||||
}
|
||||
|
||||
void AnalyzerManagerPrivate::selectToolboxAction(int index)
|
||||
{
|
||||
selectAction(m_actions[index]);
|
||||
@@ -540,7 +515,13 @@ void AnalyzerManagerPrivate::addAction(AnalyzerAction *action)
|
||||
m_actions.append(action);
|
||||
m_toolBox->addItem(action->text());
|
||||
m_toolBox->blockSignals(blocked);
|
||||
connect(action, &QAction::triggered, this, &AnalyzerManagerPrivate::selectMenuAction);
|
||||
|
||||
connect(action, &QAction::triggered, this, [this, action] {
|
||||
AnalyzerManager::showMode();
|
||||
selectAction(action);
|
||||
startTool();
|
||||
});
|
||||
|
||||
m_toolBox->setEnabled(true);
|
||||
}
|
||||
|
||||
@@ -583,20 +564,23 @@ void AnalyzerManagerPrivate::saveToolSettings(Id toolId)
|
||||
void AnalyzerManagerPrivate::updateRunActions()
|
||||
{
|
||||
QString disabledReason;
|
||||
if (m_isRunning)
|
||||
bool enabled = true;
|
||||
if (m_isRunning) {
|
||||
disabledReason = tr("An analysis is still in progress.");
|
||||
else if (!m_currentAction)
|
||||
enabled = false;
|
||||
} else if (!m_currentAction) {
|
||||
disabledReason = tr("No analyzer tool selected.");
|
||||
else
|
||||
ProjectExplorerPlugin::canRun(SessionManager::startupProject(),
|
||||
m_currentAction->runMode(), &disabledReason);
|
||||
enabled = false;
|
||||
} else {
|
||||
enabled = m_currentAction->isRunnable(&disabledReason);
|
||||
}
|
||||
|
||||
m_startAction->setEnabled(isActionRunnable(m_currentAction));
|
||||
m_startAction->setEnabled(enabled);
|
||||
m_startAction->setToolTip(disabledReason);
|
||||
m_toolBox->setEnabled(!m_isRunning);
|
||||
m_stopAction->setEnabled(m_isRunning);
|
||||
foreach (AnalyzerAction *action, m_actions)
|
||||
action->setEnabled(isActionRunnable(action));
|
||||
action->setEnabled(!m_isRunning && action->isRunnable());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@@ -643,10 +627,10 @@ QDockWidget *AnalyzerManager::createDockWidget(Core::Id toolId,
|
||||
return dockWidget;
|
||||
}
|
||||
|
||||
void AnalyzerManager::selectTool(Id toolId, StartMode mode)
|
||||
void AnalyzerManager::selectTool(Id actionId)
|
||||
{
|
||||
foreach (AnalyzerAction *action, d->m_actions)
|
||||
if (action->toolId() == toolId && action->startMode() == mode)
|
||||
if (action->actionId() == actionId)
|
||||
d->selectAction(action);
|
||||
}
|
||||
|
||||
@@ -706,8 +690,8 @@ AnalyzerRunControl *AnalyzerManager::createRunControl(
|
||||
const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration)
|
||||
{
|
||||
foreach (AnalyzerAction *action, d->m_actions) {
|
||||
if (action->runMode() == sp.runMode && action->startMode() == sp.startMode)
|
||||
return action->createRunControl(sp, runConfiguration);
|
||||
if (AnalyzerRunControl *rc = action->tryCreateRunControl(sp, runConfiguration))
|
||||
return rc;
|
||||
}
|
||||
QTC_CHECK(false);
|
||||
return 0;
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
static Utils::FancyMainWindow *mainWindow();
|
||||
|
||||
static void showMode();
|
||||
static void selectTool(Core::Id toolId, StartMode mode);
|
||||
static void selectTool(Core::Id actionId);
|
||||
static void startTool();
|
||||
static void stopTool();
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ void DetailedErrorDelegate::onVerticalScroll()
|
||||
// Expects "file://some/path[:line[:column]]" - the line/column part is optional
|
||||
void DetailedErrorDelegate::openLinkInEditor(const QString &link)
|
||||
{
|
||||
const QString linkWithoutPrefix = link.mid(strlen("file://"));
|
||||
const QString linkWithoutPrefix = link.mid(int(strlen("file://")));
|
||||
const QChar separator = QLatin1Char(':');
|
||||
const int lineColon = linkWithoutPrefix.indexOf(separator, /*after drive letter + colon =*/ 2);
|
||||
const QString path = linkWithoutPrefix.left(lineColon);
|
||||
|
||||
@@ -62,6 +62,21 @@ AnalyzerAction::AnalyzerAction(QObject *parent)
|
||||
: QAction(parent)
|
||||
{}
|
||||
|
||||
bool AnalyzerAction::isRunnable(QString *reason) const
|
||||
{
|
||||
if (m_startMode == StartRemote)
|
||||
return true;
|
||||
|
||||
return ProjectExplorerPlugin::canRun(SessionManager::startupProject(), m_runMode, reason);
|
||||
}
|
||||
|
||||
AnalyzerRunControl *AnalyzerAction::tryCreateRunControl(const AnalyzerStartParameters &sp, RunConfiguration *runConfiguration) const
|
||||
{
|
||||
if (m_runMode == sp.runMode && m_startMode == sp.startMode)
|
||||
return m_runControlCreator(sp, runConfiguration);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool buildTypeAccepted(ToolMode toolMode, BuildConfiguration::BuildType buildType)
|
||||
{
|
||||
if (toolMode == AnyMode)
|
||||
|
||||
@@ -79,7 +79,6 @@ public:
|
||||
explicit AnalyzerAction(QObject *parent = 0);
|
||||
|
||||
public:
|
||||
StartMode startMode() const { return m_startMode; }
|
||||
void setStartMode(StartMode startMode) { m_startMode = startMode; }
|
||||
|
||||
Core::Id menuGroup() const { return m_menuGroup; }
|
||||
@@ -91,8 +90,8 @@ public:
|
||||
Core::Id toolId() const { return m_toolId; }
|
||||
void setToolId(Core::Id id) { m_toolId = id; }
|
||||
|
||||
ProjectExplorer::RunMode runMode() const { return m_runMode; }
|
||||
void setRunMode(ProjectExplorer::RunMode mode) { m_runMode = mode; }
|
||||
bool isRunnable(QString *reason = 0) const;
|
||||
|
||||
/// Creates all widgets used by the tool.
|
||||
/// Returns a control widget which will be shown in the status bar when
|
||||
@@ -105,12 +104,11 @@ public:
|
||||
/// Called each time the tool is launched.
|
||||
typedef std::function<AnalyzerRunControl *(const AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration)> RunControlCreator;
|
||||
AnalyzerRunControl *createRunControl(const AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration) const
|
||||
{ return m_runControlCreator(sp, runConfiguration); }
|
||||
AnalyzerRunControl *tryCreateRunControl(const AnalyzerStartParameters &sp,
|
||||
ProjectExplorer::RunConfiguration *runConfiguration) const;
|
||||
void setRunControlCreator(const RunControlCreator &creator) { m_runControlCreator = creator; }
|
||||
|
||||
typedef std::function<void(StartMode)> ToolStarter;
|
||||
typedef std::function<void()> ToolStarter;
|
||||
ToolStarter toolStarter() const { return m_toolStarter; }
|
||||
void setToolStarter(const ToolStarter &toolStarter) { m_toolStarter = toolStarter; }
|
||||
|
||||
|
||||
@@ -55,8 +55,7 @@ QString AndroidPotentialKit::displayName() const
|
||||
|
||||
void AndroidPotentialKit::executeFromMenu()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(Constants::ANDROID_SETTINGS_CATEGORY,
|
||||
Constants::ANDROID_SETTINGS_ID);
|
||||
Core::ICore::showOptionsDialog(Constants::ANDROID_SETTINGS_ID);
|
||||
}
|
||||
|
||||
QWidget *AndroidPotentialKit::createWidget(QWidget *parent) const
|
||||
@@ -120,9 +119,7 @@ AndroidPotentialKitWidget::AndroidPotentialKitWidget(QWidget *parent)
|
||||
|
||||
void AndroidPotentialKitWidget::openOptions()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(Constants::ANDROID_SETTINGS_CATEGORY,
|
||||
Constants::ANDROID_SETTINGS_ID,
|
||||
this);
|
||||
Core::ICore::showOptionsDialog(Constants::ANDROID_SETTINGS_ID, this);
|
||||
}
|
||||
|
||||
void AndroidPotentialKitWidget::recheck()
|
||||
|
||||
@@ -52,7 +52,7 @@ static QString pathFromId(Core::Id id)
|
||||
QByteArray idStr = id.name();
|
||||
if (!idStr.startsWith(BareMetalRunConfiguration::IdPrefix))
|
||||
return QString();
|
||||
return QString::fromUtf8(idStr.mid(strlen(BareMetalRunConfiguration::IdPrefix)));
|
||||
return QString::fromUtf8(idStr.mid(int(strlen(BareMetalRunConfiguration::IdPrefix))));
|
||||
}
|
||||
|
||||
BareMetalRunConfigurationFactory::BareMetalRunConfigurationFactory(QObject *parent) :
|
||||
|
||||
@@ -85,8 +85,7 @@ void GdbServerProviderChooser::setCurrentProviderId(const QString &id)
|
||||
|
||||
void GdbServerProviderChooser::manageButtonClicked()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(Constants::BAREMETAL_SETTINGS_CATEGORY,
|
||||
Constants::GDB_PROVIDERS_SETTINGS_ID, this);
|
||||
Core::ICore::showOptionsDialog(Constants::GDB_PROVIDERS_SETTINGS_ID, this);
|
||||
}
|
||||
|
||||
void GdbServerProviderChooser::currentIndexChanged(int index)
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
<string>Configuration</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="commandLabel">
|
||||
<property name="text">
|
||||
@@ -39,6 +42,9 @@
|
||||
<string>User</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="defaultUsernameLabel">
|
||||
<property name="toolTip">
|
||||
|
||||
@@ -304,6 +304,7 @@ void PchManager::doPchInfoUpdateFuzzy(QFutureInterface<void> &future,
|
||||
projectPart->languageVersion = languageVersions[pch];
|
||||
projectPart->languageExtensions = languageExtensionsMap[pch];
|
||||
projectPart->headerPaths = headers[pch].toList();
|
||||
projectPart->updateLanguageFeatures();
|
||||
|
||||
QList<QByteArray> defines = definesPerPCH[pch].toList();
|
||||
if (!defines.isEmpty()) {
|
||||
@@ -386,6 +387,7 @@ void PchManager::doPchInfoUpdateCustom(QFutureInterface<void> &future,
|
||||
objc |= hasObjCFiles(projectPart);
|
||||
cplusplus |= hasCppFiles(projectPart);
|
||||
}
|
||||
united->updateLanguageFeatures();
|
||||
united->headerPaths = headers;
|
||||
QStringList opts = Utils::createClangOptions(
|
||||
united, getPrefixFileKind(objc, cplusplus));
|
||||
|
||||
@@ -290,9 +290,7 @@ bool NoKitPage::isComplete() const
|
||||
|
||||
void NoKitPage::showOptions()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(Core::Id(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
|
||||
Core::Id(ProjectExplorer::Constants::KITS_SETTINGS_PAGE_ID),
|
||||
this);
|
||||
Core::ICore::showOptionsDialog(ProjectExplorer::Constants::KITS_SETTINGS_PAGE_ID, this);
|
||||
}
|
||||
|
||||
InSourceBuildPage::InSourceBuildPage(CMakeOpenProjectWizard *cmakeWizard)
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
#include <QStyle>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
static const char categoryKeyC[] = "General/LastPreferenceCategory";
|
||||
static const char pageKeyC[] = "General/LastPreferencePage";
|
||||
const int categoryIconSize = 24;
|
||||
|
||||
@@ -70,6 +69,18 @@ class Category
|
||||
public:
|
||||
Category() : index(-1), providerPagesCreated(false) { }
|
||||
|
||||
bool findPageById(const Id id, int *pageIndex) const
|
||||
{
|
||||
for (int j = 0; j < pages.size(); ++j) {
|
||||
IOptionsPage *page = pages.at(j);
|
||||
if (page->id() == id) {
|
||||
*pageIndex = j;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Id id;
|
||||
int index;
|
||||
QString displayName;
|
||||
@@ -333,54 +344,61 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
|
||||
m_categoryList->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
m_categoryList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||
|
||||
connect(m_categoryList->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
|
||||
this, SLOT(currentChanged(QModelIndex)));
|
||||
connect(m_categoryList->selectionModel(), &QItemSelectionModel::currentRowChanged,
|
||||
this, &SettingsDialog::currentChanged);
|
||||
|
||||
// The order of the slot connection matters here, the filter slot
|
||||
// opens the matching page after the model has filtered.
|
||||
connect(m_filterLineEdit, SIGNAL(filterChanged(QString)),
|
||||
m_proxyModel, SLOT(setFilterFixedString(QString)));
|
||||
connect(m_filterLineEdit, SIGNAL(filterChanged(QString)), this, SLOT(filter(QString)));
|
||||
connect(m_filterLineEdit, &Utils::FancyLineEdit::filterChanged,
|
||||
m_proxyModel, &QSortFilterProxyModel::setFilterFixedString);
|
||||
connect(m_filterLineEdit, &Utils::FancyLineEdit::filterChanged,
|
||||
this, &SettingsDialog::filter);
|
||||
m_categoryList->setFocus();
|
||||
}
|
||||
|
||||
void SettingsDialog::showPage(Id categoryId, Id pageId)
|
||||
void SettingsDialog::showPage(const Id pageId)
|
||||
{
|
||||
// handle the case of "show last page"
|
||||
Id initialCategory = categoryId;
|
||||
Id initialPage = pageId;
|
||||
if (!initialCategory.isValid() && !initialPage.isValid()) {
|
||||
Id initialPageId = pageId;
|
||||
if (!initialPageId.isValid()) {
|
||||
QSettings *settings = ICore::settings();
|
||||
initialCategory = Id::fromSetting(settings->value(QLatin1String(categoryKeyC)));
|
||||
initialPage = Id::fromSetting(settings->value(QLatin1String(pageKeyC)));
|
||||
initialPageId = Id::fromSetting(settings->value(QLatin1String(pageKeyC)));
|
||||
}
|
||||
|
||||
if (!initialCategory.isValid()) // no category given and no old setting
|
||||
return;
|
||||
|
||||
int initialCategoryIndex = -1;
|
||||
int initialPageIndex = -1;
|
||||
|
||||
const QList<Category*> &categories = m_model->categories();
|
||||
if (initialPageId.isValid()) {
|
||||
// First try categories without lazy items.
|
||||
for (int i = 0; i < categories.size(); ++i) {
|
||||
Category *category = categories.at(i);
|
||||
if (category->id == initialCategory) {
|
||||
initialCategoryIndex = i;
|
||||
if (initialPage.isValid()) {
|
||||
if (category->providers.isEmpty()) { // no providers
|
||||
ensureCategoryWidget(category);
|
||||
for (int j = 0; j < category->pages.size(); ++j) {
|
||||
IOptionsPage *page = category->pages.at(j);
|
||||
if (page->id() == initialPage)
|
||||
initialPageIndex = j;
|
||||
}
|
||||
}
|
||||
if (category->findPageById(initialPageId, &initialPageIndex)) {
|
||||
initialCategoryIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QTC_ASSERT(initialCategoryIndex != -1,
|
||||
qDebug("Unknown category: %s", initialCategory.name().constData()); return);
|
||||
QTC_ASSERT(!initialPage.isValid() || initialPageIndex != -1,
|
||||
qDebug("Unknown page: %s", initialPage.name().constData()));
|
||||
if (initialPageIndex == -1) {
|
||||
// On failure, expand the remaining items.
|
||||
for (int i = 0; i < categories.size(); ++i) {
|
||||
Category *category = categories.at(i);
|
||||
if (!category->providers.isEmpty()) { // has providers
|
||||
ensureCategoryWidget(category);
|
||||
if (category->findPageById(initialPageId, &initialPageIndex)) {
|
||||
initialCategoryIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QTC_ASSERT(!initialPageId.isValid() || initialPageIndex != -1,
|
||||
qDebug("Unknown page: %s", initialPageId.name().constData()));
|
||||
|
||||
if (initialCategoryIndex != -1) {
|
||||
const QModelIndex modelIndex = m_proxyModel->mapFromSource(m_model->index(initialCategoryIndex));
|
||||
@@ -412,9 +430,11 @@ void SettingsDialog::createGui()
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok |
|
||||
QDialogButtonBox::Apply |
|
||||
QDialogButtonBox::Cancel);
|
||||
connect(buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
|
||||
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
connect(buttonBox->button(QDialogButtonBox::Apply), &QAbstractButton::clicked,
|
||||
this, &SettingsDialog::apply);
|
||||
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::accept);
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &SettingsDialog::reject);
|
||||
|
||||
QGridLayout *mainGridLayout = new QGridLayout;
|
||||
mainGridLayout->addWidget(m_filterLineEdit, 0, 0, 1, 1);
|
||||
@@ -474,8 +494,8 @@ void SettingsDialog::ensureCategoryWidget(Category *category)
|
||||
tabWidget->addTab(widget, page->displayName());
|
||||
}
|
||||
|
||||
connect(tabWidget, SIGNAL(currentChanged(int)),
|
||||
this, SLOT(currentTabChanged(int)));
|
||||
connect(tabWidget, &QTabWidget::currentChanged,
|
||||
this, &SettingsDialog::currentTabChanged);
|
||||
|
||||
category->tabWidget = tabWidget;
|
||||
category->index = m_stackedLayout->addWidget(tabWidget);
|
||||
@@ -485,8 +505,8 @@ void SettingsDialog::disconnectTabWidgets()
|
||||
{
|
||||
foreach (Category *category, m_model->categories()) {
|
||||
if (category->tabWidget)
|
||||
disconnect(category->tabWidget, SIGNAL(currentChanged(int)),
|
||||
this, SLOT(currentTabChanged(int)));
|
||||
disconnect(category->tabWidget, &QTabWidget::currentChanged,
|
||||
this, &SettingsDialog::currentTabChanged);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,7 +605,6 @@ void SettingsDialog::apply()
|
||||
void SettingsDialog::done(int val)
|
||||
{
|
||||
QSettings *settings = ICore::settings();
|
||||
settings->setValue(QLatin1String(categoryKeyC), m_currentCategory.toSetting());
|
||||
settings->setValue(QLatin1String(pageKeyC), m_currentPage.toSetting());
|
||||
|
||||
ICore::saveSettings(); // save all settings
|
||||
@@ -609,12 +628,11 @@ QSize SettingsDialog::sizeHint() const
|
||||
return minimumSize();
|
||||
}
|
||||
|
||||
SettingsDialog *SettingsDialog::getSettingsDialog(QWidget *parent,
|
||||
Id initialCategory, Id initialPage)
|
||||
SettingsDialog *SettingsDialog::getSettingsDialog(QWidget *parent, Id initialPage)
|
||||
{
|
||||
if (!m_instance)
|
||||
m_instance = new SettingsDialog(parent);
|
||||
m_instance->showPage(initialCategory, initialPage);
|
||||
m_instance->showPage(initialPage);
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,8 +62,7 @@ public:
|
||||
// Returns a settings dialog. This makes sure that always only
|
||||
// a single settings dialog instance is running.
|
||||
// The dialog will be deleted automatically on close.
|
||||
static SettingsDialog *getSettingsDialog(QWidget *parent,
|
||||
Id initialCategory, Id initialPage);
|
||||
static SettingsDialog *getSettingsDialog(QWidget *parent, Id initialPage);
|
||||
// Run the dialog and wait for it to finish.
|
||||
// Returns if the changes have been applied.
|
||||
bool execDialog();
|
||||
@@ -73,7 +72,10 @@ public:
|
||||
public slots:
|
||||
void done(int);
|
||||
|
||||
private slots:
|
||||
private:
|
||||
SettingsDialog(QWidget *parent);
|
||||
~SettingsDialog();
|
||||
|
||||
void accept();
|
||||
void reject();
|
||||
void apply();
|
||||
@@ -81,13 +83,9 @@ private slots:
|
||||
void currentTabChanged(int);
|
||||
void filter(const QString &text);
|
||||
|
||||
private:
|
||||
SettingsDialog(QWidget *parent);
|
||||
~SettingsDialog();
|
||||
|
||||
void createGui();
|
||||
void showCategory(int index);
|
||||
void showPage(Id categoryId, Id pageId);
|
||||
void showPage(Id pageId);
|
||||
void updateEnabledTabs(Category *category, const QString &searchText);
|
||||
void ensureCategoryWidget(Category *category);
|
||||
void disconnectTabWidgets();
|
||||
|
||||
@@ -190,8 +190,10 @@ DocumentModel::Entry *DocumentModel::firstRestoredEntry()
|
||||
|
||||
void DocumentModelPrivate::addEntry(DocumentModel::Entry *entry)
|
||||
{
|
||||
const Utils::FileName fileName = entry->fileName();
|
||||
|
||||
// replace a non-loaded entry (aka 'restored') if possible
|
||||
int previousIndex = indexOfFilePath(entry->fileName());
|
||||
int previousIndex = indexOfFilePath(fileName);
|
||||
if (previousIndex >= 0) {
|
||||
if (entry->document && m_entries.at(previousIndex)->document == 0) {
|
||||
DocumentModel::Entry *previousEntry = m_entries.at(previousIndex);
|
||||
@@ -265,13 +267,13 @@ void DocumentModelPrivate::removeDocument(int idx)
|
||||
if (idx < 0)
|
||||
return;
|
||||
QTC_ASSERT(idx < d->m_entries.size(), return);
|
||||
IDocument *document = d->m_entries.at(idx)->document;
|
||||
int row = idx + 1/*<no document>*/;
|
||||
beginRemoveRows(QModelIndex(), row, row);
|
||||
delete d->m_entries.takeAt(idx);
|
||||
DocumentModel::Entry *entry = d->m_entries.takeAt(idx);
|
||||
endRemoveRows();
|
||||
if (document)
|
||||
if (IDocument *document = entry->document)
|
||||
disconnect(document, SIGNAL(changed()), this, SLOT(itemChanged()));
|
||||
delete entry;
|
||||
}
|
||||
|
||||
void DocumentModel::removeAllRestoredEntries()
|
||||
|
||||
@@ -1696,8 +1696,12 @@ bool EditorManagerPrivate::saveDocumentAs(IDocument *document)
|
||||
|
||||
Utils::MimeDatabase mdb;
|
||||
const QString filter = Utils::MimeDatabase::allFiltersString();
|
||||
QString selectedFilter =
|
||||
mdb.mimeTypeForFile(document->filePath().toFileInfo()).filterString();
|
||||
QString selectedFilter;
|
||||
QString filePath = document->filePath().toString();
|
||||
if (filePath.isEmpty())
|
||||
filePath = document->defaultPath() + QLatin1Char('/') + document->suggestedFileName();
|
||||
if (!filePath.isEmpty())
|
||||
selectedFilter = mdb.mimeTypeForFile(filePath).filterString();
|
||||
if (selectedFilter.isEmpty())
|
||||
selectedFilter = mdb.mimeTypeForName(document->mimeType()).filterString();
|
||||
const QString &absoluteFilePath =
|
||||
@@ -2195,36 +2199,42 @@ IEditor *EditorManager::activateEditorForDocument(IDocument *document, OpenEdito
|
||||
* or IExternalEditor), find the one best matching the mimetype passed in.
|
||||
* Recurse over the parent classes of the mimetype to find them. */
|
||||
template <class EditorFactoryLike>
|
||||
static void mimeTypeFactoryRecursion(const Utils::MimeType &mimeType,
|
||||
static void mimeTypeFactoryLookup(const Utils::MimeType &mimeType,
|
||||
const QList<EditorFactoryLike*> &allFactories,
|
||||
bool firstMatchOnly,
|
||||
QList<EditorFactoryLike*> *list)
|
||||
{
|
||||
typedef typename QList<EditorFactoryLike*>::const_iterator EditorFactoryLikeListConstIterator;
|
||||
// Loop factories to find type
|
||||
const EditorFactoryLikeListConstIterator fcend = allFactories.constEnd();
|
||||
for (EditorFactoryLikeListConstIterator fit = allFactories.constBegin(); fit != fcend; ++fit) {
|
||||
// Exclude duplicates when recursing over xml or C++ -> C -> text.
|
||||
EditorFactoryLike *factory = *fit;
|
||||
if (!list->contains(factory)) {
|
||||
foreach (const QString &mt, factory->mimeTypes()) {
|
||||
if (mimeType.matchesName(mt)) {
|
||||
list->push_back(*fit);
|
||||
Utils::MimeDatabase mdb;
|
||||
QSet<EditorFactoryLike *> matches;
|
||||
// search breadth-first through parent hierarchy, e.g. for hierarchy
|
||||
// * application/x-ruby
|
||||
// * application/x-executable
|
||||
// * application/octet-stream
|
||||
// * text/plain
|
||||
QList<Utils::MimeType> queue;
|
||||
queue.append(mimeType);
|
||||
while (!queue.isEmpty()) {
|
||||
Utils::MimeType mt = queue.takeFirst();
|
||||
// check for matching factories
|
||||
foreach (EditorFactoryLike *factory, allFactories) {
|
||||
if (!matches.contains(factory)) {
|
||||
foreach (const QString &mimeName, factory->mimeTypes()) {
|
||||
if (mt.matchesName(mimeName)) {
|
||||
list->append(factory);
|
||||
if (firstMatchOnly)
|
||||
return;
|
||||
matches.insert(factory);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Any parent mime type classes? -> recurse
|
||||
QStringList parentNames = mimeType.parentMimeTypes();
|
||||
if (parentNames.empty())
|
||||
return;
|
||||
Utils::MimeDatabase mdb;
|
||||
// add parent mime types
|
||||
QStringList parentNames = mt.parentMimeTypes();
|
||||
foreach (const QString &parentName, parentNames) {
|
||||
const Utils::MimeType parent = mdb.mimeTypeForName(parentName);
|
||||
if (parent.isValid())
|
||||
mimeTypeFactoryRecursion(parent, allFactories, firstMatchOnly, list);
|
||||
queue.append(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2233,7 +2243,7 @@ EditorManager::EditorFactoryList
|
||||
{
|
||||
EditorFactoryList rc;
|
||||
const EditorFactoryList allFactories = ExtensionSystem::PluginManager::getObjects<IEditorFactory>();
|
||||
mimeTypeFactoryRecursion(mimeType, allFactories, bestMatchOnly, &rc);
|
||||
mimeTypeFactoryLookup(mimeType, allFactories, bestMatchOnly, &rc);
|
||||
if (debugEditorManager)
|
||||
qDebug() << Q_FUNC_INFO << mimeType.name() << " returns " << rc;
|
||||
return rc;
|
||||
@@ -2244,7 +2254,7 @@ EditorManager::ExternalEditorList
|
||||
{
|
||||
ExternalEditorList rc;
|
||||
const ExternalEditorList allEditors = ExtensionSystem::PluginManager::getObjects<IExternalEditor>();
|
||||
mimeTypeFactoryRecursion(mimeType, allEditors, bestMatchOnly, &rc);
|
||||
mimeTypeFactoryLookup(mimeType, allEditors, bestMatchOnly, &rc);
|
||||
if (debugEditorManager)
|
||||
qDebug() << Q_FUNC_INFO << mimeType.name() << " returns " << rc;
|
||||
return rc;
|
||||
|
||||
@@ -80,7 +80,9 @@ ExternalToolManager::ExternalToolManager()
|
||||
d->m_configureSeparator = new QAction(this);
|
||||
d->m_configureSeparator->setSeparator(true);
|
||||
d->m_configureAction = new QAction(ICore::msgShowOptionsDialog(), this);
|
||||
connect(d->m_configureAction, SIGNAL(triggered()), this, SLOT(openPreferences()));
|
||||
connect(d->m_configureAction, &QAction::triggered, [this] {
|
||||
ICore::showOptionsDialog(Constants::SETTINGS_ID_TOOLS);
|
||||
});
|
||||
|
||||
// add the external tools menu
|
||||
ActionContainer *mexternaltools = ActionManager::createMenu(Id(Constants::M_TOOLS_EXTERNAL));
|
||||
@@ -159,17 +161,6 @@ static void parseDirectory(const QString &directory,
|
||||
}
|
||||
}
|
||||
|
||||
void ExternalToolManager::menuActivated()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
QTC_ASSERT(action, return);
|
||||
ExternalTool *tool = d->m_tools.value(action->data().toString());
|
||||
QTC_ASSERT(tool, return);
|
||||
ExternalToolRunner *runner = new ExternalToolRunner(tool);
|
||||
if (runner->hasError())
|
||||
MessageManager::write(runner->errorString());
|
||||
}
|
||||
|
||||
QMap<QString, QList<ExternalTool *> > ExternalToolManager::toolsByCategory()
|
||||
{
|
||||
return d->m_categoryMap;
|
||||
@@ -246,9 +237,13 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<ExternalT
|
||||
command = ActionManager::command(externalToolsPrefix.withSuffix(toolId));
|
||||
} else {
|
||||
action = new QAction(tool->displayName(), m_instance);
|
||||
action->setData(toolId);
|
||||
d->m_actions.insert(toolId, action);
|
||||
connect(action, SIGNAL(triggered()), m_instance, SLOT(menuActivated()));
|
||||
connect(action, &QAction::triggered, [tool] {
|
||||
ExternalToolRunner *runner = new ExternalToolRunner(tool);
|
||||
if (runner->hasError())
|
||||
MessageManager::write(runner->errorString());
|
||||
});
|
||||
|
||||
command = ActionManager::registerAction(action, externalToolsPrefix.withSuffix(toolId), Context(Constants::C_GLOBAL));
|
||||
command->setAttribute(Command::CA_UpdateText);
|
||||
}
|
||||
@@ -330,11 +325,6 @@ static void writeSettings()
|
||||
settings->endGroup();
|
||||
}
|
||||
|
||||
void ExternalToolManager::openPreferences()
|
||||
{
|
||||
ICore::showOptionsDialog(Constants::SETTINGS_CATEGORY_CORE, Constants::SETTINGS_ID_TOOLS);
|
||||
}
|
||||
|
||||
void ExternalToolManager::emitReplaceSelectionRequested(const QString &output)
|
||||
{
|
||||
emit m_instance->replaceSelectionRequested(output);
|
||||
|
||||
@@ -58,10 +58,6 @@ public:
|
||||
|
||||
signals:
|
||||
void replaceSelectionRequested(const QString &text);
|
||||
|
||||
private slots:
|
||||
void menuActivated();
|
||||
void openPreferences();
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -66,11 +66,8 @@ static void showGraphicalShellError(QWidget *parent, const QString &app, const Q
|
||||
QAbstractButton *settingsButton = mbox.addButton(Core::ICore::msgShowOptionsDialog(),
|
||||
QMessageBox::ActionRole);
|
||||
mbox.exec();
|
||||
if (mbox.clickedButton() == settingsButton) {
|
||||
ICore::showOptionsDialog(Constants::SETTINGS_CATEGORY_CORE,
|
||||
Constants::SETTINGS_ID_ENVIRONMENT,
|
||||
parent);
|
||||
}
|
||||
if (mbox.clickedButton() == settingsButton)
|
||||
ICore::showOptionsDialog(Constants::SETTINGS_ID_ENVIRONMENT, parent);
|
||||
}
|
||||
|
||||
void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn)
|
||||
|
||||
@@ -337,9 +337,9 @@ void ICore::showNewItemDialog(const QString &title,
|
||||
m_mainwindow->showNewItemDialog(title, factories, defaultLocation, extraVariables);
|
||||
}
|
||||
|
||||
bool ICore::showOptionsDialog(const Id group, const Id page, QWidget *parent)
|
||||
bool ICore::showOptionsDialog(const Id page, QWidget *parent)
|
||||
{
|
||||
return m_mainwindow->showOptionsDialog(group, page, parent);
|
||||
return m_mainwindow->showOptionsDialog(page, parent);
|
||||
}
|
||||
|
||||
QString ICore::msgShowOptionsDialog()
|
||||
@@ -358,14 +358,9 @@ QString ICore::msgShowOptionsDialogToolTip()
|
||||
}
|
||||
|
||||
bool ICore::showWarningWithOptions(const QString &title, const QString &text,
|
||||
const QString &details,
|
||||
Id settingsCategory,
|
||||
Id settingsId,
|
||||
QWidget *parent)
|
||||
const QString &details, Id settingsId, QWidget *parent)
|
||||
{
|
||||
return m_mainwindow->showWarningWithOptions(title, text,
|
||||
details, settingsCategory,
|
||||
settingsId, parent);
|
||||
return m_mainwindow->showWarningWithOptions(title, text, details, settingsId, parent);
|
||||
}
|
||||
|
||||
QSettings *ICore::settings(QSettings::Scope scope)
|
||||
|
||||
@@ -74,13 +74,12 @@ public:
|
||||
const QString &defaultLocation = QString(),
|
||||
const QVariantMap &extraVariables = QVariantMap());
|
||||
|
||||
static bool showOptionsDialog(Id group, Id page, QWidget *parent = 0);
|
||||
static bool showOptionsDialog(Id page, QWidget *parent = 0);
|
||||
static QString msgShowOptionsDialog();
|
||||
static QString msgShowOptionsDialogToolTip();
|
||||
|
||||
static bool showWarningWithOptions(const QString &title, const QString &text,
|
||||
const QString &details = QString(),
|
||||
Id settingsCategory = Id(),
|
||||
Id settingsId = Id(),
|
||||
QWidget *parent = 0);
|
||||
|
||||
|
||||
@@ -625,7 +625,7 @@ void LocatorWidget::filterSelected()
|
||||
|
||||
void LocatorWidget::showConfigureDialog()
|
||||
{
|
||||
ICore::showOptionsDialog(Constants::SETTINGS_CATEGORY_CORE, Constants::FILTER_OPTIONS_PAGE);
|
||||
ICore::showOptionsDialog(Constants::FILTER_OPTIONS_PAGE);
|
||||
}
|
||||
|
||||
void LocatorWidget::addSearchResults(int firstIndex, int endIndex)
|
||||
|
||||
@@ -73,6 +73,7 @@
|
||||
#include <coreplugin/progressmanager/progressmanager_p.h>
|
||||
#include <coreplugin/progressmanager/progressview.h>
|
||||
#include <coreplugin/settingsdatabase.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/historycompleter.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
@@ -81,27 +82,26 @@
|
||||
#include <utils/stylehelper.h>
|
||||
#include <utils/theme/theme.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QSettings>
|
||||
#include <QTimer>
|
||||
#include <QUrl>
|
||||
#include <QDir>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCloseEvent>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QMenu>
|
||||
#include <QPrinter>
|
||||
#include <QStatusBar>
|
||||
#include <QToolButton>
|
||||
#include <QMessageBox>
|
||||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
#include <QPrinter>
|
||||
#include <QPushButton>
|
||||
#include <QSettings>
|
||||
#include <QStatusBar>
|
||||
#include <QStyleFactory>
|
||||
#include <QTimer>
|
||||
#include <QToolButton>
|
||||
#include <QUrl>
|
||||
|
||||
using namespace ExtensionSystem;
|
||||
using namespace Utils;
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
@@ -109,7 +109,7 @@ namespace Internal {
|
||||
enum { debugMainWindow = 0 };
|
||||
|
||||
MainWindow::MainWindow() :
|
||||
Utils::AppMainWindow(),
|
||||
AppMainWindow(),
|
||||
m_coreImpl(new ICore(this)),
|
||||
m_additionalContexts(Constants::C_GLOBAL),
|
||||
m_settingsDatabase(new SettingsDatabase(QFileInfo(PluginManager::settings()->fileName()).path(),
|
||||
@@ -147,17 +147,17 @@ MainWindow::MainWindow() :
|
||||
(void) new DocumentManager(this);
|
||||
OutputPaneManager::create();
|
||||
|
||||
Utils::HistoryCompleter::setSettings(PluginManager::settings());
|
||||
HistoryCompleter::setSettings(PluginManager::settings());
|
||||
|
||||
setWindowTitle(tr("Qt Creator"));
|
||||
if (Utils::HostOsInfo::isLinuxHost())
|
||||
if (HostOsInfo::isLinuxHost())
|
||||
QApplication::setWindowIcon(QIcon(QLatin1String(Constants::ICON_QTLOGO_128)));
|
||||
QCoreApplication::setApplicationName(QLatin1String("QtCreator"));
|
||||
QCoreApplication::setApplicationVersion(QLatin1String(Constants::IDE_VERSION_LONG));
|
||||
QCoreApplication::setOrganizationName(QLatin1String(Constants::IDE_SETTINGSVARIANT_STR));
|
||||
QString baseName = QApplication::style()->objectName();
|
||||
// Sometimes we get the standard windows 95 style as a fallback
|
||||
if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost()
|
||||
if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()
|
||||
&& baseName == QLatin1String("windows")) {
|
||||
baseName = QLatin1String("fusion");
|
||||
}
|
||||
@@ -202,15 +202,15 @@ MainWindow::MainWindow() :
|
||||
statusBar()->insertPermanentWidget(0, m_toggleSideBarButton);
|
||||
|
||||
// setUnifiedTitleAndToolBarOnMac(true);
|
||||
//if (Utils::HostOsInfo::isAnyUnixHost())
|
||||
//if (HostOsInfo::isAnyUnixHost())
|
||||
//signal(SIGINT, handleSigInt);
|
||||
|
||||
statusBar()->setProperty("p_styled", true);
|
||||
|
||||
auto dropSupport = new Utils::FileDropSupport(this, [](QDropEvent *event) {
|
||||
auto dropSupport = new FileDropSupport(this, [](QDropEvent *event) {
|
||||
return event->source() == 0; // only accept drops from the "outside" (e.g. file manager)
|
||||
});
|
||||
connect(dropSupport, &Utils::FileDropSupport::filesDropped,
|
||||
connect(dropSupport, &FileDropSupport::filesDropped,
|
||||
this, &MainWindow::openDroppedFiles);
|
||||
}
|
||||
|
||||
@@ -376,11 +376,11 @@ void MainWindow::closeEvent(QCloseEvent *event)
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void MainWindow::openDroppedFiles(const QList<Utils::FileDropSupport::FileSpec> &files)
|
||||
void MainWindow::openDroppedFiles(const QList<FileDropSupport::FileSpec> &files)
|
||||
{
|
||||
raiseWindow();
|
||||
QStringList filePaths = Utils::transform(files,
|
||||
[](const Utils::FileDropSupport::FileSpec &spec) -> QString {
|
||||
[](const FileDropSupport::FileSpec &spec) -> QString {
|
||||
return spec.filePath;
|
||||
});
|
||||
openFiles(filePaths, ICore::SwitchMode);
|
||||
@@ -400,7 +400,7 @@ void MainWindow::registerDefaultContainers()
|
||||
{
|
||||
ActionContainer *menubar = ActionManager::createMenuBar(Constants::MENU_BAR);
|
||||
|
||||
if (!Utils::HostOsInfo::isMacHost()) // System menu bar on Mac
|
||||
if (!HostOsInfo::isMacHost()) // System menu bar on Mac
|
||||
setMenuBar(menubar->menuBar());
|
||||
menubar->appendGroup(Constants::G_FILE);
|
||||
menubar->appendGroup(Constants::G_EDIT);
|
||||
@@ -420,7 +420,7 @@ void MainWindow::registerDefaultContainers()
|
||||
filemenu->appendGroup(Constants::G_FILE_CLOSE);
|
||||
filemenu->appendGroup(Constants::G_FILE_PRINT);
|
||||
filemenu->appendGroup(Constants::G_FILE_OTHER);
|
||||
connect(filemenu->menu(), SIGNAL(aboutToShow()), this, SLOT(aboutToShowRecentFiles()));
|
||||
connect(filemenu->menu(), &QMenu::aboutToShow, this, &MainWindow::aboutToShowRecentFiles);
|
||||
|
||||
|
||||
// Edit Menu
|
||||
@@ -650,11 +650,11 @@ void MainWindow::registerDefaultActions()
|
||||
|
||||
// Full Screen Action
|
||||
QAction *toggleFullScreenAction = new QAction(tr("Full Screen"), this);
|
||||
toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost());
|
||||
toggleFullScreenAction->setCheckable(!HostOsInfo::isMacHost());
|
||||
toggleFullScreenAction->setEnabled(false); // actual implementation in WindowSupport
|
||||
cmd = ActionManager::registerAction(toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
|
||||
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11")));
|
||||
if (Utils::HostOsInfo::isMacHost())
|
||||
if (HostOsInfo::isMacHost())
|
||||
cmd->setAttribute(Command::CA_UpdateText);
|
||||
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
|
||||
|
||||
@@ -677,7 +677,7 @@ void MainWindow::registerDefaultActions()
|
||||
cmd = ActionManager::registerAction(m_toggleSideBarAction, Constants::TOGGLE_SIDEBAR, globalContext);
|
||||
cmd->setAttribute(Command::CA_UpdateText);
|
||||
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+0") : tr("Alt+0")));
|
||||
connect(m_toggleSideBarAction, SIGNAL(triggered(bool)), this, SLOT(setSidebarVisible(bool)));
|
||||
connect(m_toggleSideBarAction, &QAction::triggered, this, &MainWindow::setSidebarVisible);
|
||||
m_toggleSideBarButton->setDefaultAction(cmd->action());
|
||||
mwindow->addAction(cmd, Constants::G_WINDOW_VIEWS);
|
||||
m_toggleSideBarAction->setEnabled(false);
|
||||
@@ -686,7 +686,7 @@ void MainWindow::registerDefaultActions()
|
||||
m_toggleModeSelectorAction = new QAction(tr("Show Mode Selector"), this);
|
||||
m_toggleModeSelectorAction->setCheckable(true);
|
||||
cmd = ActionManager::registerAction(m_toggleModeSelectorAction, Constants::TOGGLE_MODE_SELECTOR, globalContext);
|
||||
connect(m_toggleModeSelectorAction, SIGNAL(triggered(bool)), ModeManager::instance(), SLOT(setModeSelectorVisible(bool)));
|
||||
connect(m_toggleModeSelectorAction, &QAction::triggered, ModeManager::instance(), &ModeManager::setModeSelectorVisible);
|
||||
mwindow->addAction(cmd, Constants::G_WINDOW_VIEWS);
|
||||
|
||||
// Window->Views
|
||||
@@ -696,12 +696,12 @@ void MainWindow::registerDefaultActions()
|
||||
|
||||
// "Help" separators
|
||||
mhelp->addSeparator(globalContext, Constants::G_HELP_SUPPORT);
|
||||
if (!Utils::HostOsInfo::isMacHost())
|
||||
if (!HostOsInfo::isMacHost())
|
||||
mhelp->addSeparator(globalContext, Constants::G_HELP_ABOUT);
|
||||
|
||||
// About IDE Action
|
||||
icon = QIcon::fromTheme(QLatin1String("help-about"));
|
||||
if (Utils::HostOsInfo::isMacHost())
|
||||
if (HostOsInfo::isMacHost())
|
||||
tmpaction = new QAction(icon, tr("About &Qt Creator"), this); // it's convention not to add dots to the about menu
|
||||
else
|
||||
tmpaction = new QAction(icon, tr("About &Qt Creator..."), this);
|
||||
@@ -709,7 +709,7 @@ void MainWindow::registerDefaultActions()
|
||||
cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_QTCREATOR, globalContext);
|
||||
mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
|
||||
tmpaction->setEnabled(true);
|
||||
connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutQtCreator()));
|
||||
connect(tmpaction, &QAction::triggered, this, &MainWindow::aboutQtCreator);
|
||||
|
||||
//About Plugins Action
|
||||
tmpaction = new QAction(tr("About &Plugins..."), this);
|
||||
@@ -717,7 +717,7 @@ void MainWindow::registerDefaultActions()
|
||||
cmd = ActionManager::registerAction(tmpaction, Constants::ABOUT_PLUGINS, globalContext);
|
||||
mhelp->addAction(cmd, Constants::G_HELP_ABOUT);
|
||||
tmpaction->setEnabled(true);
|
||||
connect(tmpaction, SIGNAL(triggered()), this, SLOT(aboutPlugins()));
|
||||
connect(tmpaction, &QAction::triggered, this, &MainWindow::aboutPlugins);
|
||||
// About Qt Action
|
||||
// tmpaction = new QAction(tr("About &Qt..."), this);
|
||||
// cmd = ActionManager::registerAction(tmpaction, Constants:: ABOUT_QT, globalContext);
|
||||
@@ -725,7 +725,7 @@ void MainWindow::registerDefaultActions()
|
||||
// tmpaction->setEnabled(true);
|
||||
// connect(tmpaction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||
// About sep
|
||||
if (!Utils::HostOsInfo::isMacHost()) { // doesn't have the "About" actions in the Help menu
|
||||
if (!HostOsInfo::isMacHost()) { // doesn't have the "About" actions in the Help menu
|
||||
tmpaction = new QAction(this);
|
||||
tmpaction->setSeparator(true);
|
||||
cmd = ActionManager::registerAction(tmpaction, "QtCreator.Help.Sep.About", globalContext);
|
||||
@@ -746,8 +746,8 @@ void MainWindow::openFile()
|
||||
static IDocumentFactory *findDocumentFactory(const QList<IDocumentFactory*> &fileFactories,
|
||||
const QFileInfo &fi)
|
||||
{
|
||||
Utils::MimeDatabase mdb;
|
||||
const Utils::MimeType mt = mdb.mimeTypeForFile(fi);
|
||||
MimeDatabase mdb;
|
||||
const MimeType mt = mdb.mimeTypeForFile(fi);
|
||||
if (mt.isValid()) {
|
||||
const QString typeName = mt.name();
|
||||
foreach (IDocumentFactory *factory, fileFactories) {
|
||||
@@ -823,12 +823,12 @@ void MainWindow::showNewItemDialog(const QString &title,
|
||||
emit newItemDialogRunningChanged();
|
||||
}
|
||||
|
||||
bool MainWindow::showOptionsDialog(Id category, Id page, QWidget *parent)
|
||||
bool MainWindow::showOptionsDialog(Id page, QWidget *parent)
|
||||
{
|
||||
emit m_coreImpl->optionsDialogRequested();
|
||||
if (!parent)
|
||||
parent = ICore::dialogParent();
|
||||
SettingsDialog *dialog = SettingsDialog::getSettingsDialog(parent, category, page);
|
||||
SettingsDialog *dialog = SettingsDialog::getSettingsDialog(parent, page);
|
||||
return dialog->execDialog();
|
||||
}
|
||||
|
||||
@@ -947,13 +947,12 @@ void MainWindow::readSettings()
|
||||
settings->beginGroup(QLatin1String(settingsGroup));
|
||||
|
||||
if (m_overrideColor.isValid()) {
|
||||
Utils::StyleHelper::setBaseColor(m_overrideColor);
|
||||
StyleHelper::setBaseColor(m_overrideColor);
|
||||
// Get adapted base color.
|
||||
m_overrideColor = Utils::StyleHelper::baseColor();
|
||||
m_overrideColor = StyleHelper::baseColor();
|
||||
} else {
|
||||
Utils::StyleHelper::setBaseColor(
|
||||
settings->value(QLatin1String(colorKey),
|
||||
QColor(Utils::StyleHelper::DEFAULT_BASE_COLOR)).value<QColor>());
|
||||
StyleHelper::setBaseColor(settings->value(QLatin1String(colorKey),
|
||||
QColor(StyleHelper::DEFAULT_BASE_COLOR)).value<QColor>());
|
||||
}
|
||||
|
||||
bool modeSelectorVisible = settings->value(QLatin1String(modeSelectorVisibleKey), true).toBool();
|
||||
@@ -972,8 +971,8 @@ void MainWindow::writeSettings()
|
||||
QSettings *settings = PluginManager::settings();
|
||||
settings->beginGroup(QLatin1String(settingsGroup));
|
||||
|
||||
if (!(m_overrideColor.isValid() && Utils::StyleHelper::baseColor() == m_overrideColor))
|
||||
settings->setValue(QLatin1String(colorKey), Utils::StyleHelper::requestedBaseColor());
|
||||
if (!(m_overrideColor.isValid() && StyleHelper::baseColor() == m_overrideColor))
|
||||
settings->setValue(QLatin1String(colorKey), StyleHelper::requestedBaseColor());
|
||||
|
||||
settings->setValue(QLatin1String(windowGeometryKey), saveGeometry());
|
||||
settings->setValue(QLatin1String(windowStateKey), saveState());
|
||||
@@ -1031,8 +1030,7 @@ void MainWindow::updateContext()
|
||||
|
||||
void MainWindow::aboutToShowRecentFiles()
|
||||
{
|
||||
ActionContainer *aci =
|
||||
ActionManager::actionContainer(Constants::M_FILE_RECENTFILES);
|
||||
ActionContainer *aci = ActionManager::actionContainer(Constants::M_FILE_RECENTFILES);
|
||||
QMenu *menu = aci->menu();
|
||||
menu->clear();
|
||||
|
||||
@@ -1041,8 +1039,9 @@ void MainWindow::aboutToShowRecentFiles()
|
||||
hasRecentFiles = true;
|
||||
QAction *action = menu->addAction(
|
||||
QDir::toNativeSeparators(Utils::withTildeHomePath(file.first)));
|
||||
action->setData(qVariantFromValue(file));
|
||||
connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
|
||||
connect(action, &QAction::triggered, this, [file] {
|
||||
EditorManager::openEditor(file.first, file.second);
|
||||
});
|
||||
}
|
||||
menu->setEnabled(hasRecentFiles);
|
||||
|
||||
@@ -1051,15 +1050,8 @@ void MainWindow::aboutToShowRecentFiles()
|
||||
menu->addSeparator();
|
||||
QAction *action = menu->addAction(QCoreApplication::translate(
|
||||
"Core", Constants::TR_CLEAR_MENU));
|
||||
connect(action, SIGNAL(triggered()), DocumentManager::instance(), SLOT(clearRecentFiles()));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::openRecentFile()
|
||||
{
|
||||
if (const QAction *action = qobject_cast<const QAction*>(sender())) {
|
||||
const DocumentManager::RecentFile file = action->data().value<DocumentManager::RecentFile>();
|
||||
EditorManager::openEditor(file.first, file.second);
|
||||
connect(action, &QAction::triggered,
|
||||
DocumentManager::instance(), &DocumentManager::clearRecentFiles);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1067,8 +1059,8 @@ void MainWindow::aboutQtCreator()
|
||||
{
|
||||
if (!m_versionDialog) {
|
||||
m_versionDialog = new VersionDialog(this);
|
||||
connect(m_versionDialog, SIGNAL(finished(int)),
|
||||
this, SLOT(destroyVersionDialog()));
|
||||
connect(m_versionDialog, &QDialog::finished,
|
||||
this, &MainWindow::destroyVersionDialog);
|
||||
}
|
||||
m_versionDialog->show();
|
||||
}
|
||||
@@ -1100,7 +1092,6 @@ QPrinter *MainWindow::printer() const
|
||||
bool MainWindow::showWarningWithOptions(const QString &title,
|
||||
const QString &text,
|
||||
const QString &details,
|
||||
Id settingsCategory,
|
||||
Id settingsId,
|
||||
QWidget *parent)
|
||||
{
|
||||
@@ -1111,11 +1102,11 @@ bool MainWindow::showWarningWithOptions(const QString &title,
|
||||
if (!details.isEmpty())
|
||||
msgBox.setDetailedText(details);
|
||||
QAbstractButton *settingsButton = 0;
|
||||
if (settingsId.isValid() || settingsCategory.isValid())
|
||||
if (settingsId.isValid())
|
||||
settingsButton = msgBox.addButton(tr("Settings..."), QMessageBox::AcceptRole);
|
||||
msgBox.exec();
|
||||
if (settingsButton && msgBox.clickedButton() == settingsButton)
|
||||
return showOptionsDialog(settingsCategory, settingsId);
|
||||
return showOptionsDialog(settingsId);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -122,11 +122,10 @@ public slots:
|
||||
const QString &defaultLocation = QString(),
|
||||
const QVariantMap &extraVariables = QVariantMap());
|
||||
|
||||
bool showOptionsDialog(Id category = Id(), Id page = Id(), QWidget *parent = 0);
|
||||
bool showOptionsDialog(Id page = Id(), QWidget *parent = 0);
|
||||
|
||||
bool showWarningWithOptions(const QString &title, const QString &text,
|
||||
const QString &details = QString(),
|
||||
Id settingsCategory = Id(),
|
||||
Id settingsId = Id(),
|
||||
QWidget *parent = 0);
|
||||
|
||||
@@ -136,7 +135,6 @@ protected:
|
||||
private slots:
|
||||
void openFile();
|
||||
void aboutToShowRecentFiles();
|
||||
void openRecentFile();
|
||||
void setFocusToEditor();
|
||||
void saveAll();
|
||||
void aboutQtCreator();
|
||||
|
||||
@@ -344,8 +344,7 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
|
||||
d->m_unconfiguredVcs = versionControl;
|
||||
info.setCustomButtonInfo(ICore::msgShowOptionsDialog(), []() {
|
||||
QTC_ASSERT(d->m_unconfiguredVcs, return);
|
||||
ICore::showOptionsDialog(Id(VcsBase::Constants::VCS_SETTINGS_CATEGORY),
|
||||
d->m_unconfiguredVcs->id());
|
||||
ICore::showOptionsDialog(d->m_unconfiguredVcs->id());
|
||||
});
|
||||
|
||||
infoBar->addInfo(info);
|
||||
|
||||
@@ -170,11 +170,8 @@ bool Protocol::showConfigurationError(const Protocol *p,
|
||||
settingsButton = mb.addButton(Core::ICore::msgShowOptionsDialog(), QMessageBox::AcceptRole);
|
||||
mb.exec();
|
||||
bool rc = false;
|
||||
if (mb.clickedButton() == settingsButton) {
|
||||
rc = Core::ICore::showOptionsDialog(p->settingsPage()->category(),
|
||||
p->settingsPage()->id(),
|
||||
parent);
|
||||
}
|
||||
if (mb.clickedButton() == settingsButton)
|
||||
rc = Core::ICore::showOptionsDialog(p->settingsPage()->id(), parent);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ void BuiltinEditorDocumentParser::update(WorkingCopy workingCopy)
|
||||
ProjectPart::HeaderPaths headerPaths;
|
||||
QStringList precompiledHeaders;
|
||||
QString projectConfigFile;
|
||||
LanguageFeatures features = LanguageFeatures::defaultFeatures();
|
||||
|
||||
updateProjectPart();
|
||||
|
||||
@@ -75,6 +76,7 @@ void BuiltinEditorDocumentParser::update(WorkingCopy workingCopy)
|
||||
projectConfigFile = part->projectConfigFile;
|
||||
if (usePrecompiledHeaders())
|
||||
precompiledHeaders = part->precompiledHeaders;
|
||||
features = part->languageFeatures;
|
||||
}
|
||||
|
||||
if (configFile != m_configFile) {
|
||||
@@ -169,6 +171,7 @@ void BuiltinEditorDocumentParser::update(WorkingCopy workingCopy)
|
||||
sourceProcessor.setGlobalSnapshot(globalSnapshot);
|
||||
sourceProcessor.setWorkingCopy(workingCopy);
|
||||
sourceProcessor.setHeaderPaths(m_headerPaths);
|
||||
sourceProcessor.setLanguageFeatures(features);
|
||||
sourceProcessor.run(configurationFileName);
|
||||
if (!m_projectConfigFile.isEmpty())
|
||||
sourceProcessor.run(m_projectConfigFile);
|
||||
|
||||
@@ -208,6 +208,8 @@ void index(QFutureInterface<void> &future, const ParseParams params)
|
||||
|
||||
CppModelManager *cmm = CppModelManager::instance();
|
||||
const ProjectPart::HeaderPaths fallbackHeaderPaths = cmm->headerPaths();
|
||||
const CPlusPlus::LanguageFeatures defaultFeatures =
|
||||
CPlusPlus::LanguageFeatures::defaultFeatures();
|
||||
for (int i = 0; i < files.size(); ++i) {
|
||||
if (future.isPaused())
|
||||
future.waitForResume();
|
||||
@@ -216,6 +218,11 @@ void index(QFutureInterface<void> &future, const ParseParams params)
|
||||
break;
|
||||
|
||||
const QString fileName = files.at(i);
|
||||
const QList<ProjectPart::Ptr> parts = cmm->projectPart(fileName);
|
||||
const CPlusPlus::LanguageFeatures languageFeatures = parts.isEmpty()
|
||||
? defaultFeatures
|
||||
: parts.first()->languageFeatures;
|
||||
sourceProcessor->setLanguageFeatures(languageFeatures);
|
||||
|
||||
const bool isSourceFile = i < sourceCount;
|
||||
if (isSourceFile) {
|
||||
@@ -226,7 +233,6 @@ void index(QFutureInterface<void> &future, const ParseParams params)
|
||||
processingHeaders = true;
|
||||
}
|
||||
|
||||
QList<ProjectPart::Ptr> parts = cmm->projectPart(fileName);
|
||||
ProjectPart::HeaderPaths headerPaths = parts.isEmpty()
|
||||
? fallbackHeaderPaths
|
||||
: parts.first()->headerPaths;
|
||||
|
||||
@@ -2174,6 +2174,8 @@ void CppToolsPlugin::test_completion_data()
|
||||
"#define slots\n"
|
||||
"#define Q_OBJECT virtual const QMetaObject *metaObject() const;"
|
||||
"\n"
|
||||
"namespace N {\n"
|
||||
"\n"
|
||||
"class Base : public QObject\n"
|
||||
"{\n"
|
||||
" Q_OBJECT\n"
|
||||
@@ -2204,9 +2206,11 @@ void CppToolsPlugin::test_completion_data()
|
||||
" void derivedSlot2(int newValue);\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"} // namespace N\n"
|
||||
"\n"
|
||||
"void client()\n"
|
||||
"{\n"
|
||||
" Derived *myObject = new Derived;\n"
|
||||
" N::Derived *myObject = new N::Derived;\n"
|
||||
" @\n"
|
||||
"}\n";
|
||||
|
||||
@@ -2227,33 +2231,60 @@ void CppToolsPlugin::test_completion_data()
|
||||
<< QLatin1String("derivedSlot1()")
|
||||
<< QLatin1String("derivedSlot2(int)"));
|
||||
|
||||
QTest::newRow("Qt5 signal")
|
||||
QTest::newRow("Qt5 signals: complete class after & at 2nd connect arg")
|
||||
<< commonSignalSlotCompletionTestCode
|
||||
<< _("connect(myObject, &") << (QStringList()
|
||||
<< QLatin1String("Base::baseSignal1")
|
||||
<< QLatin1String("Base::baseSignal2")
|
||||
<< QLatin1String("Base::hiddenSignal")
|
||||
<< QLatin1String("Derived::derivedSignal1")
|
||||
<< QLatin1String("Derived::derivedSignal2")
|
||||
<< QLatin1String("Derived::hiddenSignal")); // OK, hidden signal
|
||||
<< QLatin1String("N::Derived"));
|
||||
|
||||
QTest::newRow("Qt5 slot")
|
||||
QTest::newRow("Qt5 signals: complete class after & at 4th connect arg")
|
||||
<< commonSignalSlotCompletionTestCode
|
||||
<< _("connect(myObject, &MyObject::timeout, myObject, &") << (QStringList()
|
||||
<< QLatin1String("Base::baseSignal1")
|
||||
<< QLatin1String("Base::baseSignal2")
|
||||
<< QLatin1String("Base::baseSlot1")
|
||||
<< QLatin1String("Base::baseSlot2")
|
||||
<< QLatin1String("Base::baseFunction")
|
||||
<< QLatin1String("Base::hiddenFunction")
|
||||
<< QLatin1String("Base::hiddenSignal")
|
||||
<< QLatin1String("Derived::derivedFunction")
|
||||
<< QLatin1String("Derived::derivedSignal1")
|
||||
<< QLatin1String("Derived::derivedSignal2")
|
||||
<< QLatin1String("Derived::derivedSlot1")
|
||||
<< QLatin1String("Derived::derivedSlot2")
|
||||
<< QLatin1String("Derived::hiddenFunction")
|
||||
<< QLatin1String("Derived::hiddenSignal"));
|
||||
<< QLatin1String("N::Derived"));
|
||||
|
||||
QTest::newRow("Qt5 signals: complete signals")
|
||||
<< commonSignalSlotCompletionTestCode
|
||||
<< _("connect(myObject, &N::Derived::") << (QStringList()
|
||||
<< QLatin1String("baseSignal1")
|
||||
<< QLatin1String("baseSignal2")
|
||||
<< QLatin1String("hiddenSignal")
|
||||
<< QLatin1String("derivedSignal1")
|
||||
<< QLatin1String("derivedSignal2"));
|
||||
|
||||
QTest::newRow("Qt5 slots")
|
||||
<< commonSignalSlotCompletionTestCode
|
||||
<< _("connect(myObject, &N::Derived, myObject, &N::Derived::") << (QStringList()
|
||||
<< QLatin1String("baseFunction")
|
||||
<< QLatin1String("baseSignal1")
|
||||
<< QLatin1String("baseSignal2")
|
||||
<< QLatin1String("baseSlot1")
|
||||
<< QLatin1String("baseSlot2")
|
||||
<< QLatin1String("derivedFunction")
|
||||
<< QLatin1String("derivedSignal1")
|
||||
<< QLatin1String("derivedSignal2")
|
||||
<< QLatin1String("derivedSlot1")
|
||||
<< QLatin1String("derivedSlot2")
|
||||
<< QLatin1String("hiddenFunction")
|
||||
<< QLatin1String("hiddenSignal"));
|
||||
|
||||
QTest::newRow("Qt5 signals: no class name completion if not after 'connect(' 1")
|
||||
<< commonSignalSlotCompletionTestCode
|
||||
<< _("foo(myObject, &") << (QStringList());
|
||||
|
||||
QTest::newRow("Qt5 signals/slots: no class name completion if not after 'connect(' 2")
|
||||
<< commonSignalSlotCompletionTestCode
|
||||
<< _("&") << (QStringList());
|
||||
|
||||
QTest::newRow("Qt5 signals: fallback to scope completion")
|
||||
<< commonSignalSlotCompletionTestCode
|
||||
<< _("connect(myObject, &N::") << (QStringList()
|
||||
<< QLatin1String("Base")
|
||||
<< QLatin1String("Derived"));
|
||||
|
||||
QTest::newRow("Qt5 slots: fallback to scope completion")
|
||||
<< commonSignalSlotCompletionTestCode
|
||||
<< _("connect(myObject, &N::Derived, myObject, &N::") << (QStringList()
|
||||
<< QLatin1String("Base")
|
||||
<< QLatin1String("Derived"));
|
||||
|
||||
QTest::newRow("signals_hide_QPrivateSignal") << _(
|
||||
"#define SIGNAL(a) #a\n"
|
||||
|
||||
@@ -615,15 +615,186 @@ QString createQt4SignalOrSlot(CPlusPlus::Function *function, const Overview &ove
|
||||
return QString::fromUtf8(normalized, normalized.size());
|
||||
}
|
||||
|
||||
QString createQt5SignalOrSlot(CPlusPlus::Function *function, Class *klass)
|
||||
QString createQt5SignalOrSlot(CPlusPlus::Function *function, const Overview &overview)
|
||||
{
|
||||
QString text;
|
||||
text += Overview().prettyName(klass->name());
|
||||
text += QLatin1String("::");
|
||||
text += Overview().prettyName(function->name());
|
||||
text += overview.prettyName(function->name());
|
||||
return text;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class BackwardsEater
|
||||
\brief Checks strings and expressions before given position.
|
||||
|
||||
Similar to BackwardsScanner, but also can handle expressions. Ignores whitespace.
|
||||
*/
|
||||
class BackwardsEater
|
||||
{
|
||||
public:
|
||||
explicit BackwardsEater(const CppCompletionAssistInterface *assistInterface, int position)
|
||||
: m_position(position)
|
||||
, m_assistInterface(assistInterface)
|
||||
{
|
||||
}
|
||||
|
||||
bool isPositionValid() const
|
||||
{
|
||||
return m_position >= 0;
|
||||
}
|
||||
|
||||
bool eatConnectOpenParenthesis()
|
||||
{
|
||||
return eatString(QLatin1String("(")) && eatString(QLatin1String("connect"));
|
||||
}
|
||||
|
||||
bool eatExpressionCommaAmpersand()
|
||||
{
|
||||
return eatString(QLatin1String("&")) && eatString(QLatin1String(",")) && eatExpression();
|
||||
}
|
||||
|
||||
bool eatConnectOpenParenthesisExpressionCommaAmpersandExpressionComma()
|
||||
{
|
||||
return eatString(QLatin1String(","))
|
||||
&& eatExpression()
|
||||
&& eatExpressionCommaAmpersand()
|
||||
&& eatConnectOpenParenthesis();
|
||||
}
|
||||
|
||||
private:
|
||||
bool eatExpression()
|
||||
{
|
||||
if (!isPositionValid())
|
||||
return false;
|
||||
|
||||
maybeEatWhitespace();
|
||||
|
||||
QTextCursor cursor(m_assistInterface->textDocument());
|
||||
cursor.setPosition(m_position + 1);
|
||||
ExpressionUnderCursor expressionUnderCursor;
|
||||
const QString expression = expressionUnderCursor(cursor);
|
||||
if (expression.isEmpty())
|
||||
return false;
|
||||
m_position = m_position - expression.length();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool eatString(const QString &string)
|
||||
{
|
||||
if (!isPositionValid())
|
||||
return false;
|
||||
|
||||
if (string.isEmpty())
|
||||
return true;
|
||||
|
||||
maybeEatWhitespace();
|
||||
|
||||
const int stringLength = string.length();
|
||||
const int stringStart = m_position - (stringLength - 1);
|
||||
|
||||
if (stringStart < 0)
|
||||
return false;
|
||||
|
||||
if (m_assistInterface->textAt(stringStart, stringLength) == string) {
|
||||
m_position = stringStart - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void maybeEatWhitespace()
|
||||
{
|
||||
while (isPositionValid() && m_assistInterface->characterAt(m_position).isSpace())
|
||||
--m_position;
|
||||
}
|
||||
|
||||
private:
|
||||
int m_position;
|
||||
const CppCompletionAssistInterface * const m_assistInterface;
|
||||
};
|
||||
|
||||
bool canCompleteConnectSignalAt2ndArgument(const CppCompletionAssistInterface *assistInterface,
|
||||
int startOfExpression)
|
||||
{
|
||||
BackwardsEater eater(assistInterface, startOfExpression);
|
||||
|
||||
return eater.isPositionValid()
|
||||
&& eater.eatExpressionCommaAmpersand()
|
||||
&& eater.eatConnectOpenParenthesis();
|
||||
}
|
||||
|
||||
bool canCompleteConnectSignalAt4thArgument(const CppCompletionAssistInterface *assistInterface,
|
||||
int startPosition)
|
||||
{
|
||||
BackwardsEater eater(assistInterface, startPosition);
|
||||
|
||||
return eater.isPositionValid()
|
||||
&& eater.eatExpressionCommaAmpersand()
|
||||
&& eater.eatConnectOpenParenthesisExpressionCommaAmpersandExpressionComma();
|
||||
}
|
||||
|
||||
bool canCompleteClassNameAt2ndOr4thConnectArgument(
|
||||
const CppCompletionAssistInterface *assistInterface,
|
||||
int startPosition)
|
||||
{
|
||||
BackwardsEater eater(assistInterface, startPosition);
|
||||
|
||||
if (!eater.isPositionValid())
|
||||
return false;
|
||||
|
||||
return eater.eatConnectOpenParenthesis()
|
||||
|| eater.eatConnectOpenParenthesisExpressionCommaAmpersandExpressionComma();
|
||||
}
|
||||
|
||||
ClassOrNamespace *classOrNamespaceFromLookupItem(const LookupItem &lookupItem,
|
||||
const LookupContext &context)
|
||||
{
|
||||
const Name *name = 0;
|
||||
|
||||
if (Symbol *d = lookupItem.declaration()) {
|
||||
if (Class *k = d->asClass())
|
||||
name = k->name();
|
||||
}
|
||||
|
||||
if (!name) {
|
||||
FullySpecifiedType type = lookupItem.type().simplified();
|
||||
|
||||
if (PointerType *pointerType = type->asPointerType())
|
||||
type = pointerType->elementType().simplified();
|
||||
else
|
||||
return 0; // not a pointer or a reference to a pointer.
|
||||
|
||||
NamedType *namedType = type->asNamedType();
|
||||
if (!namedType) // not a class name.
|
||||
return 0;
|
||||
|
||||
name = namedType->name();
|
||||
}
|
||||
|
||||
return name ? context.lookupType(name, lookupItem.scope()) : 0;
|
||||
}
|
||||
|
||||
Class *classFromLookupItem(const LookupItem &lookupItem, const LookupContext &context)
|
||||
{
|
||||
ClassOrNamespace *b = classOrNamespaceFromLookupItem(lookupItem, context);
|
||||
if (!b)
|
||||
return 0;
|
||||
|
||||
foreach (Symbol *s, b->symbols()) {
|
||||
if (Class *klass = s->asClass())
|
||||
return klass;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Name *minimalName(Symbol *symbol, Scope *targetScope, const LookupContext &context)
|
||||
{
|
||||
ClassOrNamespace *target = context.lookupType(targetScope);
|
||||
if (!target)
|
||||
target = context.globalNamespace();
|
||||
return context.minimalName(symbol, target, context.bindings()->control().data());
|
||||
}
|
||||
|
||||
} // Anonymous
|
||||
|
||||
// ------------------------------------
|
||||
@@ -807,10 +978,8 @@ int InternalCppCompletionAssistProcessor::startOfOperator(int pos,
|
||||
|
||||
if (*kind == T_AMPER && tokenIdx > 0) {
|
||||
const Token &previousToken = tokens.at(tokenIdx - 1);
|
||||
if (previousToken.kind() == T_COMMA) {
|
||||
if (previousToken.kind() == T_COMMA)
|
||||
start = pos - (tk.utf16charOffset - previousToken.utf16charOffset) - 1;
|
||||
QTC_CHECK(m_interface->characterAt(start) == QLatin1Char(','));
|
||||
}
|
||||
} else if (*kind == T_DOXY_COMMENT && !(tk.is(T_DOXY_COMMENT) || tk.is(T_CPP_DOXY_COMMENT))) {
|
||||
*kind = T_EOF_SYMBOL;
|
||||
start = pos;
|
||||
@@ -895,18 +1064,6 @@ int InternalCppCompletionAssistProcessor::findStartOfName(int pos) const
|
||||
return pos + 1;
|
||||
}
|
||||
|
||||
static bool isPrecededByConnectAndOpenParenthesis(
|
||||
const CppCompletionAssistInterface *assistInterface,
|
||||
int startOfExpression)
|
||||
{
|
||||
QTC_ASSERT(startOfExpression >= 0, return false);
|
||||
|
||||
int beforeExpression = startOfExpression;
|
||||
while (beforeExpression > 0 && assistInterface->characterAt(--beforeExpression).isSpace()) ;
|
||||
const int pos = beforeExpression - 7;
|
||||
return pos >= 0 && assistInterface->textAt(pos, 7) == QLatin1String("connect");
|
||||
}
|
||||
|
||||
int InternalCppCompletionAssistProcessor::startCompletionHelper()
|
||||
{
|
||||
if (m_languageFeatures.objCEnabled) {
|
||||
@@ -978,10 +1135,21 @@ int InternalCppCompletionAssistProcessor::startCompletionHelper()
|
||||
startOfExpression = endOfExpression - expression.length();
|
||||
|
||||
if (m_model->m_completionOperator == T_AMPER) {
|
||||
m_model->m_completionOperator
|
||||
= isPrecededByConnectAndOpenParenthesis(m_interface.data(), startOfExpression)
|
||||
? CompleteQt5SignalTrigger
|
||||
: CompleteQtSlotTrigger;
|
||||
// We expect 'expression' to be either "sender" or "receiver" in
|
||||
// "connect(sender, &" or
|
||||
// "connect(otherSender, &Foo::signal1, receiver, &"
|
||||
const int beforeExpression = startOfExpression - 1;
|
||||
if (canCompleteClassNameAt2ndOr4thConnectArgument(m_interface.data(), beforeExpression))
|
||||
m_model->m_completionOperator = CompleteQt5SignalOrSlotClassNameTrigger;
|
||||
} else if (m_model->m_completionOperator == T_COLON_COLON) {
|
||||
// We expect 'expression' to be "Foo" in
|
||||
// "connect(sender, &Foo::" or
|
||||
// "connect(sender, &Bar::signal1, receiver, &Foo::"
|
||||
const int beforeExpression = startOfExpression - 1;
|
||||
if (canCompleteConnectSignalAt2ndArgument(m_interface.data(), beforeExpression))
|
||||
m_model->m_completionOperator = CompleteQt5SignalTrigger;
|
||||
else if (canCompleteConnectSignalAt4thArgument(m_interface.data(), beforeExpression))
|
||||
m_model->m_completionOperator = CompleteQt5SlotTrigger;
|
||||
} else if (m_model->m_completionOperator == T_LPAREN) {
|
||||
if (expression.endsWith(QLatin1String("SIGNAL"))) {
|
||||
m_model->m_completionOperator = T_SIGNAL;
|
||||
@@ -1249,10 +1417,7 @@ int InternalCppCompletionAssistProcessor::startCompletionInternal(const QString
|
||||
if (expression.isEmpty()) {
|
||||
if (m_model->m_completionOperator == T_EOF_SYMBOL || m_model->m_completionOperator == T_COLON_COLON) {
|
||||
(void) (*m_model->m_typeOfExpression)(expression.toUtf8(), scope);
|
||||
globalCompletion(scope);
|
||||
if (m_completions.isEmpty())
|
||||
return -1;
|
||||
return m_startPosition;
|
||||
return globalCompletion(scope) ? m_startPosition : -1;
|
||||
}
|
||||
|
||||
if (m_model->m_completionOperator == T_SIGNAL || m_model->m_completionOperator == T_SLOT) {
|
||||
@@ -1304,10 +1469,12 @@ int InternalCppCompletionAssistProcessor::startCompletionInternal(const QString
|
||||
}
|
||||
return -1;
|
||||
|
||||
} else {
|
||||
// nothing to do.
|
||||
return -1;
|
||||
} else if (m_model->m_completionOperator == CompleteQt5SignalOrSlotClassNameTrigger) {
|
||||
// Fallback to global completion if we could not lookup sender/receiver object.
|
||||
return globalCompletion(scope) ? m_startPosition : -1;
|
||||
|
||||
} else {
|
||||
return -1; // nothing to do.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1338,13 +1505,20 @@ int InternalCppCompletionAssistProcessor::startCompletionInternal(const QString
|
||||
return m_startPosition;
|
||||
break;
|
||||
|
||||
case CompleteQt5SignalTrigger:
|
||||
if (completeQtMethod(results, CompleteQt5Signals))
|
||||
case CompleteQt5SignalOrSlotClassNameTrigger:
|
||||
if (completeQtMethodClassName(results, scope) || globalCompletion(scope))
|
||||
return m_startPosition;
|
||||
break;
|
||||
|
||||
case CompleteQtSlotTrigger:
|
||||
if (completeQtMethod(results, CompleteQt5Slots))
|
||||
case CompleteQt5SignalTrigger:
|
||||
// Fallback to scope completion if "X::" is a namespace and not a class.
|
||||
if (completeQtMethod(results, CompleteQt5Signals) || completeScope(results))
|
||||
return m_startPosition;
|
||||
break;
|
||||
|
||||
case CompleteQt5SlotTrigger:
|
||||
// Fallback to scope completion if "X::" is a namespace and not a class.
|
||||
if (completeQtMethod(results, CompleteQt5Slots) || completeScope(results))
|
||||
return m_startPosition;
|
||||
break;
|
||||
|
||||
@@ -1356,13 +1530,13 @@ int InternalCppCompletionAssistProcessor::startCompletionInternal(const QString
|
||||
return -1;
|
||||
}
|
||||
|
||||
void InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope)
|
||||
bool InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope)
|
||||
{
|
||||
const LookupContext &context = m_model->m_typeOfExpression->context();
|
||||
|
||||
if (m_model->m_completionOperator == T_COLON_COLON) {
|
||||
completeNamespace(context.globalNamespace());
|
||||
return;
|
||||
return !m_completions.isEmpty();
|
||||
}
|
||||
|
||||
QList<ClassOrNamespace *> usingBindings;
|
||||
@@ -1431,6 +1605,7 @@ void InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope)
|
||||
addMacros(CppModelManager::configurationFileName(), context.snapshot());
|
||||
addMacros(context.thisDocument()->fileName(), context.snapshot());
|
||||
addSnippets();
|
||||
return !m_completions.isEmpty();
|
||||
}
|
||||
|
||||
bool InternalCppCompletionAssistProcessor::completeMember(const QList<LookupItem> &baseResults)
|
||||
@@ -1659,19 +1834,8 @@ bool InternalCppCompletionAssistProcessor::completeQtMethod(const QList<LookupIt
|
||||
o.showFunctionSignatures = true;
|
||||
|
||||
QSet<QString> signatures;
|
||||
foreach (const LookupItem &p, results) {
|
||||
FullySpecifiedType ty = p.type().simplified();
|
||||
|
||||
if (PointerType *ptrTy = ty->asPointerType())
|
||||
ty = ptrTy->elementType().simplified();
|
||||
else
|
||||
continue; // not a pointer or a reference to a pointer.
|
||||
|
||||
NamedType *namedTy = ty->asNamedType();
|
||||
if (!namedTy) // not a class name.
|
||||
continue;
|
||||
|
||||
ClassOrNamespace *b = context.lookupType(namedTy->name(), p.scope());
|
||||
foreach (const LookupItem &lookupItem, results) {
|
||||
ClassOrNamespace *b = classOrNamespaceFromLookupItem(lookupItem, context);
|
||||
if (!b)
|
||||
continue;
|
||||
|
||||
@@ -1712,7 +1876,7 @@ bool InternalCppCompletionAssistProcessor::completeQtMethod(const QList<LookupIt
|
||||
unsigned count = fun->argumentCount();
|
||||
while (true) {
|
||||
const QString completionText = wantQt5SignalOrSlot
|
||||
? createQt5SignalOrSlot(fun, klass)
|
||||
? createQt5SignalOrSlot(fun, o)
|
||||
: createQt4SignalOrSlot(fun, o);
|
||||
|
||||
if (!signatures.contains(completionText)) {
|
||||
@@ -1736,6 +1900,34 @@ bool InternalCppCompletionAssistProcessor::completeQtMethod(const QList<LookupIt
|
||||
return !m_completions.isEmpty();
|
||||
}
|
||||
|
||||
bool InternalCppCompletionAssistProcessor::completeQtMethodClassName(
|
||||
const QList<LookupItem> &results, Scope *cursorScope)
|
||||
{
|
||||
QTC_ASSERT(cursorScope, return false);
|
||||
|
||||
if (results.isEmpty())
|
||||
return false;
|
||||
|
||||
const LookupContext &context = m_model->m_typeOfExpression->context();
|
||||
Overview overview;
|
||||
|
||||
foreach (const LookupItem &lookupItem, results) {
|
||||
Class *klass = classFromLookupItem(lookupItem, context);
|
||||
QTC_ASSERT(klass, continue);
|
||||
const Name *name = minimalName(klass, cursorScope, context);
|
||||
QTC_ASSERT(name, continue);
|
||||
|
||||
AssistProposalItem *item = new CppAssistProposalItem;
|
||||
item->setText(overview.prettyName(name));
|
||||
item->setDetail(overview.prettyType(klass->type(), klass->name()));
|
||||
item->setData(QVariant::fromValue(static_cast<Symbol *>(klass)));
|
||||
m_completions.append(item);
|
||||
break;
|
||||
}
|
||||
|
||||
return !m_completions.isEmpty();
|
||||
}
|
||||
|
||||
void InternalCppCompletionAssistProcessor::addKeywords()
|
||||
{
|
||||
int keywordLimit = T_FIRST_OBJC_AT_KEYWORD;
|
||||
|
||||
@@ -139,7 +139,9 @@ private:
|
||||
CompleteQt5Slots,
|
||||
};
|
||||
bool completeQtMethod(const QList<CPlusPlus::LookupItem> &results, CompleteQtMethodMode type);
|
||||
void globalCompletion(CPlusPlus::Scope *scope);
|
||||
bool completeQtMethodClassName(const QList<CPlusPlus::LookupItem> &results,
|
||||
CPlusPlus::Scope *cursorScope);
|
||||
bool globalCompletion(CPlusPlus::Scope *scope);
|
||||
|
||||
void addCompletionItem(const QString &text,
|
||||
const QIcon &icon = QIcon(),
|
||||
@@ -155,9 +157,11 @@ private:
|
||||
QSet<QString> *definedMacros);
|
||||
|
||||
enum {
|
||||
CompleteQt5SignalTrigger = CPlusPlus::T_LAST_TOKEN + 1,
|
||||
CompleteQtSlotTrigger
|
||||
CompleteQt5SignalOrSlotClassNameTrigger = CPlusPlus::T_LAST_TOKEN + 1,
|
||||
CompleteQt5SignalTrigger,
|
||||
CompleteQt5SlotTrigger
|
||||
};
|
||||
|
||||
CPlusPlus::LanguageFeatures m_languageFeatures;
|
||||
QScopedPointer<const CppCompletionAssistInterface> m_interface;
|
||||
QScopedPointer<CppAssistProposalModel> m_model;
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
<string>Headers</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="headerSuffixLabel">
|
||||
<property name="text">
|
||||
@@ -98,6 +101,9 @@ These prefixes are used in addition to current file name on Switch Header/Source
|
||||
<string>Sources</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="sourceSuffixLabel">
|
||||
<property name="text">
|
||||
|
||||
@@ -840,6 +840,7 @@ ProjectPart::Ptr CppModelManager::fallbackProjectPart() const
|
||||
part->languageVersion = ProjectPart::CXX14;
|
||||
part->languageExtensions = ProjectPart::AllExtensions;
|
||||
part->qtVersion = ProjectPart::Qt5;
|
||||
part->updateLanguageFeatures();
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
@@ -108,6 +108,29 @@ void ProjectPart::evaluateToolchain(const ToolChain *tc,
|
||||
}
|
||||
|
||||
toolchainDefines = tc->predefinedMacros(commandLineFlags);
|
||||
updateLanguageFeatures();
|
||||
}
|
||||
|
||||
void ProjectPart::updateLanguageFeatures()
|
||||
{
|
||||
const bool hasQt = qtVersion != NoQt;
|
||||
languageFeatures.cxx11Enabled = languageVersion >= CXX11;
|
||||
languageFeatures.qtEnabled = hasQt;
|
||||
languageFeatures.qtMocRunEnabled = hasQt;
|
||||
if (!hasQt) {
|
||||
languageFeatures.qtKeywordsEnabled = false;
|
||||
} else {
|
||||
const QByteArray noKeywordsMacro = "#define QT_NO_KEYWORDS";
|
||||
const int noKeywordsIndex = projectDefines.indexOf(noKeywordsMacro);
|
||||
if (noKeywordsIndex == -1) {
|
||||
languageFeatures.qtKeywordsEnabled = true;
|
||||
} else {
|
||||
const char nextChar = projectDefines.at(noKeywordsIndex + noKeywordsMacro.length());
|
||||
// Detect "#define QT_NO_KEYWORDS" and "#define QT_NO_KEYWORDS 1", but exclude
|
||||
// "#define QT_NO_KEYWORDS_FOO"
|
||||
languageFeatures.qtKeywordsEnabled = nextChar != '\n' && nextChar != ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ProjectPart::Ptr ProjectPart::copy() const
|
||||
@@ -198,6 +221,7 @@ void ProjectInfo::finish()
|
||||
|
||||
QSet<HeaderPath> incs;
|
||||
foreach (const ProjectPart::Ptr &part, m_projectParts) {
|
||||
part->updateLanguageFeatures();
|
||||
// Update header paths
|
||||
foreach (const HeaderPath &hp, part->headerPaths) {
|
||||
if (!incs.contains(hp)) {
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
#include <cplusplus/Token.h>
|
||||
|
||||
#include <QPointer>
|
||||
#include <QSet>
|
||||
|
||||
@@ -109,6 +111,7 @@ public: // methods
|
||||
const QStringList &commandLineFlags,
|
||||
const Utils::FileName &sysRoot);
|
||||
|
||||
void updateLanguageFeatures();
|
||||
Ptr copy() const;
|
||||
|
||||
QString id() const;
|
||||
@@ -127,6 +130,7 @@ public: // fields
|
||||
QStringList precompiledHeaders;
|
||||
LanguageVersion languageVersion;
|
||||
LanguageExtensions languageExtensions;
|
||||
CPlusPlus::LanguageFeatures languageFeatures;
|
||||
QtVersion qtVersion;
|
||||
ProjectExplorer::ToolChain::WarningFlags warningFlags;
|
||||
bool selectedForBuilding;
|
||||
|
||||
@@ -116,6 +116,7 @@ CppSourceProcessor::CppSourceProcessor(const Snapshot &snapshot, DocumentCallbac
|
||||
: m_snapshot(snapshot),
|
||||
m_documentFinished(documentFinished),
|
||||
m_preprocess(this, &m_env),
|
||||
m_languageFeatures(LanguageFeatures::defaultFeatures()),
|
||||
m_revision(0),
|
||||
m_defaultCodec(Core::EditorManager::defaultTextCodec())
|
||||
{
|
||||
@@ -145,6 +146,11 @@ void CppSourceProcessor::setHeaderPaths(const ProjectPart::HeaderPaths &headerPa
|
||||
}
|
||||
}
|
||||
|
||||
void CppSourceProcessor::setLanguageFeatures(const LanguageFeatures languageFeatures)
|
||||
{
|
||||
m_languageFeatures = languageFeatures;
|
||||
}
|
||||
|
||||
// Add the given framework path, and expand private frameworks.
|
||||
//
|
||||
// Example:
|
||||
@@ -466,6 +472,7 @@ void CppSourceProcessor::sourceNeeded(unsigned line, const QString &fileName, In
|
||||
Document::Ptr document = Document::create(absoluteFileName);
|
||||
document->setRevision(m_revision);
|
||||
document->setEditorRevision(editorRevision);
|
||||
document->setLanguageFeatures(m_languageFeatures);
|
||||
foreach (const QString &include, initialIncludes) {
|
||||
m_included.insert(include);
|
||||
Document::Include inc(include, include, 0, IncludeLocal);
|
||||
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
void setRevision(unsigned revision);
|
||||
void setWorkingCopy(const CppTools::WorkingCopy &workingCopy);
|
||||
void setHeaderPaths(const ProjectPart::HeaderPaths &headerPaths);
|
||||
void setLanguageFeatures(CPlusPlus::LanguageFeatures languageFeatures);
|
||||
void setTodo(const QSet<QString> &files);
|
||||
|
||||
void run(const QString &fileName, const QStringList &initialIncludes = QStringList());
|
||||
@@ -117,6 +118,7 @@ private:
|
||||
CPlusPlus::Environment m_env;
|
||||
CPlusPlus::Preprocessor m_preprocess;
|
||||
ProjectPart::HeaderPaths m_headerPaths;
|
||||
CPlusPlus::LanguageFeatures m_languageFeatures;
|
||||
CppTools::WorkingCopy m_workingCopy;
|
||||
QSet<QString> m_included;
|
||||
CPlusPlus::Document::Ptr m_currentDoc;
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
<string>Configuration</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="commandLabel">
|
||||
<property name="text">
|
||||
@@ -46,6 +49,9 @@
|
||||
<string>Miscellaneous</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="diffOptionsLabel">
|
||||
<property name="text">
|
||||
|
||||
@@ -2040,9 +2040,15 @@ unsigned CdbEngine::examineStopReason(const GdbMi &stopReason,
|
||||
if (!conditionalBreakPointTriggered && !parameters.condition.isEmpty()) {
|
||||
*message = msgCheckingConditionalBreakPoint(id, number, parameters.condition,
|
||||
QString::number(threadId));
|
||||
ConditionalBreakPointCookie cookie(id);
|
||||
cookie.stopReason = stopReason;
|
||||
evaluateExpression(parameters.condition, cookie);
|
||||
|
||||
QByteArray exp = parameters.condition;
|
||||
if (exp.contains(' ') && !exp.startsWith('"')) {
|
||||
exp.prepend('"');
|
||||
exp.append('"');
|
||||
}
|
||||
postExtensionCommand("expression", exp, 0,
|
||||
[this, id, stopReason](const CdbCommandPtr &r) { handleExpression(r, id, stopReason); });
|
||||
|
||||
return StopReportLog;
|
||||
}
|
||||
} else {
|
||||
@@ -3081,7 +3087,7 @@ void CdbEngine::handleStackTrace(const CdbCommandPtr &command)
|
||||
}
|
||||
}
|
||||
|
||||
void CdbEngine::handleExpression(const CdbCommandPtr &command, const ConditionalBreakPointCookie &cookie)
|
||||
void CdbEngine::handleExpression(const CdbCommandPtr &command, BreakpointModelId id, const GdbMi &stopReason)
|
||||
{
|
||||
int value = 0;
|
||||
if (command->success)
|
||||
@@ -3091,27 +3097,17 @@ void CdbEngine::handleExpression(const CdbCommandPtr &command, const Conditional
|
||||
// Is this a conditional breakpoint?
|
||||
const QString message = value ?
|
||||
tr("Value %1 obtained from evaluating the condition of breakpoint %2, stopping.").
|
||||
arg(value).arg(cookie.id.toString()) :
|
||||
arg(value).arg(id.toString()) :
|
||||
tr("Value 0 obtained from evaluating the condition of breakpoint %1, continuing.").
|
||||
arg(cookie.id.toString());
|
||||
arg(id.toString());
|
||||
showMessage(message, LogMisc);
|
||||
// Stop if evaluation is true, else continue
|
||||
if (value)
|
||||
processStop(cookie.stopReason, true);
|
||||
processStop(stopReason, true);
|
||||
else
|
||||
doContinueInferior();
|
||||
}
|
||||
|
||||
void CdbEngine::evaluateExpression(QByteArray exp, const ConditionalBreakPointCookie &cookie)
|
||||
{
|
||||
if (exp.contains(' ') && !exp.startsWith('"')) {
|
||||
exp.prepend('"');
|
||||
exp.append('"');
|
||||
}
|
||||
postExtensionCommand("expression", exp, 0,
|
||||
[this, cookie](const CdbCommandPtr &r) { handleExpression(r, cookie); });
|
||||
}
|
||||
|
||||
void CdbEngine::dummyHandler(const CdbCommandPtr &command)
|
||||
{
|
||||
postCommandSequence(command->commandSequence);
|
||||
|
||||
@@ -51,7 +51,6 @@ namespace Internal {
|
||||
class DisassemblerAgent;
|
||||
struct CdbCommand;
|
||||
struct MemoryViewCookie;
|
||||
struct ConditionalBreakPointCookie;
|
||||
class ByteArrayInputStream;
|
||||
class GdbMi;
|
||||
|
||||
@@ -215,14 +214,13 @@ private:
|
||||
DisassemblerAgent *agent);
|
||||
void postResolveSymbol(const QString &module, const QString &function,
|
||||
DisassemblerAgent *agent);
|
||||
void evaluateExpression(QByteArray exp, const ConditionalBreakPointCookie &cookie);
|
||||
// Builtin commands
|
||||
void dummyHandler(const CdbCommandPtr &);
|
||||
void handleStackTrace(const CdbCommandPtr &);
|
||||
void handleRegisters(const CdbCommandPtr &);
|
||||
void handleDisassembler(const CdbCommandPtr &, DisassemblerAgent *agent);
|
||||
void handleJumpToLineAddressResolution(const CdbCommandPtr &, const ContextData &context);
|
||||
void handleExpression(const CdbCommandPtr &, const ConditionalBreakPointCookie &cookie);
|
||||
void handleExpression(const CdbCommandPtr &command, BreakpointModelId id, const GdbMi &stopReason);
|
||||
void handleResolveSymbol(const CdbCommandPtr &command, const QString &symbol, DisassemblerAgent *agent);
|
||||
void handleResolveSymbolHelper(const QList<quint64> &addresses, DisassemblerAgent *agent);
|
||||
void handleBreakInsert(const CdbCommandPtr &cmd);
|
||||
|
||||
@@ -1859,7 +1859,7 @@ void DebuggerEngine::validateExecutable(DebuggerStartParameters *sp)
|
||||
if (found)
|
||||
break;
|
||||
|
||||
const int len = strlen(str);
|
||||
const int len = int(strlen(str));
|
||||
if (len == 0)
|
||||
break;
|
||||
str += len + 1;
|
||||
|
||||
@@ -148,7 +148,7 @@ void DebuggerItem::reinitializeFromFile()
|
||||
|
||||
// Version
|
||||
if (ba.startsWith(("lldb version "))) { // Linux typically.
|
||||
int pos1 = strlen("lldb version ");
|
||||
int pos1 = int(strlen("lldb version "));
|
||||
int pos2 = ba.indexOf(' ', pos1);
|
||||
m_version = QString::fromLatin1(ba.mid(pos1, pos2 - pos1));
|
||||
} else if (ba.startsWith("lldb-") || ba.startsWith("LLDB-")) { // Mac typically.
|
||||
|
||||
@@ -127,8 +127,7 @@ QWidget *DebuggerKitConfigWidget::mainWidget() const
|
||||
|
||||
void DebuggerKitConfigWidget::manageDebuggers()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
|
||||
ProjectExplorer::Constants::DEBUGGER_SETTINGS_PAGE_ID,
|
||||
Core::ICore::showOptionsDialog(ProjectExplorer::Constants::DEBUGGER_SETTINGS_PAGE_ID,
|
||||
buttonWidget());
|
||||
}
|
||||
|
||||
|
||||
@@ -706,12 +706,8 @@ public:
|
||||
const QString &tracePointMessage = QString());
|
||||
void onModeChanged(IMode *mode);
|
||||
void onCoreAboutToOpen();
|
||||
void showSettingsDialog();
|
||||
void updateDebugWithoutDeployMenu();
|
||||
|
||||
void debugProject();
|
||||
void debugProjectWithoutDeploy();
|
||||
void debugProjectBreakMain();
|
||||
void startAndDebugApplication();
|
||||
void startRemoteCdbSession();
|
||||
void startRemoteServer();
|
||||
@@ -819,7 +815,7 @@ public slots:
|
||||
void handleExecStep()
|
||||
{
|
||||
if (currentEngine()->state() == DebuggerNotReady) {
|
||||
debugProjectBreakMain();
|
||||
ProjectExplorerPlugin::runStartupProject(DebugRunModeWithBreakOnMain);
|
||||
} else {
|
||||
currentEngine()->resetLocation();
|
||||
if (boolSetting(OperateByInstruction))
|
||||
@@ -832,7 +828,7 @@ public slots:
|
||||
void handleExecNext()
|
||||
{
|
||||
if (currentEngine()->state() == DebuggerNotReady) {
|
||||
debugProjectBreakMain();
|
||||
ProjectExplorerPlugin::runStartupProject(DebugRunModeWithBreakOnMain);
|
||||
} else {
|
||||
currentEngine()->resetLocation();
|
||||
if (boolSetting(OperateByInstruction))
|
||||
@@ -903,15 +899,6 @@ public slots:
|
||||
}
|
||||
}
|
||||
|
||||
void slotDisassembleFunction()
|
||||
{
|
||||
const QAction *action = qobject_cast<const QAction *>(sender());
|
||||
QTC_ASSERT(action, return);
|
||||
const StackFrame frame = action->data().value<StackFrame>();
|
||||
QTC_ASSERT(!frame.function.isEmpty(), return);
|
||||
currentEngine()->openDisassemblerView(Location(frame));
|
||||
}
|
||||
|
||||
void handleAddToWatchWindow()
|
||||
{
|
||||
// Requires a selection, but that's the only case we want anyway.
|
||||
@@ -1336,21 +1323,6 @@ void DebuggerPluginPrivate::onCurrentProjectChanged(Project *project)
|
||||
setProxyAction(m_visibleStartAction, Id(Constants::DEBUG));
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::debugProject()
|
||||
{
|
||||
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunMode);
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::debugProjectWithoutDeploy()
|
||||
{
|
||||
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunMode, true);
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::debugProjectBreakMain()
|
||||
{
|
||||
ProjectExplorerPlugin::runProject(SessionManager::startupProject(), DebugRunModeWithBreakOnMain);
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::startAndDebugApplication()
|
||||
{
|
||||
DebuggerStartParameters sp;
|
||||
@@ -1738,18 +1710,18 @@ void DebuggerPluginPrivate::requestContextMenu(TextEditorWidget *widget,
|
||||
});
|
||||
}
|
||||
// Disassemble current function in stopped state.
|
||||
if (currentEngine()->state() == InferiorStopOk
|
||||
&& currentEngine()->hasCapability(DisassemblerCapability)) {
|
||||
if (currentEngine()->hasCapability(DisassemblerCapability)) {
|
||||
StackFrame frame;
|
||||
frame.function = cppFunctionAt(args.fileName, lineNumber);
|
||||
frame.function = cppFunctionAt(args.fileName, lineNumber, 1);
|
||||
frame.line = 42; // trick gdb into mixed mode.
|
||||
if (!frame.function.isEmpty()) {
|
||||
const QString text = tr("Disassemble Function \"%1\"")
|
||||
.arg(frame.function);
|
||||
QAction *disassembleAction = new QAction(text, menu);
|
||||
disassembleAction->setData(QVariant::fromValue(frame));
|
||||
connect(disassembleAction, &QAction::triggered, this, &DebuggerPluginPrivate::slotDisassembleFunction);
|
||||
menu->addAction(disassembleAction );
|
||||
auto act = new QAction(text, menu);
|
||||
connect(act, &QAction::triggered, [this, frame] {
|
||||
currentEngine()->openDisassemblerView(Location(frame));
|
||||
});
|
||||
menu->addAction(act);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2188,11 +2160,6 @@ void DebuggerPluginPrivate::onModeChanged(IMode *mode)
|
||||
m_toolTipManager.debugModeEntered();
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::showSettingsDialog()
|
||||
{
|
||||
ICore::showOptionsDialog(DEBUGGER_SETTINGS_CATEGORY, DEBUGGER_COMMON_SETTINGS_ID);
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::updateDebugWithoutDeployMenu()
|
||||
{
|
||||
const bool state = ProjectExplorerPlugin::projectExplorerSettings().deployBeforeRun;
|
||||
@@ -2661,11 +2628,11 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
||||
debuggerIcon.addFile(QLatin1String(":/projectexplorer/images/debugger_start.png"));
|
||||
act->setIcon(debuggerIcon);
|
||||
act->setText(tr("Start Debugging"));
|
||||
connect(act, &QAction::triggered, this, &DebuggerPluginPrivate::debugProject);
|
||||
connect(act, &QAction::triggered, [] { ProjectExplorerPlugin::runStartupProject(DebugRunMode); });
|
||||
|
||||
act = m_debugWithoutDeployAction = new QAction(this);
|
||||
act->setText(tr("Start Debugging Without Deployment"));
|
||||
connect(act, &QAction::triggered, this, &DebuggerPluginPrivate::debugProjectWithoutDeploy);
|
||||
connect(act, &QAction::triggered, [] { ProjectExplorerPlugin::runStartupProject(DebugRunMode, true); });
|
||||
|
||||
act = m_startAndDebugApplicationAction = new QAction(this);
|
||||
act->setText(tr("Start and Debug External Application..."));
|
||||
@@ -3017,7 +2984,7 @@ void DebuggerPluginPrivate::extensionsInitialized()
|
||||
|
||||
// Application interaction
|
||||
connect(action(SettingsDialog), &QAction::triggered,
|
||||
this, &DebuggerPluginPrivate::showSettingsDialog);
|
||||
[] { ICore::showOptionsDialog(DEBUGGER_COMMON_SETTINGS_ID); });
|
||||
|
||||
// QML Actions
|
||||
connect(action(ShowQmlObjectTree), &SavedAction::valueChanged,
|
||||
|
||||
@@ -368,7 +368,7 @@ void GdbMi::fromStringMultiple(const QByteArray &ba)
|
||||
|
||||
GdbMi GdbMi::operator[](const char *name) const
|
||||
{
|
||||
for (int i = 0, n = m_children.size(); i < n; ++i)
|
||||
for (int i = 0, n = int(m_children.size()); i < n; ++i)
|
||||
if (m_children.at(i).m_name == name)
|
||||
return m_children.at(i);
|
||||
return GdbMi();
|
||||
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
|
||||
inline QByteArray data() const { return m_data; }
|
||||
inline const std::vector<GdbMi> &children() const { return m_children; }
|
||||
inline int childCount() const { return m_children.size(); }
|
||||
inline int childCount() const { return int(m_children.size()); }
|
||||
|
||||
const GdbMi &childAt(int index) const { return m_children[index]; }
|
||||
GdbMi &childAt(int index) { return m_children[index]; }
|
||||
|
||||
@@ -275,6 +275,7 @@ DebuggerSourcePathMappingWidget::DebuggerSourcePathMappingWidget(QWidget *parent
|
||||
editTargetLabel->setBuddy(m_targetChooser);
|
||||
m_targetChooser->setToolTip(targetToolTip);
|
||||
editLayout->addRow(editTargetLabel, m_targetChooser);
|
||||
editLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
|
||||
|
||||
auto chooser = new Core::VariableChooser(this);
|
||||
chooser->addSupportedWidget(m_targetChooser->lineEdit());
|
||||
|
||||
@@ -2593,14 +2593,6 @@ void GdbEngine::handleBreakInsert2(const DebuggerResponse &response, Breakpoint
|
||||
}
|
||||
}
|
||||
|
||||
void GdbEngine::handleBreakDelete(const DebuggerResponse &response, Breakpoint bp)
|
||||
{
|
||||
if (response.resultClass == ResultDone)
|
||||
bp.notifyBreakpointRemoveOk();
|
||||
else
|
||||
bp.notifyBreakpointRemoveFailed();
|
||||
}
|
||||
|
||||
void GdbEngine::handleBreakDisable(const DebuggerResponse &response, Breakpoint bp)
|
||||
{
|
||||
QTC_CHECK(response.resultClass == ResultDone);
|
||||
@@ -2882,8 +2874,14 @@ void GdbEngine::removeBreakpoint(Breakpoint bp)
|
||||
bp.notifyBreakpointRemoveProceeding();
|
||||
showMessage(_("DELETING BP %1 IN %2").arg(br.id.toString()).arg(bp.fileName()));
|
||||
postCommand("-break-delete " + br.id.toByteArray(),
|
||||
NeedsStop | RebuildBreakpointModel,
|
||||
[this, bp](const DebuggerResponse &r) { handleBreakDelete(r, bp); });
|
||||
NeedsStop | RebuildBreakpointModel);
|
||||
|
||||
// Pretend it succeeds without waiting for response. Feels better.
|
||||
// Otherwise, clicking in the gutter leaves the breakpoint visible
|
||||
// for quite some time, so the user assumes a mis-click and clicks
|
||||
// again, effectivly re-introducing the breakpoint.
|
||||
bp.notifyBreakpointRemoveOk();
|
||||
|
||||
} else {
|
||||
// Breakpoint was scheduled to be inserted, but we haven't had
|
||||
// an answer so far. Postpone activity by doing nothing.
|
||||
@@ -3900,7 +3898,7 @@ void GdbEngine::handleFetchMemory(const DebuggerResponse &response, MemoryAgentC
|
||||
return;
|
||||
GdbMi memory0 = memory.children().at(0); // we asked for only one 'row'
|
||||
GdbMi data = memory0["data"];
|
||||
for (int i = 0, n = data.children().size(); i != n; ++i) {
|
||||
for (int i = 0, n = int(data.children().size()); i != n; ++i) {
|
||||
const GdbMi &child = data.children().at(i);
|
||||
bool ok = true;
|
||||
unsigned char c = '?';
|
||||
@@ -4426,8 +4424,7 @@ void GdbEngine::handleAdapterStartFailed(const QString &msg, Id settingsIdHint)
|
||||
if (!settingsIdHint.isValid()) {
|
||||
ICore::showWarningWithOptions(title, msg);
|
||||
} else {
|
||||
ICore::showWarningWithOptions(title, msg, QString(),
|
||||
Constants::DEBUGGER_SETTINGS_CATEGORY, settingsIdHint);
|
||||
ICore::showWarningWithOptions(title, msg, QString(), settingsIdHint);
|
||||
}
|
||||
}
|
||||
notifyEngineSetupFailed();
|
||||
|
||||
@@ -287,7 +287,6 @@ private: ////////// View & Data Stuff //////////
|
||||
void handleBreakEnable(const DebuggerResponse &response, Breakpoint bp);
|
||||
void handleBreakInsert1(const DebuggerResponse &response, Breakpoint bp);
|
||||
void handleBreakInsert2(const DebuggerResponse &response, Breakpoint bp);
|
||||
void handleBreakDelete(const DebuggerResponse &response, Breakpoint bp);
|
||||
void handleBreakCondition(const DebuggerResponse &response, Breakpoint bp);
|
||||
void handleBreakThreadSpec(const DebuggerResponse &response, Breakpoint bp);
|
||||
void handleBreakLineNumber(const DebuggerResponse &response, Breakpoint bp);
|
||||
|
||||
@@ -62,9 +62,9 @@ private:
|
||||
|
||||
void handleStubAttached(const DebuggerResponse &response);
|
||||
|
||||
Q_SLOT void stubStarted();
|
||||
Q_SLOT void stubExited();
|
||||
Q_SLOT void stubError(const QString &msg);
|
||||
void stubStarted();
|
||||
void stubExited();
|
||||
void stubError(const QString &msg);
|
||||
|
||||
Utils::ConsoleProcess m_stubProc;
|
||||
};
|
||||
|
||||
@@ -312,6 +312,7 @@ void LldbEngine::setupInferior()
|
||||
showMessage(_("TAKING OWNERSHIP OF BREAKPOINT %1 IN STATE %2")
|
||||
.arg(bp.id().toString()).arg(bp.state()));
|
||||
bp.setEngine(this);
|
||||
bp.notifyBreakpointInsertProceeding();
|
||||
cmd.beginGroup();
|
||||
bp.addToCommand(&cmd);
|
||||
cmd.endGroup();
|
||||
@@ -459,6 +460,8 @@ void LldbEngine::handleResponse(const QByteArray &response)
|
||||
refreshMemory(item);
|
||||
else if (name == "full-backtrace")
|
||||
showFullBacktrace(item);
|
||||
else if (name == "continuation")
|
||||
handleContinuation(item);
|
||||
else if (name == "statusmessage") {
|
||||
QString msg = QString::fromUtf8(item.data());
|
||||
if (msg.size())
|
||||
@@ -468,6 +471,15 @@ void LldbEngine::handleResponse(const QByteArray &response)
|
||||
}
|
||||
}
|
||||
|
||||
void LldbEngine::handleContinuation(const GdbMi &data)
|
||||
{
|
||||
if (data.data() == "updateLocals") {
|
||||
updateLocals();
|
||||
return;
|
||||
}
|
||||
QTC_ASSERT(false, qDebug() << "Unknown continuation: " << data.data());
|
||||
}
|
||||
|
||||
void LldbEngine::showFullBacktrace(const GdbMi &data)
|
||||
{
|
||||
Internal::openTextEditor(_("Backtrace $"),
|
||||
@@ -523,10 +535,10 @@ void LldbEngine::activateFrame(int frameIndex)
|
||||
DebuggerCommand cmd("activateFrame");
|
||||
cmd.arg("index", frameIndex);
|
||||
cmd.arg("thread", threadsHandler()->currentThread().raw());
|
||||
cmd.arg("continuation", "updateLocals");
|
||||
runCommand(cmd);
|
||||
|
||||
reloadRegisters();
|
||||
updateLocals();
|
||||
}
|
||||
|
||||
void LldbEngine::selectThread(ThreadId threadId)
|
||||
@@ -609,7 +621,7 @@ void LldbEngine::updateBreakpointData(const GdbMi &bkpt, bool added)
|
||||
response.lineNumber = bkpt["line"].toInt();
|
||||
|
||||
GdbMi locations = bkpt["locations"];
|
||||
const int numChild = locations.children().size();
|
||||
const int numChild = int(locations.children().size());
|
||||
if (numChild > 1) {
|
||||
foreach (const GdbMi &location, locations.children()) {
|
||||
const int locid = location["locid"].toInt();
|
||||
@@ -792,8 +804,12 @@ bool LldbEngine::setToolTipExpression(TextEditor::TextEditorWidget *editorWidget
|
||||
void LldbEngine::updateAll()
|
||||
{
|
||||
reloadRegisters();
|
||||
updateStack();
|
||||
updateLocals();
|
||||
|
||||
DebuggerCommand cmd("reportStack");
|
||||
cmd.arg("nativeMixed", isNativeMixedActive());
|
||||
cmd.arg("stacklimit", action(MaximalStackDepth)->value().toInt());
|
||||
cmd.arg("continuation", "updateLocals");
|
||||
runCommand(cmd);
|
||||
}
|
||||
|
||||
void LldbEngine::reloadFullStack()
|
||||
@@ -804,14 +820,6 @@ void LldbEngine::reloadFullStack()
|
||||
runCommand(cmd);
|
||||
}
|
||||
|
||||
void LldbEngine::updateStack()
|
||||
{
|
||||
DebuggerCommand cmd("reportStack");
|
||||
cmd.arg("nativeMixed", isNativeMixedActive());
|
||||
cmd.arg("stacklimit", action(MaximalStackDepth)->value().toInt());
|
||||
runCommand(cmd);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Watch specific stuff
|
||||
|
||||
@@ -132,16 +132,17 @@ private:
|
||||
QString errorMessage(QProcess::ProcessError error) const;
|
||||
bool hasCapability(unsigned cap) const;
|
||||
|
||||
Q_SLOT void handleLldbFinished(int, QProcess::ExitStatus status);
|
||||
Q_SLOT void handleLldbError(QProcess::ProcessError error);
|
||||
Q_SLOT void readLldbStandardOutput();
|
||||
Q_SLOT void readLldbStandardError();
|
||||
Q_SLOT void handleResponse(const QByteArray &data);
|
||||
Q_SLOT void updateAll();
|
||||
Q_SLOT void updateStack();
|
||||
Q_SLOT void updateLocals();
|
||||
Q_SLOT void createFullBacktrace();
|
||||
void handleLldbFinished(int, QProcess::ExitStatus status);
|
||||
void handleLldbError(QProcess::ProcessError error);
|
||||
void readLldbStandardOutput();
|
||||
void readLldbStandardError();
|
||||
void handleResponse(const QByteArray &data);
|
||||
void updateAll();
|
||||
void updateLocals();
|
||||
void createFullBacktrace();
|
||||
void doUpdateLocals(UpdateParameters params);
|
||||
void handleContinuation(const GdbMi &data);
|
||||
|
||||
void refreshAll(const GdbMi &all);
|
||||
void refreshThreads(const GdbMi &threads);
|
||||
void refreshStack(const GdbMi &stack);
|
||||
|
||||
@@ -462,7 +462,7 @@ void ThreadsHandler::updateThreads(const GdbMi &data)
|
||||
// }
|
||||
|
||||
const std::vector<GdbMi> items = data["threads"].children();
|
||||
const int n = items.size();
|
||||
const int n = int(items.size());
|
||||
for (int index = 0; index != n; ++index) {
|
||||
const GdbMi item = items[index];
|
||||
const GdbMi frame = item["frame"];
|
||||
|
||||
@@ -665,7 +665,7 @@ void parseChildrenData(const WatchData &data0, const GdbMi &item,
|
||||
childtemplate.address = addressBase;
|
||||
arrayDecoder(childtemplate, mi.data(), encoding);
|
||||
} else {
|
||||
for (int i = 0, n = children.children().size(); i != n; ++i) {
|
||||
for (int i = 0, n = int(children.children().size()); i != n; ++i) {
|
||||
const GdbMi &child = children.children().at(i);
|
||||
WatchData data1 = childtemplate;
|
||||
data1.sortId = i;
|
||||
|
||||
@@ -96,7 +96,7 @@ bool SearchFunction::visit(CPlusPlus::Function * f)
|
||||
if (const CPlusPlus::Name *name = f->name())
|
||||
if (const CPlusPlus::Identifier *id = name->identifier())
|
||||
if (id->size() == m_length)
|
||||
if (!qstrncmp(m_name, id->chars(), m_length))
|
||||
if (!qstrncmp(m_name, id->chars(), uint(m_length)))
|
||||
m_matches.push_back(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
#include "diffeditorconstants.h"
|
||||
#include "diffeditordocument.h"
|
||||
#include "diffeditorguicontroller.h"
|
||||
#include "sidebysidediffeditorwidget.h"
|
||||
#include "unifieddiffeditorwidget.h"
|
||||
#include "diffview.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -44,6 +43,7 @@
|
||||
#include <texteditor/displaysettings.h>
|
||||
#include <texteditor/marginsettings.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -61,8 +61,6 @@
|
||||
|
||||
static const char settingsGroupC[] = "DiffEditor";
|
||||
static const char diffEditorTypeKeyC[] = "DiffEditorType";
|
||||
static const char sideBySideDiffEditorValueC[] = "SideBySide";
|
||||
static const char unifiedDiffEditorValueC[] = "Unified";
|
||||
|
||||
static const char legacySettingsGroupC[] = "Git";
|
||||
static const char useDiffEditorKeyC[] = "UseDiffEditor";
|
||||
@@ -204,9 +202,7 @@ DiffEditor::DiffEditor(const QSharedPointer<DiffEditorDocument> &doc)
|
||||
: m_document(doc)
|
||||
, m_descriptionWidget(0)
|
||||
, m_stackedWidget(0)
|
||||
, m_sideBySideEditor(0)
|
||||
, m_unifiedEditor(0)
|
||||
, m_currentEditor(0)
|
||||
, m_currentViewIndex(-1)
|
||||
, m_guiController(0)
|
||||
, m_toolBar(0)
|
||||
, m_entriesComboBox(0)
|
||||
@@ -225,15 +221,11 @@ DiffEditor::DiffEditor(const QSharedPointer<DiffEditorDocument> &doc)
|
||||
m_stackedWidget = new QStackedWidget(splitter);
|
||||
splitter->addWidget(m_stackedWidget);
|
||||
|
||||
m_sideBySideEditor = new SideBySideDiffEditorWidget(m_stackedWidget);
|
||||
m_stackedWidget->addWidget(m_sideBySideEditor);
|
||||
|
||||
m_unifiedEditor = new UnifiedDiffEditorWidget(m_stackedWidget);
|
||||
m_stackedWidget->addWidget(m_unifiedEditor);
|
||||
addView(new SideBySideView);
|
||||
addView(new UnifiedView);
|
||||
|
||||
setWidget(splitter);
|
||||
|
||||
|
||||
DiffEditorController *control = controller();
|
||||
m_guiController = new DiffEditorGuiController(control, this);
|
||||
|
||||
@@ -254,7 +246,7 @@ DiffEditor::DiffEditor(const QSharedPointer<DiffEditorDocument> &doc)
|
||||
slotDescriptionChanged(control->description());
|
||||
slotDescriptionVisibilityChanged();
|
||||
|
||||
showDiffEditor(readCurrentDiffEditorSetting());
|
||||
showDiffView(readCurrentDiffEditorSetting());
|
||||
|
||||
toolBar();
|
||||
}
|
||||
@@ -283,12 +275,12 @@ Core::IDocument *DiffEditor::document()
|
||||
return m_document.data();
|
||||
}
|
||||
|
||||
static QToolBar *createToolBar(const QWidget *someWidget)
|
||||
static QToolBar *createToolBar(IDiffView *someView)
|
||||
{
|
||||
// Create
|
||||
QToolBar *toolBar = new QToolBar;
|
||||
toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
const int size = someWidget->style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||
const int size = someView->widget()->style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||
toolBar->setIconSize(QSize(size, size));
|
||||
|
||||
return toolBar;
|
||||
@@ -296,13 +288,15 @@ static QToolBar *createToolBar(const QWidget *someWidget)
|
||||
|
||||
QWidget *DiffEditor::toolBar()
|
||||
{
|
||||
QTC_ASSERT(!m_views.isEmpty(), return 0);
|
||||
|
||||
if (m_toolBar)
|
||||
return m_toolBar;
|
||||
|
||||
DiffEditorController *control = controller();
|
||||
|
||||
// Create
|
||||
m_toolBar = createToolBar(m_sideBySideEditor);
|
||||
m_toolBar = createToolBar(m_views.at(0));
|
||||
|
||||
m_entriesComboBox = new QComboBox;
|
||||
m_entriesComboBox->setMinimumContentsLength(20);
|
||||
@@ -334,8 +328,7 @@ QWidget *DiffEditor::toolBar()
|
||||
m_contextSpinBoxAction = m_toolBar->addWidget(contextSpinBox);
|
||||
|
||||
QToolButton *toggleDescription = new QToolButton(m_toolBar);
|
||||
toggleDescription->setIcon(
|
||||
QIcon(QLatin1String(Constants::ICON_TOP_BAR)));
|
||||
toggleDescription->setIcon(QIcon(QLatin1String(Constants::ICON_TOP_BAR)));
|
||||
toggleDescription->setCheckable(true);
|
||||
toggleDescription->setChecked(m_guiController->isDescriptionVisible());
|
||||
m_toggleDescriptionAction = m_toolBar->addWidget(toggleDescription);
|
||||
@@ -371,7 +364,7 @@ QWidget *DiffEditor::toolBar()
|
||||
connect(toggleDescription, &QAbstractButton::clicked,
|
||||
m_guiController, &DiffEditorGuiController::setDescriptionVisible);
|
||||
connect(m_diffEditorSwitcher, &QAbstractButton::clicked,
|
||||
this, &DiffEditor::slotDiffEditorSwitched);
|
||||
this, [this]() { showDiffView(nextView()); });
|
||||
connect(reloadButton, &QAbstractButton::clicked,
|
||||
control, &DiffEditorController::requestReload);
|
||||
connect(control, &DiffEditorController::reloaderChanged,
|
||||
@@ -505,65 +498,70 @@ void DiffEditor::slotReloaderChanged()
|
||||
m_reloadAction->setVisible(reloader);
|
||||
}
|
||||
|
||||
void DiffEditor::slotDiffEditorSwitched()
|
||||
{
|
||||
QWidget *oldEditor = m_currentEditor;
|
||||
QWidget *newEditor = 0;
|
||||
if (oldEditor == m_sideBySideEditor)
|
||||
newEditor = m_unifiedEditor;
|
||||
else if (oldEditor == m_unifiedEditor)
|
||||
newEditor = m_sideBySideEditor;
|
||||
else
|
||||
newEditor = readCurrentDiffEditorSetting();
|
||||
|
||||
showDiffEditor(newEditor);
|
||||
}
|
||||
|
||||
void DiffEditor::updateDiffEditorSwitcher()
|
||||
{
|
||||
if (!m_diffEditorSwitcher)
|
||||
return;
|
||||
|
||||
QIcon actionIcon;
|
||||
QString actionToolTip;
|
||||
if (m_currentEditor == m_unifiedEditor) {
|
||||
actionIcon = QIcon(QLatin1String(Constants::ICON_SIDE_BY_SIDE_DIFF));
|
||||
actionToolTip = tr("Switch to Side By Side Diff Editor");
|
||||
} else if (m_currentEditor == m_sideBySideEditor) {
|
||||
actionIcon = QIcon(QLatin1String(Constants::ICON_UNIFIED_DIFF));
|
||||
actionToolTip = tr("Switch to Unified Diff Editor");
|
||||
m_diffEditorSwitcher->setIcon(currentView()->icon());
|
||||
m_diffEditorSwitcher->setToolTip(currentView()->toolTip());
|
||||
}
|
||||
|
||||
m_diffEditorSwitcher->setIcon(actionIcon);
|
||||
m_diffEditorSwitcher->setToolTip(actionToolTip);
|
||||
}
|
||||
|
||||
void DiffEditor::showDiffEditor(QWidget *newEditor)
|
||||
void DiffEditor::addView(IDiffView *view)
|
||||
{
|
||||
if (m_currentEditor == newEditor)
|
||||
QTC_ASSERT(!m_views.contains(view), return);
|
||||
m_views.append(view);
|
||||
m_stackedWidget->addWidget(view->widget());
|
||||
}
|
||||
|
||||
IDiffView *DiffEditor::currentView() const
|
||||
{
|
||||
if (m_currentViewIndex < 0)
|
||||
return 0;
|
||||
return m_views.at(m_currentViewIndex);
|
||||
}
|
||||
|
||||
void DiffEditor::setCurrentView(IDiffView *view)
|
||||
{
|
||||
const int pos = Utils::indexOf(m_views, [view](IDiffView *v) { return v == view; });
|
||||
QTC_ASSERT(pos >= 0 && pos < m_views.count(), return);
|
||||
m_currentViewIndex = pos;
|
||||
}
|
||||
|
||||
IDiffView *DiffEditor::nextView()
|
||||
{
|
||||
int pos = m_currentViewIndex + 1;
|
||||
if (pos >= m_views.count())
|
||||
pos = 0;
|
||||
|
||||
return m_views.at(pos);
|
||||
}
|
||||
|
||||
void DiffEditor::showDiffView(IDiffView *newView)
|
||||
{
|
||||
QTC_ASSERT(newView, return);
|
||||
|
||||
if (currentView() == newView)
|
||||
return;
|
||||
|
||||
if (m_currentEditor == m_sideBySideEditor)
|
||||
m_sideBySideEditor->setDiffEditorGuiController(0);
|
||||
else if (m_currentEditor == m_unifiedEditor)
|
||||
m_unifiedEditor->setDiffEditorGuiController(0);
|
||||
if (currentView()) // during initialization
|
||||
currentView()->setDiffEditorGuiController(0);
|
||||
setCurrentView(newView);
|
||||
currentView()->setDiffEditorGuiController(m_guiController);
|
||||
|
||||
m_currentEditor = newEditor;
|
||||
m_stackedWidget->setCurrentWidget(currentView()->widget());
|
||||
|
||||
if (m_currentEditor == m_unifiedEditor)
|
||||
m_unifiedEditor->setDiffEditorGuiController(m_guiController);
|
||||
else if (m_currentEditor == m_sideBySideEditor)
|
||||
m_sideBySideEditor->setDiffEditorGuiController(m_guiController);
|
||||
|
||||
m_stackedWidget->setCurrentWidget(m_currentEditor);
|
||||
|
||||
writeCurrentDiffEditorSetting(m_currentEditor);
|
||||
writeCurrentDiffEditorSetting(currentView());
|
||||
updateDiffEditorSwitcher();
|
||||
widget()->setFocusProxy(m_currentEditor);
|
||||
widget()->setFocusProxy(currentView()->widget());
|
||||
}
|
||||
|
||||
QWidget *DiffEditor::readLegacyCurrentDiffEditorSetting()
|
||||
// TODO: Remove in 3.6:
|
||||
IDiffView *DiffEditor::readLegacyCurrentDiffEditorSetting()
|
||||
{
|
||||
QTC_ASSERT(!m_views.isEmpty(), return 0);
|
||||
QTC_ASSERT(m_views.count() == 2, return m_views.at(0));
|
||||
|
||||
QSettings *s = Core::ICore::settings();
|
||||
|
||||
s->beginGroup(QLatin1String(legacySettingsGroupC));
|
||||
@@ -574,43 +572,35 @@ QWidget *DiffEditor::readLegacyCurrentDiffEditorSetting()
|
||||
s->remove(QLatin1String(useDiffEditorKeyC));
|
||||
s->endGroup();
|
||||
|
||||
QWidget *currentEditor = m_sideBySideEditor;
|
||||
IDiffView *currentEditor = m_views.at(0);
|
||||
if (!legacyEditor)
|
||||
currentEditor = m_unifiedEditor;
|
||||
currentEditor = m_views.at(1);
|
||||
|
||||
if (legacyExists && currentEditor == m_unifiedEditor)
|
||||
if (legacyExists)
|
||||
writeCurrentDiffEditorSetting(currentEditor);
|
||||
|
||||
return currentEditor;
|
||||
}
|
||||
|
||||
QWidget *DiffEditor::readCurrentDiffEditorSetting()
|
||||
IDiffView *DiffEditor::readCurrentDiffEditorSetting()
|
||||
{
|
||||
// replace it with m_sideBySideEditor when dropping legacy stuff
|
||||
QWidget *defaultEditor = readLegacyCurrentDiffEditorSetting();
|
||||
IDiffView *view = readLegacyCurrentDiffEditorSetting();
|
||||
|
||||
QSettings *s = Core::ICore::settings();
|
||||
s->beginGroup(QLatin1String(settingsGroupC));
|
||||
const QString editorString = s->value(
|
||||
QLatin1String(diffEditorTypeKeyC)).toString();
|
||||
const Core::Id id = Core::Id::fromSetting(s->value(QLatin1String(diffEditorTypeKeyC)));
|
||||
s->endGroup();
|
||||
if (editorString == QLatin1String(unifiedDiffEditorValueC))
|
||||
return m_unifiedEditor;
|
||||
|
||||
if (editorString == QLatin1String(sideBySideDiffEditorValueC))
|
||||
return m_sideBySideEditor;
|
||||
|
||||
return defaultEditor;
|
||||
return Utils::findOr(m_views, view, [id](IDiffView *v) { return v->id() == id; });
|
||||
}
|
||||
|
||||
void DiffEditor::writeCurrentDiffEditorSetting(QWidget *currentEditor)
|
||||
void DiffEditor::writeCurrentDiffEditorSetting(IDiffView *currentEditor)
|
||||
{
|
||||
const QString editorString = currentEditor == m_unifiedEditor
|
||||
? QLatin1String(unifiedDiffEditorValueC)
|
||||
: QLatin1String(sideBySideDiffEditorValueC);
|
||||
QTC_ASSERT(currentEditor, return);
|
||||
QSettings *s = Core::ICore::settings();
|
||||
s->beginGroup(QLatin1String(settingsGroupC));
|
||||
s->setValue(QLatin1String(diffEditorTypeKeyC), editorString);
|
||||
s->setValue(QLatin1String(diffEditorTypeKeyC), currentEditor->id().toSetting());
|
||||
s->endGroup();
|
||||
}
|
||||
|
||||
|
||||
@@ -51,8 +51,7 @@ namespace Internal {
|
||||
class DescriptionEditorWidget;
|
||||
class DiffEditorDocument;
|
||||
class DiffEditorGuiController;
|
||||
class UnifiedDiffEditorWidget;
|
||||
class SideBySideDiffEditorWidget;
|
||||
class IDiffView;
|
||||
|
||||
class DiffEditor : public Core::IEditor
|
||||
{
|
||||
@@ -85,22 +84,24 @@ private slots:
|
||||
void slotDescriptionChanged(const QString &description);
|
||||
void slotDescriptionVisibilityChanged();
|
||||
void slotReloaderChanged();
|
||||
void slotDiffEditorSwitched();
|
||||
|
||||
private:
|
||||
void updateEntryToolTip();
|
||||
void showDiffEditor(QWidget *newEditor);
|
||||
void showDiffView(IDiffView *newEditor);
|
||||
void updateDiffEditorSwitcher();
|
||||
QWidget *readLegacyCurrentDiffEditorSetting();
|
||||
QWidget *readCurrentDiffEditorSetting();
|
||||
void writeCurrentDiffEditorSetting(QWidget *currentEditor);
|
||||
void addView(IDiffView *view);
|
||||
IDiffView *currentView() const;
|
||||
void setCurrentView(IDiffView *view);
|
||||
IDiffView *nextView();
|
||||
IDiffView *readLegacyCurrentDiffEditorSetting();
|
||||
IDiffView *readCurrentDiffEditorSetting();
|
||||
void writeCurrentDiffEditorSetting(IDiffView *currentEditor);
|
||||
|
||||
QSharedPointer<DiffEditorDocument> m_document;
|
||||
DescriptionEditorWidget *m_descriptionWidget;
|
||||
QStackedWidget *m_stackedWidget;
|
||||
SideBySideDiffEditorWidget *m_sideBySideEditor;
|
||||
UnifiedDiffEditorWidget *m_unifiedEditor;
|
||||
QWidget *m_currentEditor;
|
||||
QVector<IDiffView *> m_views;
|
||||
int m_currentViewIndex;
|
||||
DiffEditorGuiController *m_guiController;
|
||||
QToolBar *m_toolBar;
|
||||
QComboBox *m_entriesComboBox;
|
||||
|
||||
@@ -13,6 +13,7 @@ HEADERS += diffeditor_global.h \
|
||||
diffeditorreloader.h \
|
||||
differ.h \
|
||||
diffutils.h \
|
||||
diffview.h \
|
||||
selectabletexteditorwidget.h \
|
||||
sidebysidediffeditorwidget.h \
|
||||
unifieddiffeditorwidget.h
|
||||
@@ -27,6 +28,7 @@ SOURCES += diffeditor.cpp \
|
||||
diffeditorreloader.cpp \
|
||||
differ.cpp \
|
||||
diffutils.cpp \
|
||||
diffview.cpp \
|
||||
selectabletexteditorwidget.cpp \
|
||||
sidebysidediffeditorwidget.cpp \
|
||||
unifieddiffeditorwidget.cpp
|
||||
|
||||
@@ -34,6 +34,8 @@ QtcPlugin {
|
||||
"differ.h",
|
||||
"diffutils.cpp",
|
||||
"diffutils.h",
|
||||
"diffview.cpp",
|
||||
"diffview.h",
|
||||
"selectabletexteditorwidget.cpp",
|
||||
"selectabletexteditorwidget.h",
|
||||
"sidebysidediffeditorwidget.cpp",
|
||||
|
||||
@@ -41,8 +41,6 @@ const char DIFF_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("DiffEditor", "Diff Ed
|
||||
const char DIFF_EDITOR_MIMETYPE[] = "text/x-patch";
|
||||
const char G_TOOLS_DIFF[] = "QtCreator.Group.Tools.Options";
|
||||
|
||||
const char ICON_SIDE_BY_SIDE_DIFF[] = ":/diffeditor/images/sidebysidediff.png";
|
||||
const char ICON_UNIFIED_DIFF[] = ":/diffeditor/images/unifieddiff.png";
|
||||
const char ICON_TOP_BAR[] = ":/diffeditor/images/topbar.png";
|
||||
|
||||
const char EXPAND_BRANCHES[] = "Branches: <Expand>";
|
||||
|
||||
113
src/plugins/diffeditor/diffview.cpp
Normal file
113
src/plugins/diffeditor/diffview.cpp
Normal file
@@ -0,0 +1,113 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://www.qt.io/licensing. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "diffview.h"
|
||||
|
||||
#include "unifieddiffeditorwidget.h"
|
||||
#include "sidebysidediffeditorwidget.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
namespace DiffEditor {
|
||||
namespace Internal {
|
||||
|
||||
QIcon IDiffView::icon() const
|
||||
{
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
QString IDiffView::toolTip() const
|
||||
{
|
||||
return m_toolTip;
|
||||
}
|
||||
|
||||
Core::Id IDiffView::id() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
void IDiffView::setIcon(const QIcon &icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
}
|
||||
|
||||
void IDiffView::setToolTip(const QString &toolTip)
|
||||
{
|
||||
m_toolTip = toolTip;
|
||||
}
|
||||
|
||||
void IDiffView::setId(const Core::Id &id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
UnifiedView::UnifiedView() : m_widget(0)
|
||||
{
|
||||
setId(UNIFIED_VIEW_ID);
|
||||
setIcon(QIcon(QLatin1String(":/diffeditor/images/unifieddiff.png")));
|
||||
setToolTip(QCoreApplication::translate("DiffEditor::UnifiedView", "Switch to Unified Diff Editor"));
|
||||
}
|
||||
|
||||
QWidget *UnifiedView::widget()
|
||||
{
|
||||
if (!m_widget)
|
||||
m_widget = new UnifiedDiffEditorWidget;
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void UnifiedView::setDiffEditorGuiController(DiffEditorGuiController *controller)
|
||||
{
|
||||
QTC_ASSERT(m_widget, return);
|
||||
m_widget->setDiffEditorGuiController(controller);
|
||||
}
|
||||
|
||||
SideBySideView::SideBySideView() : m_widget(0)
|
||||
{
|
||||
setId(SIDE_BY_SIDE_VIEW_ID);
|
||||
setIcon(QIcon(QLatin1String(":/diffeditor/images/sidebysidediff.png")));
|
||||
setToolTip(QCoreApplication::translate("DiffEditor::SideBySideView",
|
||||
"Switch to Side By Side Diff Editor"));
|
||||
}
|
||||
|
||||
QWidget *SideBySideView::widget()
|
||||
{
|
||||
if (!m_widget)
|
||||
m_widget = new SideBySideDiffEditorWidget;
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
void SideBySideView::setDiffEditorGuiController(DiffEditorGuiController *controller)
|
||||
{
|
||||
QTC_ASSERT(m_widget, return);
|
||||
m_widget->setDiffEditorGuiController(controller);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace DiffEditor
|
||||
99
src/plugins/diffeditor/diffview.h
Normal file
99
src/plugins/diffeditor/diffview.h
Normal file
@@ -0,0 +1,99 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
**
|
||||
** This file is part of Qt Creator.
|
||||
**
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://www.qt.io/licensing. For further information
|
||||
** use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef DIFFVIEW_H
|
||||
#define DIFFVIEW_H
|
||||
|
||||
#include <coreplugin/id.h>
|
||||
|
||||
#include <QIcon>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
namespace DiffEditor {
|
||||
namespace Internal {
|
||||
|
||||
class DiffEditorGuiController;
|
||||
class SideBySideDiffEditorWidget;
|
||||
class UnifiedDiffEditorWidget;
|
||||
|
||||
const char SIDE_BY_SIDE_VIEW_ID[] = "SideBySide";
|
||||
const char UNIFIED_VIEW_ID[] = "Unified";
|
||||
|
||||
class IDiffView
|
||||
{
|
||||
public:
|
||||
IDiffView() { }
|
||||
virtual ~IDiffView() { }
|
||||
|
||||
QIcon icon() const;
|
||||
QString toolTip() const;
|
||||
|
||||
Core::Id id() const;
|
||||
virtual QWidget *widget() = 0;
|
||||
virtual void setDiffEditorGuiController(DiffEditorGuiController *controller) = 0;
|
||||
|
||||
protected:
|
||||
void setIcon(const QIcon &icon);
|
||||
void setToolTip(const QString &toolTip);
|
||||
void setId(const Core::Id &id);
|
||||
|
||||
private:
|
||||
QIcon m_icon;
|
||||
QString m_toolTip;
|
||||
Core::Id m_id;
|
||||
};
|
||||
|
||||
class UnifiedView : public IDiffView {
|
||||
public:
|
||||
UnifiedView();
|
||||
|
||||
QWidget *widget();
|
||||
void setDiffEditorGuiController(DiffEditorGuiController *controller);
|
||||
|
||||
private:
|
||||
UnifiedDiffEditorWidget *m_widget;
|
||||
};
|
||||
|
||||
class SideBySideView : public IDiffView {
|
||||
public:
|
||||
SideBySideView();
|
||||
|
||||
QWidget *widget();
|
||||
void setDiffEditorGuiController(DiffEditorGuiController *controller);
|
||||
|
||||
private:
|
||||
SideBySideDiffEditorWidget *m_widget;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace DiffEditor
|
||||
|
||||
#endif // DIFFVIEW_H
|
||||
@@ -57,6 +57,7 @@
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <texteditor/displaysettings.h>
|
||||
#include <texteditor/textdocumentlayout.h>
|
||||
#include <texteditor/texteditor.h>
|
||||
#include <texteditor/textmark.h>
|
||||
@@ -126,9 +127,9 @@ public:
|
||||
, m_eventFilter(0)
|
||||
, m_lastMessageLevel(MessageMode)
|
||||
{
|
||||
connect(m_edit, SIGNAL(textEdited(QString)), SLOT(changed()));
|
||||
connect(m_edit, SIGNAL(cursorPositionChanged(int,int)), SLOT(changed()));
|
||||
connect(m_edit, SIGNAL(selectionChanged()), SLOT(changed()));
|
||||
connect(m_edit, &QLineEdit::textEdited, this, &MiniBuffer::changed);
|
||||
connect(m_edit, &QLineEdit::cursorPositionChanged, this, &MiniBuffer::changed);
|
||||
connect(m_edit, &QLineEdit::selectionChanged, this, &MiniBuffer::changed);
|
||||
m_label->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||
|
||||
addWidget(m_label);
|
||||
@@ -136,7 +137,7 @@ public:
|
||||
|
||||
m_hideTimer.setSingleShot(true);
|
||||
m_hideTimer.setInterval(8000);
|
||||
connect(&m_hideTimer, SIGNAL(timeout()), SLOT(hide()));
|
||||
connect(&m_hideTimer, &QTimer::timeout, this, &QWidget::hide);
|
||||
}
|
||||
|
||||
void setContents(const QString &contents, int cursorPos, int anchorPos,
|
||||
@@ -212,7 +213,7 @@ public:
|
||||
signals:
|
||||
void edited(const QString &text, int cursorPos, int anchorPos);
|
||||
|
||||
private slots:
|
||||
private:
|
||||
void changed()
|
||||
{
|
||||
const int cursorPos = m_edit->cursorPosition();
|
||||
@@ -222,7 +223,6 @@ private slots:
|
||||
emit edited(m_edit->text(), cursorPos, anchorPos);
|
||||
}
|
||||
|
||||
private:
|
||||
QLabel *m_label;
|
||||
QLineEdit *m_edit;
|
||||
QObject *m_eventFilter;
|
||||
@@ -245,12 +245,18 @@ public:
|
||||
|
||||
m_timerUpdate.setSingleShot(true);
|
||||
m_timerUpdate.setInterval(0);
|
||||
connect(&m_timerUpdate, SIGNAL(timeout()), SLOT(followEditorLayout()));
|
||||
updateOnSignal(m_editor, SIGNAL(cursorPositionChanged()));
|
||||
updateOnSignal(m_editor->verticalScrollBar(), SIGNAL(valueChanged(int)));
|
||||
updateOnSignal(m_editor->document(), SIGNAL(contentsChanged()));
|
||||
updateOnSignal(TextEditorSettings::instance(),
|
||||
SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)));
|
||||
connect(&m_timerUpdate, &QTimer::timeout,
|
||||
this, &RelativeNumbersColumn::followEditorLayout);
|
||||
|
||||
auto start = static_cast<void(QTimer::*)()>(&QTimer::start);
|
||||
connect(m_editor, &QPlainTextEdit::cursorPositionChanged,
|
||||
&m_timerUpdate, start);
|
||||
connect(m_editor->verticalScrollBar(), &QAbstractSlider::valueChanged,
|
||||
&m_timerUpdate, start);
|
||||
connect(m_editor->document(), &QTextDocument::contentsChanged,
|
||||
&m_timerUpdate, start);
|
||||
connect(TextEditorSettings::instance(), &TextEditorSettings::displaySettingsChanged,
|
||||
&m_timerUpdate, start);
|
||||
|
||||
m_editor->installEventFilter(this);
|
||||
|
||||
@@ -339,11 +345,6 @@ private slots:
|
||||
update();
|
||||
}
|
||||
|
||||
void updateOnSignal(QObject *object, const char *signal)
|
||||
{
|
||||
connect(object, signal, &m_timerUpdate, SLOT(start()));
|
||||
}
|
||||
|
||||
private:
|
||||
int m_currentPos;
|
||||
int m_lineSpacing;
|
||||
@@ -458,14 +459,14 @@ QWidget *FakeVimOptionPage::widget()
|
||||
m_group.insert(theFakeVimSetting(ConfigRelativeNumber),
|
||||
m_ui.checkBoxRelativeNumber);
|
||||
|
||||
connect(m_ui.pushButtonCopyTextEditorSettings, SIGNAL(clicked()),
|
||||
SLOT(copyTextEditorSettings()));
|
||||
connect(m_ui.pushButtonSetQtStyle, SIGNAL(clicked()),
|
||||
SLOT(setQtStyle()));
|
||||
connect(m_ui.pushButtonSetPlainStyle, SIGNAL(clicked()),
|
||||
SLOT(setPlainStyle()));
|
||||
connect(m_ui.checkBoxReadVimRc, SIGNAL(stateChanged(int)),
|
||||
SLOT(updateVimRcWidgets()));
|
||||
connect(m_ui.pushButtonCopyTextEditorSettings, &QAbstractButton::clicked,
|
||||
this, &FakeVimOptionPage::copyTextEditorSettings);
|
||||
connect(m_ui.pushButtonSetQtStyle, &QAbstractButton::clicked,
|
||||
this, &FakeVimOptionPage::setQtStyle);
|
||||
connect(m_ui.pushButtonSetPlainStyle, &QAbstractButton::clicked,
|
||||
this, &FakeVimOptionPage::setPlainStyle);
|
||||
connect(m_ui.checkBoxReadVimRc, &QCheckBox::stateChanged,
|
||||
this, &FakeVimOptionPage::updateVimRcWidgets);
|
||||
updateVimRcWidgets();
|
||||
|
||||
}
|
||||
@@ -1015,7 +1016,6 @@ private slots:
|
||||
void fold(int depth, bool fold);
|
||||
void foldGoTo(int count, bool current);
|
||||
void jumpToGlobalMark(QChar mark, bool backTickMode, const QString &fileName);
|
||||
void showSettingsDialog();
|
||||
void maybeReadVimRc();
|
||||
void disableBlockSelection();
|
||||
void setBlockSelection(const QTextCursor&);
|
||||
@@ -1039,7 +1039,7 @@ private slots:
|
||||
|
||||
void handleDelayedQuitAll(bool forced);
|
||||
void handleDelayedQuit(bool forced, Core::IEditor *editor);
|
||||
void userActionTriggered();
|
||||
void userActionTriggered(int key);
|
||||
|
||||
void switchToFile(int n);
|
||||
int currentFile() const;
|
||||
@@ -1157,8 +1157,8 @@ FakeVimPluginPrivate::~FakeVimPluginPrivate()
|
||||
void FakeVimPluginPrivate::onCoreAboutToClose()
|
||||
{
|
||||
// Don't attach to editors anymore.
|
||||
disconnect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
this, SLOT(editorOpened(Core::IEditor*)));
|
||||
disconnect(EditorManager::instance(), &EditorManager::editorOpened,
|
||||
this, &FakeVimPluginPrivate::editorOpened);
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::aboutToShutdown()
|
||||
@@ -1205,41 +1205,41 @@ bool FakeVimPluginPrivate::initialize()
|
||||
|
||||
const Id base = "FakeVim.UserAction";
|
||||
for (int i = 1; i < 10; ++i) {
|
||||
QAction *act = new QAction(this);
|
||||
auto act = new QAction(this);
|
||||
act->setText(Tr::tr("Execute User Action #%1").arg(i));
|
||||
act->setData(i);
|
||||
cmd = ActionManager::registerAction(act, base.withSuffix(i), globalcontext);
|
||||
cmd->setDefaultKeySequence(QKeySequence((UseMacShortcuts ? Tr::tr("Meta+V,%1") : Tr::tr("Alt+V,%1")).arg(i)));
|
||||
connect(act, SIGNAL(triggered()), SLOT(userActionTriggered()));
|
||||
connect(act, &QAction::triggered, this, [this, i] { userActionTriggered(i); });
|
||||
}
|
||||
|
||||
connect(ICore::instance(), SIGNAL(coreAboutToClose()), this, SLOT(onCoreAboutToClose()));
|
||||
connect(ICore::instance(), &ICore::coreAboutToClose,
|
||||
this, &FakeVimPluginPrivate::onCoreAboutToClose);
|
||||
|
||||
// EditorManager
|
||||
connect(EditorManager::instance(), SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
this, SLOT(editorAboutToClose(Core::IEditor*)));
|
||||
connect(EditorManager::instance(), SIGNAL(editorOpened(Core::IEditor*)),
|
||||
this, SLOT(editorOpened(Core::IEditor*)));
|
||||
connect(EditorManager::instance(), &EditorManager::editorAboutToClose,
|
||||
this, &FakeVimPluginPrivate::editorAboutToClose);
|
||||
connect(EditorManager::instance(), &EditorManager::editorOpened,
|
||||
this, &FakeVimPluginPrivate::editorOpened);
|
||||
|
||||
connect(DocumentManager::instance(), SIGNAL(allDocumentsRenamed(QString,QString)),
|
||||
this, SLOT(allDocumentsRenamed(QString,QString)));
|
||||
connect(DocumentManager::instance(), SIGNAL(documentRenamed(Core::IDocument*,QString,QString)),
|
||||
this, SLOT(documentRenamed(Core::IDocument*,QString,QString)));
|
||||
connect(DocumentManager::instance(), &DocumentManager::allDocumentsRenamed,
|
||||
this, &FakeVimPluginPrivate::allDocumentsRenamed);
|
||||
connect(DocumentManager::instance(), &DocumentManager::documentRenamed,
|
||||
this, &FakeVimPluginPrivate::documentRenamed);
|
||||
|
||||
connect(theFakeVimSetting(ConfigUseFakeVim), SIGNAL(valueChanged(QVariant)),
|
||||
this, SLOT(setUseFakeVim(QVariant)));
|
||||
connect(theFakeVimSetting(ConfigReadVimRc), SIGNAL(valueChanged(QVariant)),
|
||||
this, SLOT(maybeReadVimRc()));
|
||||
connect(theFakeVimSetting(ConfigVimRcPath), SIGNAL(valueChanged(QVariant)),
|
||||
this, SLOT(maybeReadVimRc()));
|
||||
connect(theFakeVimSetting(ConfigRelativeNumber), SIGNAL(valueChanged(QVariant)),
|
||||
this, SLOT(setShowRelativeLineNumbers(QVariant)));
|
||||
connect(theFakeVimSetting(ConfigUseFakeVim), &Utils::SavedAction::valueChanged,
|
||||
this, &FakeVimPluginPrivate::setUseFakeVim);
|
||||
connect(theFakeVimSetting(ConfigReadVimRc), &Utils::SavedAction::valueChanged,
|
||||
this, &FakeVimPluginPrivate::maybeReadVimRc);
|
||||
connect(theFakeVimSetting(ConfigVimRcPath), &Utils::SavedAction::valueChanged,
|
||||
this, &FakeVimPluginPrivate::maybeReadVimRc);
|
||||
connect(theFakeVimSetting(ConfigRelativeNumber), &Utils::SavedAction::valueChanged,
|
||||
this, &FakeVimPluginPrivate::setShowRelativeLineNumbers);
|
||||
|
||||
// Delayed operations.
|
||||
connect(this, SIGNAL(delayedQuitRequested(bool,Core::IEditor*)),
|
||||
this, SLOT(handleDelayedQuit(bool,Core::IEditor*)), Qt::QueuedConnection);
|
||||
connect(this, SIGNAL(delayedQuitAllRequested(bool)),
|
||||
this, SLOT(handleDelayedQuitAll(bool)), Qt::QueuedConnection);
|
||||
connect(this, &FakeVimPluginPrivate::delayedQuitRequested,
|
||||
this, &FakeVimPluginPrivate::handleDelayedQuit, Qt::QueuedConnection);
|
||||
connect(this, &FakeVimPluginPrivate::delayedQuitAllRequested,
|
||||
this, &FakeVimPluginPrivate::handleDelayedQuitAll, Qt::QueuedConnection);
|
||||
|
||||
// Vimrc can break test so don't source it if running tests.
|
||||
if (!ExtensionSystem::PluginManager::testRunRequested())
|
||||
@@ -1249,14 +1249,8 @@ bool FakeVimPluginPrivate::initialize()
|
||||
return true;
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::userActionTriggered()
|
||||
void FakeVimPluginPrivate::userActionTriggered(int key)
|
||||
{
|
||||
QAction *act = qobject_cast<QAction *>(sender());
|
||||
if (!act)
|
||||
return;
|
||||
const int key = act->data().toInt();
|
||||
if (!key)
|
||||
return;
|
||||
IEditor *editor = EditorManager::currentEditor();
|
||||
FakeVimHandler *handler = m_editorToHandler[editor];
|
||||
if (handler) {
|
||||
@@ -1277,10 +1271,10 @@ void FakeVimPluginPrivate::createRelativeNumberWidget(IEditor *editor)
|
||||
{
|
||||
if (TextEditorWidget *textEditor = qobject_cast<TextEditorWidget *>(editor->widget())) {
|
||||
RelativeNumbersColumn *relativeNumbers = new RelativeNumbersColumn(textEditor);
|
||||
connect(theFakeVimSetting(ConfigRelativeNumber), SIGNAL(valueChanged(QVariant)),
|
||||
relativeNumbers, SLOT(deleteLater()));
|
||||
connect(theFakeVimSetting(ConfigUseFakeVim), SIGNAL(valueChanged(QVariant)),
|
||||
relativeNumbers, SLOT(deleteLater()));
|
||||
connect(theFakeVimSetting(ConfigRelativeNumber), &Utils::SavedAction::valueChanged,
|
||||
relativeNumbers, &QObject::deleteLater);
|
||||
connect(theFakeVimSetting(ConfigUseFakeVim), &Utils::SavedAction::valueChanged,
|
||||
relativeNumbers, &QObject::deleteLater);
|
||||
relativeNumbers->show();
|
||||
}
|
||||
}
|
||||
@@ -1387,11 +1381,6 @@ void FakeVimPluginPrivate::maybeReadVimRc()
|
||||
//qDebug() << theFakeVimSetting(ConfigShiftWidth)->value();
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::showSettingsDialog()
|
||||
{
|
||||
ICore::showOptionsDialog(SETTINGS_CATEGORY, SETTINGS_ID);
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::triggerAction(Id id)
|
||||
{
|
||||
Command *cmd = ActionManager::command(id);
|
||||
@@ -1761,54 +1750,54 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
|
||||
new DeferredDeleter(widget, handler);
|
||||
m_editorToHandler[editor] = handler;
|
||||
|
||||
connect(handler, SIGNAL(extraInformationChanged(QString)),
|
||||
SLOT(showExtraInformation(QString)));
|
||||
connect(handler, SIGNAL(commandBufferChanged(QString,int,int,int,QObject*)),
|
||||
SLOT(showCommandBuffer(QString,int,int,int,QObject*)));
|
||||
connect(handler, SIGNAL(selectionChanged(QList<QTextEdit::ExtraSelection>)),
|
||||
SLOT(changeSelection(QList<QTextEdit::ExtraSelection>)));
|
||||
connect(handler, SIGNAL(highlightMatches(QString)),
|
||||
SLOT(highlightMatches(QString)));
|
||||
connect(handler, SIGNAL(moveToMatchingParenthesis(bool*,bool*,QTextCursor*)),
|
||||
SLOT(moveToMatchingParenthesis(bool*,bool*,QTextCursor*)), Qt::DirectConnection);
|
||||
connect(handler, SIGNAL(indentRegion(int,int,QChar)),
|
||||
SLOT(indentRegion(int,int,QChar)));
|
||||
connect(handler, SIGNAL(checkForElectricCharacter(bool*,QChar)),
|
||||
SLOT(checkForElectricCharacter(bool*,QChar)), Qt::DirectConnection);
|
||||
connect(handler, SIGNAL(requestDisableBlockSelection()),
|
||||
SLOT(disableBlockSelection()));
|
||||
connect(handler, SIGNAL(requestSetBlockSelection(QTextCursor)),
|
||||
SLOT(setBlockSelection(QTextCursor)));
|
||||
connect(handler, SIGNAL(requestBlockSelection(QTextCursor*)),
|
||||
SLOT(blockSelection(QTextCursor*)), Qt::DirectConnection);
|
||||
connect(handler, SIGNAL(requestHasBlockSelection(bool*)),
|
||||
SLOT(hasBlockSelection(bool*)), Qt::DirectConnection);
|
||||
connect(handler, SIGNAL(completionRequested()),
|
||||
SLOT(triggerCompletions()));
|
||||
connect(handler, SIGNAL(simpleCompletionRequested(QString,bool)),
|
||||
SLOT(triggerSimpleCompletions(QString,bool)));
|
||||
connect(handler, SIGNAL(windowCommandRequested(QString,int)),
|
||||
SLOT(windowCommand(QString,int)));
|
||||
connect(handler, SIGNAL(findRequested(bool)),
|
||||
SLOT(find(bool)));
|
||||
connect(handler, SIGNAL(findNextRequested(bool)),
|
||||
SLOT(findNext(bool)));
|
||||
connect(handler, SIGNAL(foldToggle(int)),
|
||||
SLOT(foldToggle(int)));
|
||||
connect(handler, SIGNAL(foldAll(bool)),
|
||||
SLOT(foldAll(bool)));
|
||||
connect(handler, SIGNAL(fold(int,bool)),
|
||||
SLOT(fold(int,bool)));
|
||||
connect(handler, SIGNAL(foldGoTo(int,bool)),
|
||||
SLOT(foldGoTo(int,bool)));
|
||||
connect(handler, SIGNAL(jumpToGlobalMark(QChar,bool,QString)),
|
||||
SLOT(jumpToGlobalMark(QChar,bool,QString)));
|
||||
connect(handler, &FakeVimHandler::extraInformationChanged,
|
||||
this, &FakeVimPluginPrivate::showExtraInformation);
|
||||
connect(handler, &FakeVimHandler::commandBufferChanged,
|
||||
this, &FakeVimPluginPrivate::showCommandBuffer);
|
||||
connect(handler, &FakeVimHandler::selectionChanged,
|
||||
this, &FakeVimPluginPrivate::changeSelection);
|
||||
connect(handler, &FakeVimHandler::highlightMatches,
|
||||
this, &FakeVimPluginPrivate::highlightMatches);
|
||||
connect(handler, &FakeVimHandler::moveToMatchingParenthesis,
|
||||
this, &FakeVimPluginPrivate::moveToMatchingParenthesis, Qt::DirectConnection);
|
||||
connect(handler, &FakeVimHandler::indentRegion,
|
||||
this, &FakeVimPluginPrivate::indentRegion);
|
||||
connect(handler, &FakeVimHandler::checkForElectricCharacter,
|
||||
this, &FakeVimPluginPrivate::checkForElectricCharacter, Qt::DirectConnection);
|
||||
connect(handler, &FakeVimHandler::requestDisableBlockSelection,
|
||||
this, &FakeVimPluginPrivate::disableBlockSelection);
|
||||
connect(handler, &FakeVimHandler::requestSetBlockSelection,
|
||||
this, &FakeVimPluginPrivate::setBlockSelection);
|
||||
connect(handler, &FakeVimHandler::requestBlockSelection,
|
||||
this, &FakeVimPluginPrivate::blockSelection, Qt::DirectConnection);
|
||||
connect(handler, &FakeVimHandler::requestHasBlockSelection,
|
||||
this, &FakeVimPluginPrivate::hasBlockSelection, Qt::DirectConnection);
|
||||
connect(handler, &FakeVimHandler::completionRequested,
|
||||
this, &FakeVimPluginPrivate::triggerCompletions);
|
||||
connect(handler, &FakeVimHandler::simpleCompletionRequested,
|
||||
this, &FakeVimPluginPrivate::triggerSimpleCompletions);
|
||||
connect(handler, &FakeVimHandler::windowCommandRequested,
|
||||
this, &FakeVimPluginPrivate::windowCommand);
|
||||
connect(handler, &FakeVimHandler::findRequested,
|
||||
this, &FakeVimPluginPrivate::find);
|
||||
connect(handler, &FakeVimHandler::findNextRequested,
|
||||
this, &FakeVimPluginPrivate::findNext);
|
||||
connect(handler, &FakeVimHandler::foldToggle,
|
||||
this, &FakeVimPluginPrivate::foldToggle);
|
||||
connect(handler, &FakeVimHandler::foldAll,
|
||||
this, &FakeVimPluginPrivate::foldAll);
|
||||
connect(handler, &FakeVimHandler::fold,
|
||||
this, &FakeVimPluginPrivate::fold);
|
||||
connect(handler, &FakeVimHandler::foldGoTo,
|
||||
this, &FakeVimPluginPrivate::foldGoTo);
|
||||
connect(handler, &FakeVimHandler::jumpToGlobalMark,
|
||||
this, &FakeVimPluginPrivate::jumpToGlobalMark);
|
||||
|
||||
connect(handler, SIGNAL(handleExCommandRequested(bool*,ExCommand)),
|
||||
SLOT(handleExCommand(bool*,ExCommand)), Qt::DirectConnection);
|
||||
connect(handler, &FakeVimHandler::handleExCommandRequested,
|
||||
this, &FakeVimPluginPrivate::handleExCommand, Qt::DirectConnection);
|
||||
|
||||
connect(ICore::instance(), SIGNAL(saveSettingsRequested()),
|
||||
SLOT(writeSettings()));
|
||||
connect(ICore::instance(), &ICore::saveSettingsRequested,
|
||||
this, &FakeVimPluginPrivate::writeSettings);
|
||||
|
||||
handler->setCurrentFileName(editor->document()->filePath().toString());
|
||||
handler->installEventFilter();
|
||||
@@ -2012,7 +2001,7 @@ void FakeVimPluginPrivate::handleExCommand(bool *handled, const ExCommand &cmd)
|
||||
} else if (cmd.matches(_("se"), _("set"))) {
|
||||
if (cmd.args.isEmpty()) {
|
||||
// :se[t]
|
||||
showSettingsDialog();
|
||||
ICore::showOptionsDialog(SETTINGS_ID);
|
||||
} else if (cmd.args == _("ic") || cmd.args == _("ignorecase")) {
|
||||
// :set nc
|
||||
setActionChecked(Core::Constants::CASE_SENSITIVE, false);
|
||||
|
||||
@@ -374,8 +374,7 @@ void GerritPlugin::openView()
|
||||
while (!m_parameters->isValid()) {
|
||||
Core::AsynchronousMessageBox::warning(tr("Error"),
|
||||
tr("Invalid Gerrit configuration. Host, user and ssh binary are mandatory."));
|
||||
const Id group = VcsBase::Constants::VCS_SETTINGS_CATEGORY;
|
||||
if (!ICore::showOptionsDialog(group, "Gerrit"))
|
||||
if (!ICore::showOptionsDialog("Gerrit"))
|
||||
return;
|
||||
}
|
||||
GerritDialog *gd = new GerritDialog(m_parameters, ICore::mainWindow());
|
||||
|
||||
@@ -48,10 +48,13 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<height>6</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
|
||||
@@ -276,7 +276,7 @@ QString GitSubmitEditor::amendSHA1() const
|
||||
|
||||
QByteArray GitSubmitEditor::fileContents() const
|
||||
{
|
||||
const QString &text = submitEditorWidget()->descriptionText();
|
||||
const QString &text = description();
|
||||
|
||||
// Do the encoding convert, When use user-defined encoding
|
||||
// e.g. git config --global i18n.commitencoding utf-8
|
||||
|
||||
@@ -139,6 +139,9 @@
|
||||
<string>Gitk</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="gitkOptionsLabel">
|
||||
<property name="text">
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
<string>Configuration</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="mercurialCommandLabel">
|
||||
<property name="text">
|
||||
@@ -39,6 +42,9 @@
|
||||
<string>User</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="defaultUsernameLabel">
|
||||
<property name="toolTip">
|
||||
|
||||
@@ -42,9 +42,8 @@
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
|
||||
ConfigTaskHandler::ConfigTaskHandler(const Task &pattern, Core::Id group, Core::Id page) :
|
||||
ConfigTaskHandler::ConfigTaskHandler(const Task &pattern, Core::Id page) :
|
||||
m_pattern(pattern),
|
||||
m_targetGroup(group),
|
||||
m_targetPage(page)
|
||||
{ }
|
||||
|
||||
@@ -57,7 +56,7 @@ bool ConfigTaskHandler::canHandle(const Task &task) const
|
||||
void ConfigTaskHandler::handle(const Task &task)
|
||||
{
|
||||
Q_UNUSED(task);
|
||||
Core::ICore::showOptionsDialog(m_targetGroup, m_targetPage);
|
||||
Core::ICore::showOptionsDialog(m_targetPage);
|
||||
}
|
||||
|
||||
QAction *ConfigTaskHandler::createAction(QObject *parent) const
|
||||
|
||||
@@ -43,7 +43,7 @@ class ConfigTaskHandler : public ITaskHandler
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConfigTaskHandler(const Task &pattern, Core::Id group, Core::Id page);
|
||||
ConfigTaskHandler(const Task &pattern, Core::Id page);
|
||||
|
||||
bool canHandle(const Task &task) const;
|
||||
void handle(const Task &task);
|
||||
@@ -51,8 +51,6 @@ public:
|
||||
|
||||
private:
|
||||
const Task m_pattern;
|
||||
|
||||
const Core::Id m_targetGroup;
|
||||
const Core::Id m_targetPage;
|
||||
};
|
||||
|
||||
|
||||
@@ -72,6 +72,9 @@
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="deviceNameLabel">
|
||||
<property name="text">
|
||||
|
||||
@@ -49,6 +49,7 @@ class JsonWizardFactory;
|
||||
class JsonWizardPageFactory;
|
||||
class JsonWizardGeneratorFactory;
|
||||
class ProjectExplorerPlugin;
|
||||
class ProjectExplorerPluginPrivate;
|
||||
|
||||
// Documentation inside.
|
||||
class PROJECTEXPLORER_EXPORT JsonWizardFactory : public Core::IWizardFactory
|
||||
@@ -116,6 +117,7 @@ private:
|
||||
static int m_verbose;
|
||||
|
||||
friend class ProjectExplorerPlugin;
|
||||
friend class ProjectExplorerPluginPrivate;
|
||||
};
|
||||
|
||||
} //namespace ProjectExplorer
|
||||
|
||||
@@ -181,6 +181,10 @@ Utils::WizardPage *ProjectPageFactory::create(JsonWizard *wizard, Core::Id typeI
|
||||
|
||||
JsonProjectPage *page = new JsonProjectPage;
|
||||
|
||||
QVariantMap tmp = data.toMap();
|
||||
QString description = tmp.value(QLatin1String("trDescription")).toString();
|
||||
page->setDescription(description);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -189,9 +193,9 @@ bool ProjectPageFactory::validateData(Core::Id typeId, const QVariant &data, QSt
|
||||
Q_UNUSED(errorMessage);
|
||||
|
||||
QTC_ASSERT(canCreate(typeId), return false);
|
||||
if (!data.isNull() && (data.type() != QVariant::Map || !data.toMap().isEmpty())) {
|
||||
if (data.isNull() || data.type() != QVariant::Map) {
|
||||
*errorMessage = QCoreApplication::translate("ProjectExplorer::JsonWizard",
|
||||
"\"data\" for a \"Project\" page needs to be unset or an empty object.");
|
||||
"\"data\" must be a JSON object for \"Project\" pages.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,8 +67,7 @@ KitChooser::KitChooser(QWidget *parent) :
|
||||
|
||||
void KitChooser::onManageButtonClicked()
|
||||
{
|
||||
Core::ICore::showOptionsDialog(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
|
||||
Constants::KITS_SETTINGS_PAGE_ID, this);
|
||||
Core::ICore::showOptionsDialog(Constants::KITS_SETTINGS_PAGE_ID, this);
|
||||
}
|
||||
|
||||
void KitChooser::onCurrentIndexChanged(int index)
|
||||
|
||||
@@ -215,9 +215,7 @@ void ToolChainInformationConfigWidget::toolChainUpdated(ToolChain *tc)
|
||||
|
||||
void ToolChainInformationConfigWidget::manageToolChains()
|
||||
{
|
||||
ICore::showOptionsDialog(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
|
||||
Constants::TOOLCHAIN_SETTINGS_PAGE_ID,
|
||||
buttonWidget());
|
||||
ICore::showOptionsDialog(Constants::TOOLCHAIN_SETTINGS_PAGE_ID, buttonWidget());
|
||||
}
|
||||
|
||||
void ToolChainInformationConfigWidget::currentToolChainChanged(int idx)
|
||||
@@ -379,9 +377,7 @@ QWidget *DeviceInformationConfigWidget::buttonWidget() const
|
||||
|
||||
void DeviceInformationConfigWidget::manageDevices()
|
||||
{
|
||||
ICore::showOptionsDialog(Constants::DEVICE_SETTINGS_CATEGORY,
|
||||
Constants::DEVICE_SETTINGS_PAGE_ID,
|
||||
buttonWidget());
|
||||
ICore::showOptionsDialog(Constants::DEVICE_SETTINGS_PAGE_ID, buttonWidget());
|
||||
}
|
||||
|
||||
void DeviceInformationConfigWidget::modelAboutToReset()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -99,6 +99,7 @@ public:
|
||||
|
||||
static bool canRun(Project *pro, RunMode runMode, QString *whyNot = 0);
|
||||
static void runProject(Project *pro, RunMode, const bool forceSkipDeploy = false);
|
||||
static void runStartupProject(RunMode runMode, bool forceSkipDeploy = false);
|
||||
static void runRunConfiguration(RunConfiguration *rc, RunMode runMode,
|
||||
const bool forceSkipDeploy = false);
|
||||
|
||||
@@ -138,83 +139,7 @@ public slots:
|
||||
static void openOpenProjectDialog();
|
||||
|
||||
private slots:
|
||||
void buildStateChanged(ProjectExplorer::Project * pro);
|
||||
void buildQueueFinished(bool success);
|
||||
void buildProjectOnly();
|
||||
void buildProject();
|
||||
void buildProjectContextMenu();
|
||||
void buildSession();
|
||||
void rebuildProjectOnly();
|
||||
void rebuildProject();
|
||||
void rebuildProjectContextMenu();
|
||||
void rebuildSession();
|
||||
void deployProjectOnly();
|
||||
void deployProject();
|
||||
void deployProjectContextMenu();
|
||||
void deploySession();
|
||||
void cleanProjectOnly();
|
||||
void cleanProject();
|
||||
void cleanProjectContextMenu();
|
||||
void cleanSession();
|
||||
void cancelBuild();
|
||||
void loadAction();
|
||||
void unloadProject();
|
||||
void unloadProjectContextMenu();
|
||||
void closeAllProjects();
|
||||
void newProject();
|
||||
void showSessionManager();
|
||||
void updateSessionMenu();
|
||||
void setSession(QAction *action);
|
||||
|
||||
void determineSessionToRestoreAtStartup();
|
||||
void restoreSession();
|
||||
void restoreSession2();
|
||||
void loadSession(const QString &session);
|
||||
void runProject();
|
||||
void runProjectWithoutDeploy();
|
||||
void runProjectContextMenu();
|
||||
void savePersistentSettings();
|
||||
|
||||
void addNewFile();
|
||||
void addExistingFiles();
|
||||
void addExistingDirectory();
|
||||
void addNewSubproject();
|
||||
void removeProject();
|
||||
void openFile();
|
||||
void searchOnFileSystem();
|
||||
void showInGraphicalShell();
|
||||
void removeFile();
|
||||
void deleteFile();
|
||||
void renameFile();
|
||||
void setStartupProject();
|
||||
void setStartupProject(ProjectExplorer::Project *project);
|
||||
|
||||
void updateRecentProjectMenu();
|
||||
void clearRecentProjects();
|
||||
void openRecentProject();
|
||||
void updateUnloadProjectMenu();
|
||||
void openTerminalHere();
|
||||
|
||||
void invalidateProject(ProjectExplorer::Project *project);
|
||||
|
||||
void runControlFinished();
|
||||
|
||||
void projectAdded(ProjectExplorer::Project *pro);
|
||||
void projectRemoved(ProjectExplorer::Project *pro);
|
||||
void projectDisplayNameChanged(ProjectExplorer::Project *pro);
|
||||
void startupProjectChanged(); // Calls updateRunAction
|
||||
void activeTargetChanged();
|
||||
void activeRunConfigurationChanged();
|
||||
|
||||
void slotUpdateRunActions();
|
||||
|
||||
void currentModeChanged(Core::IMode *mode, Core::IMode *oldMode);
|
||||
void loadCustomWizards();
|
||||
|
||||
void updateWelcomePage();
|
||||
|
||||
void updateActions();
|
||||
void runConfigurationConfigurationFinished();
|
||||
void showRenameFileError();
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
|
||||
@@ -173,7 +173,7 @@ const char CPP_SOURCE_MIMETYPE[] = "text/x-c++src";
|
||||
const char CPP_HEADER_MIMETYPE[] = "text/x-c++hdr";
|
||||
const char LINGUIST_MIMETYPE[] = "text/vnd.trolltech.linguist";
|
||||
const char FORM_MIMETYPE[] = "application/x-designer";
|
||||
const char QML_MIMETYPE[] = "application/x-qml"; // separate def also in qmljstoolsconstants.h
|
||||
const char QML_MIMETYPE[] = "text/x-qml"; // separate def also in qmljstoolsconstants.h
|
||||
const char RESOURCE_MIMETYPE[] = "application/vnd.qt.xml.resource";
|
||||
|
||||
// Settings page
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user