Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
5f17e0b2
Commit
5f17e0b2
authored
Dec 04, 2008
by
hjk
Browse files
Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta
parents
6e2b0661
86b01665
Changes
26
Hide whitespace changes
Inline
Side-by-side
shared/cplusplus/Scope.cpp
View file @
5f17e0b2
...
...
@@ -292,6 +292,7 @@ Use *Scope::useAt(unsigned index) const
void
Scope
::
addUse
(
unsigned
sourceOffset
,
Name
*
name
)
{
#ifdef CPLUSPLUS_WITH_USES
if
(
++
_useCount
==
_allocatedUses
)
{
_allocatedUses
+=
4
;
_uses
=
reinterpret_cast
<
Use
*>
(
realloc
(
_uses
,
_allocatedUses
*
sizeof
(
Use
)));
...
...
@@ -303,6 +304,7 @@ void Scope::addUse(unsigned sourceOffset, Name *name)
else
lastVisibleSymbol
=
_symbols
[
_symbolCount
];
_uses
[
_useCount
].
init
(
sourceOffset
,
name
,
lastVisibleSymbol
);
#endif
}
CPLUSPLUS_END_NAMESPACE
shared/help/help.pri
View file @
5f17e0b2
...
...
@@ -9,7 +9,8 @@ HEADERS += \
$$PWD/helpviewer.h \
$$PWD/contentwindow.h \
$$PWD/bookmarkmanager.h \
$$PWD/../namespace_global.h
$$PWD/../namespace_global.h \
$$PWD/indexwindow.h
SOURCES += \
$$PWD/filternamedialog.cpp \
...
...
@@ -19,7 +20,7 @@ SOURCES += \
$$PWD/contentwindow.cpp \
$$PWD/bookmarkmanager.cpp
FORMS
+= \
FORMS
+= \
$$PWD/filternamedialog.ui \
$$PWD/topicchooser.ui \
$$PWD/bookmarkdialog.ui
src/libs/cplusplus/CppDocument.cpp
View file @
5f17e0b2
...
...
@@ -153,6 +153,11 @@ void Document::appendMacro(const QByteArray ¯oName, const QByteArray &text)
_definedMacros
+=
text
;
}
void
Document
::
addMacroUse
(
unsigned
offset
,
unsigned
length
)
{
_macroUses
.
append
(
Block
(
offset
,
offset
+
length
));
}
TranslationUnit
*
Document
::
translationUnit
()
const
{
return
_translationUnit
;
...
...
src/libs/cplusplus/CppDocument.h
View file @
5f17e0b2
...
...
@@ -68,6 +68,8 @@ public:
void
appendMacro
(
const
QByteArray
&
macroName
,
const
QByteArray
&
text
);
void
addMacroUse
(
unsigned
offset
,
unsigned
length
);
Control
*
control
()
const
;
TranslationUnit
*
translationUnit
()
const
;
...
...
@@ -176,6 +178,9 @@ public:
QList
<
Block
>
skippedBlocks
()
const
{
return
_skippedBlocks
;
}
QList
<
Block
>
macroUses
()
const
{
return
_macroUses
;
}
private:
Symbol
*
findSymbolAt
(
unsigned
line
,
unsigned
column
,
Scope
*
scope
)
const
;
...
...
@@ -189,6 +194,7 @@ private:
QByteArray
_definedMacros
;
QSet
<
QByteArray
>
_macroNames
;
QList
<
Block
>
_skippedBlocks
;
QList
<
Block
>
_macroUses
;
};
}
// end of namespace CPlusPlus
...
...
src/libs/cplusplus/ResolveExpression.cpp
View file @
5f17e0b2
...
...
@@ -235,9 +235,9 @@ bool ResolveExpression::visit(ExpressionListAST *)
return
false
;
}
bool
ResolveExpression
::
visit
(
BinaryExpressionAST
*
)
bool
ResolveExpression
::
visit
(
BinaryExpressionAST
*
ast
)
{
// nothing to do.
accept
(
ast
->
left_expression
);
return
false
;
}
...
...
src/plugins/cmakeprojectmanager/cmakeprojectconstants.h
View file @
5f17e0b2
...
...
@@ -40,6 +40,7 @@ namespace Constants {
const
char
*
const
PROJECTCONTEXT
=
"CMakeProject.ProjectContext"
;
const
char
*
const
CMAKEMIMETYPE
=
"text/x-cmake"
;
// TOOD check that this is correct
const
char
*
const
CMAKESTEP
=
"CMakeProjectManager.CMakeStep"
;
const
char
*
const
MAKESTEP
=
"CMakeProjectManager.MakeStep"
;
}
// namespace Constants
...
...
src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro
View file @
5f17e0b2
...
...
@@ -7,10 +7,12 @@ HEADERS = cmakeproject.h \
cmakeprojectmanager
.
h
\
cmakeprojectconstants
.
h
\
cmakeprojectnodes
.
h
\
cmakestep
.
h
cmakestep
.
h
\
makestep
.
h
SOURCES
=
cmakeproject
.
cpp
\
cmakeprojectplugin
.
cpp
\
cmakeprojectmanager
.
cpp
\
cmakeprojectnodes
.
cpp
\
cmakestep
.
cpp
cmakestep
.
cpp
\
makestep
.
cpp
RESOURCES
+=
cmakeproject
.
qrc
src/plugins/cmakeprojectmanager/cmakestep.cpp
View file @
5f17e0b2
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include
"cmakestep.h"
#include
"cmakeprojectconstants.h"
#include
"cmakeproject.h"
...
...
@@ -6,7 +39,7 @@ using namespace CMakeProjectManager;
using
namespace
CMakeProjectManager
::
Internal
;
CMakeStep
::
CMakeStep
(
CMakeProject
*
pro
)
:
Build
Step
(
pro
),
m_pro
(
pro
)
:
AbstractProcess
Step
(
pro
),
m_pro
(
pro
)
{
}
...
...
@@ -18,14 +51,17 @@ CMakeStep::~CMakeStep()
bool
CMakeStep
::
init
(
const
QString
&
buildConfiguration
)
{
// TODO
return
true
;
setEnabled
(
buildConfiguration
,
true
);
setWorkingDirectory
(
buildConfiguration
,
m_pro
->
buildDirectory
(
buildConfiguration
));
setCommand
(
buildConfiguration
,
"cmake"
);
// TODO give full path here?
setArguments
(
buildConfiguration
,
QStringList
());
// TODO
setEnvironment
(
buildConfiguration
,
m_pro
->
environment
(
buildConfiguration
));
return
AbstractProcessStep
::
init
(
buildConfiguration
);
}
void
CMakeStep
::
run
(
QFutureInterface
<
bool
>
&
fi
)
{
// TODO
fi
.
reportResult
(
true
);
AbstractProcessStep
::
run
(
fi
);
}
QString
CMakeStep
::
name
()
...
...
src/plugins/cmakeprojectmanager/cmakestep.h
View file @
5f17e0b2
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef CMAKESTEP_H
#define CMAKESTEP_H
#include
<projectexplorer/buildstep.h>
#include
<projectexplorer/abstractprocessstep.h>
namespace
CMakeProjectManager
{
namespace
Internal
{
...
...
@@ -10,7 +44,7 @@ class CMakeProject;
class
CMakeBuildStepConfigWidget
;
class
CMakeStep
:
public
ProjectExplorer
::
Build
Step
class
CMakeStep
:
public
ProjectExplorer
::
AbstractProcess
Step
{
public:
CMakeStep
(
CMakeProject
*
pro
);
...
...
src/plugins/cmakeprojectmanager/makestep.cpp
0 → 100644
View file @
5f17e0b2
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include
"makestep.h"
#include
"cmakeprojectconstants.h"
#include
"cmakeproject.h"
using
namespace
CMakeProjectManager
;
using
namespace
CMakeProjectManager
::
Internal
;
MakeStep
::
MakeStep
(
CMakeProject
*
pro
)
:
AbstractProcessStep
(
pro
),
m_pro
(
pro
)
{
}
MakeStep
::~
MakeStep
()
{
}
bool
MakeStep
::
init
(
const
QString
&
buildConfiguration
)
{
setEnabled
(
buildConfiguration
,
true
);
setWorkingDirectory
(
buildConfiguration
,
m_pro
->
buildDirectory
(
buildConfiguration
));
setCommand
(
buildConfiguration
,
"make"
);
// TODO give full path here?
setArguments
(
buildConfiguration
,
QStringList
());
// TODO
setEnvironment
(
buildConfiguration
,
m_pro
->
environment
(
buildConfiguration
));
return
AbstractProcessStep
::
init
(
buildConfiguration
);
}
void
MakeStep
::
run
(
QFutureInterface
<
bool
>
&
fi
)
{
AbstractProcessStep
::
run
(
fi
);
}
QString
MakeStep
::
name
()
{
return
"Make"
;
}
QString
MakeStep
::
displayName
()
{
return
Constants
::
CMAKESTEP
;
}
ProjectExplorer
::
BuildStepConfigWidget
*
MakeStep
::
createConfigWidget
()
{
return
new
MakeBuildStepConfigWidget
();
}
bool
MakeStep
::
immutable
()
const
{
return
true
;
}
//
// CMakeBuildStepConfigWidget
//
QString
MakeBuildStepConfigWidget
::
displayName
()
const
{
return
"Make"
;
}
void
MakeBuildStepConfigWidget
::
init
(
const
QString
&
buildConfiguration
)
{
// TODO
}
//
// MakeBuildStepFactory
//
bool
MakeBuildStepFactory
::
canCreate
(
const
QString
&
name
)
const
{
return
(
Constants
::
MAKESTEP
==
name
);
}
ProjectExplorer
::
BuildStep
*
MakeBuildStepFactory
::
create
(
ProjectExplorer
::
Project
*
project
,
const
QString
&
name
)
const
{
Q_ASSERT
(
name
==
Constants
::
MAKESTEP
);
CMakeProject
*
pro
=
qobject_cast
<
CMakeProject
*>
(
project
);
Q_ASSERT
(
pro
);
return
new
MakeStep
(
pro
);
}
QStringList
MakeBuildStepFactory
::
canCreateForProject
(
ProjectExplorer
::
Project
*
pro
)
const
{
return
QStringList
();
}
QString
MakeBuildStepFactory
::
displayNameForName
(
const
QString
&
name
)
const
{
return
"Make"
;
}
src/plugins/
help/indexwindow
.h
→
src/plugins/
cmakeprojectmanager/makestep
.h
View file @
5f17e0b2
...
...
@@ -31,52 +31,49 @@
**
***************************************************************************/
#ifndef
INDEXWINDOW
_H
#define
INDEXWINDOW
_H
#ifndef
MAKESTEP
_H
#define
MAKESTEP
_H
#include
<QtCore/QUrl>
#include
<QtGui/QWidget>
#include
<QtGui/QLineEdit>
#include
<projectexplorer/abstractprocessstep.h>
QT_BEGIN_NAMESPACE
namespace
CMakeProjectManager
{
namespace
Internal
{
class
QHelpIndexWidget
;
class
QHelpEngine
;
class
CMakeProject
;
class
IndexWindow
:
public
QWidget
class
MakeStep
:
public
ProjectExplorer
::
AbstractProcessStep
{
Q_OBJECT
public:
IndexWindow
(
QHelpEngine
*
helpEngine
,
QWidget
*
parent
=
0
);
~
IndexWindow
();
void
setSearchLineEditText
(
const
QString
&
text
);
QString
searchLineEditText
()
const
{
return
m_searchLineEdit
->
text
();
}
signals:
void
linkActivated
(
const
QUrl
&
link
);
void
linksActivated
(
const
QMap
<
QString
,
QUrl
>
&
links
,
const
QString
&
keyword
);
void
escapePressed
();
MakeStep
(
CMakeProject
*
pro
);
~
MakeStep
();
virtual
bool
init
(
const
QString
&
buildConfiguration
);
private
slots
:
void
filterIndices
(
const
QString
&
filter
);
void
enableSearchLineEdit
();
void
disableSearchLineEdit
();
virtual
void
run
(
QFutureInterface
<
bool
>
&
fi
);
virtual
QString
name
();
virtual
QString
displayName
();
virtual
ProjectExplorer
::
BuildStepConfigWidget
*
createConfigWidget
();
virtual
bool
immutable
()
const
;
private:
bool
eventFilter
(
QObject
*
obj
,
QEvent
*
e
)
;
void
focusInEvent
(
QFocusEvent
*
e
)
;
CMakeProject
*
m_pro
;
}
;
QLineEdit
*
m_searchLineEdit
;
QHelpIndexWidget
*
m_indexWidget
;
QHelpEngine
*
m_helpEngine
;
class
MakeBuildStepConfigWidget
:
public
ProjectExplorer
::
BuildStepConfigWidget
{
public:
virtual
QString
displayName
()
const
;
virtual
void
init
(
const
QString
&
buildConfiguration
);
};
class
MakeBuildStepFactory
:
public
ProjectExplorer
::
IBuildStepFactory
{
virtual
bool
canCreate
(
const
QString
&
name
)
const
;
virtual
ProjectExplorer
::
BuildStep
*
create
(
ProjectExplorer
::
Project
*
pro
,
const
QString
&
name
)
const
;
virtual
QStringList
canCreateForProject
(
ProjectExplorer
::
Project
*
pro
)
const
;
virtual
QString
displayNameForName
(
const
QString
&
name
)
const
;
};
QT_END_NAMESPACE
}
}
#endif //
INDEXWINDOW
_H
#endif //
MAKESTEP
_H
src/plugins/cpptools/cpphoverhandler.cpp
View file @
5f17e0b2
...
...
@@ -60,7 +60,7 @@
using
namespace
CppTools
::
Internal
;
CppHoverHandler
::
CppHoverHandler
(
CppModelManager
*
manager
,
QObject
*
parent
)
:
QObject
(
parent
),
m_manager
(
manager
)
:
QObject
(
parent
),
m_manager
(
manager
)
,
m_helpEngineNeedsSetup
(
false
)
{
QFileInfo
fi
(
ExtensionSystem
::
PluginManager
::
instance
()
->
getObject
<
Core
::
ICore
>
()
->
settings
()
->
fileName
());
m_helpEngine
=
new
QHelpEngineCore
(
fi
.
absolutePath
()
...
...
@@ -68,6 +68,7 @@ CppHoverHandler::CppHoverHandler(CppModelManager *manager, QObject *parent)
//m_helpEngine->setAutoSaveFilter(false);
m_helpEngine
->
setupData
();
m_helpEngine
->
setCurrentFilter
(
tr
(
"Unfiltered"
));
m_helpEngineNeedsSetup
=
m_helpEngine
->
registeredDocumentations
().
count
()
==
0
;
}
void
CppHoverHandler
::
updateContextHelpId
(
TextEditor
::
ITextEditor
*
editor
,
int
pos
)
...
...
@@ -234,6 +235,12 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
}
}
if
(
m_helpEngineNeedsSetup
&&
m_helpEngine
->
registeredDocumentations
().
count
()
>
0
)
{
m_helpEngine
->
setupData
();
m_helpEngineNeedsSetup
=
false
;
}
if
(
!
m_helpId
.
isEmpty
()
&&
!
m_helpEngine
->
linksForIdentifier
(
m_helpId
).
isEmpty
())
{
m_toolTip
=
QString
(
QLatin1String
(
"<table><tr><td valign=middle><nobr>%1</td>"
"<td><img src=
\"
:/cpptools/images/f1.svg
\"
></td></tr></table>"
)).
arg
(
Qt
::
escape
(
m_toolTip
));
...
...
src/plugins/cpptools/cpphoverhandler.h
View file @
5f17e0b2
...
...
@@ -68,6 +68,7 @@ private:
QHelpEngineCore
*
m_helpEngine
;
QString
m_helpId
;
QString
m_toolTip
;
bool
m_helpEngineNeedsSetup
;
};
}
// namespace Internal
...
...
src/plugins/cpptools/cppmodelmanager.cpp
View file @
5f17e0b2
...
...
@@ -253,6 +253,25 @@ protected:
m_currentDoc
->
appendMacro
(
macroName
,
macroText
);
}
virtual
void
startExpandingMacro
(
unsigned
offset
,
const
rpp
::
Macro
&
macro
,
const
QByteArray
&
originalText
)
{
if
(
!
m_currentDoc
)
return
;
//qDebug() << "start expanding:" << macro.name << "text:" << originalText;
m_currentDoc
->
addMacroUse
(
offset
,
originalText
.
length
());
}
virtual
void
stopExpandingMacro
(
unsigned
offset
,
const
rpp
::
Macro
&
macro
)
{
if
(
!
m_currentDoc
)
return
;
//qDebug() << "stop expanding:" << macro.name;
}
void
mergeEnvironment
(
Document
::
Ptr
doc
)
{
QSet
<
QString
>
processed
;
...
...
@@ -595,6 +614,22 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc)
QList
<
QTextEdit
::
ExtraSelection
>
selections
;
#ifdef QTCREATOR_WITH_MACRO_HIGHLIGHTING
// set up the format for the macros
QTextCharFormat
macroFormat
;
macroFormat
.
setUnderlineStyle
(
QTextCharFormat
::
SingleUnderline
);
QTextCursor
c
=
ed
->
textCursor
();
foreach
(
const
Document
::
Block
block
,
doc
->
macroUses
())
{
QTextEdit
::
ExtraSelection
sel
;
sel
.
cursor
=
c
;
sel
.
cursor
.
setPosition
(
block
.
begin
());
sel
.
cursor
.
setPosition
(
block
.
end
(),
QTextCursor
::
KeepAnchor
);
sel
.
format
=
macroFormat
;
selections
.
append
(
sel
);
}
#endif // QTCREATOR_WITH_MACRO_HIGHLIGHTING
// set up the format for the errors
QTextCharFormat
errorFormat
;
errorFormat
.
setUnderlineStyle
(
QTextCharFormat
::
WaveUnderline
);
...
...
src/plugins/cpptools/rpp/pp-client.h
View file @
5f17e0b2
...
...
@@ -40,6 +40,8 @@
namespace
rpp
{
class
Macro
;
class
Client
{
Client
(
const
Client
&
other
);
...
...
@@ -61,6 +63,13 @@ public:
virtual
void
macroAdded
(
const
QByteArray
&
macroId
,
const
QByteArray
&
text
)
=
0
;
virtual
void
sourceNeeded
(
QString
&
fileName
,
IncludeType
mode
)
=
0
;
// ### FIX the signature.
virtual
void
startExpandingMacro
(
unsigned
offset
,
const
Macro
&
macro
,
const
QByteArray
&
originalTextt
)
=
0
;
virtual
void
stopExpandingMacro
(
unsigned
offset
,
const
Macro
&
macro
)
=
0
;
virtual
void
startSkippingBlocks
(
unsigned
offset
)
=
0
;
virtual
void
stopSkippingBlocks
(
unsigned
offset
)
=
0
;
};
...
...
src/plugins/cpptools/rpp/pp-engine.cpp
View file @
5f17e0b2
...
...
@@ -575,7 +575,17 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
const
QByteArray
spell
=
tokenSpell
(
*
identifierToken
);
if
(
env
.
isBuiltinMacro
(
spell
))
{
const
Macro
trivial
;
if
(
client
)
client
->
startExpandingMacro
(
identifierToken
->
offset
,
trivial
,
spell
);
expand
(
spell
.
constBegin
(),
spell
.
constEnd
(),
result
);
if
(
client
)
client
->
stopExpandingMacro
(
_dot
->
offset
,
trivial
);
continue
;
}
...
...
@@ -585,18 +595,36 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
}
else
{
if
(
!
m
->
function_like
)
{
if
(
_dot
->
isNot
(
T_LPAREN
))
{
if
(
client
)
client
->
startExpandingMacro
(
identifierToken
->
offset
,
*
m
,
spell
);
m
->
hidden
=
true
;
expand
(
m
->
definition
.
constBegin
(),
m
->
definition
.
constEnd
(),
result
);
if
(
client
)
client
->
stopExpandingMacro
(
_dot
->
offset
,
*
m
);
m
->
hidden
=
false
;
continue
;
}
else
{
QByteArray
tmp
;
m
->
hidden
=
true
;
if
(
client
)
client
->
startExpandingMacro
(
identifierToken
->
offset
,
*
m
,
spell
);
expand
(
m
->
definition
.
constBegin
(),
m
->
definition
.
constEnd
(),
&
tmp
);
if
(
client
)
client
->
stopExpandingMacro
(
_dot
->
offset
,
*
m
);
m
->
hidden
=
false
;