Skip to content
GitLab
Menu
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
8fd480bd
Commit
8fd480bd
authored
Jan 07, 2011
by
hjk
Browse files
merge addToOutputWindow and addToOutputWindowInline
parent
f48de4f5
Changes
15
Hide whitespace changes
Inline
Side-by-side
src/plugins/debugger/debuggerrunner.cpp
View file @
8fd480bd
...
...
@@ -442,15 +442,13 @@ void DebuggerRunControl::start()
d
->
m_engine
->
startDebugger
(
this
);
if
(
d
->
m_running
)
{
emit
addToOutputWindowInline
(
this
,
tr
(
"Debugging starts"
),
false
);
emit
addToOutputWindowInline
(
this
,
"
\n
"
,
false
);
}
if
(
d
->
m_running
)
emit
addToOutputWindow
(
this
,
tr
(
"Debugging starts"
),
false
,
false
);
}
void
DebuggerRunControl
::
startFailed
()
{
emit
addToOutputWindow
Inline
(
this
,
tr
(
"Debugging has failed"
),
false
);
emit
addToOutputWindow
(
this
,
tr
(
"Debugging has failed"
),
false
,
false
);
d
->
m_running
=
false
;
emit
finished
();
d
->
m_engine
->
handleStartFailed
();
...
...
@@ -458,7 +456,7 @@ void DebuggerRunControl::startFailed()
void
DebuggerRunControl
::
handleFinished
()
{
emit
addToOutputWindow
Inline
(
this
,
tr
(
"Debugging has finished"
),
false
);
emit
addToOutputWindow
(
this
,
tr
(
"Debugging has finished"
),
false
,
false
);
if
(
d
->
m_engine
)
d
->
m_engine
->
handleFinished
();
debuggerCore
()
->
runControlFinished
(
d
->
m_engine
);
...
...
@@ -468,10 +466,10 @@ void DebuggerRunControl::showMessage(const QString &msg, int channel)
{
switch
(
channel
)
{
case
AppOutput
:
emit
addToOutputWindow
Inline
(
this
,
msg
,
false
);
emit
addToOutputWindow
(
this
,
msg
,
false
,
true
);
break
;
case
AppError
:
emit
addToOutputWindow
Inline
(
this
,
msg
,
true
);
emit
addToOutputWindow
(
this
,
msg
,
true
,
true
);
break
;
case
AppStuff
:
emit
appendMessage
(
this
,
msg
,
true
);
...
...
src/plugins/projectexplorer/localapplicationruncontrol.cpp
View file @
8fd480bd
...
...
@@ -132,7 +132,7 @@ void LocalApplicationRunControl::slotAppendMessage(const QString &err,
void
LocalApplicationRunControl
::
slotAddToOutputWindow
(
const
QString
&
line
,
bool
isError
)
{
emit
addToOutputWindow
Inline
(
this
,
line
,
isError
);
emit
addToOutputWindow
(
this
,
line
,
isError
,
true
);
}
void
LocalApplicationRunControl
::
processExited
(
int
exitCode
)
...
...
src/plugins/projectexplorer/outputformatter.cpp
View file @
8fd480bd
...
...
@@ -74,7 +74,7 @@ void OutputFormatter::appendMessage(const QString &text, OutputFormat format)
cursor
.
insertText
(
text
,
m_formats
[
format
]);
}
QTextCharFormat
OutputFormatter
::
f
ormat
(
OutputFormat
format
)
const
QTextCharFormat
OutputFormatter
::
charF
ormat
(
OutputFormat
format
)
const
{
return
m_formats
[
format
];
}
...
...
src/plugins/projectexplorer/outputformatter.h
View file @
8fd480bd
...
...
@@ -71,7 +71,7 @@ public:
protected:
void
initFormats
();
void
clearLastLine
();
QTextCharFormat
f
ormat
(
OutputFormat
format
)
const
;
QTextCharFormat
charF
ormat
(
OutputFormat
format
)
const
;
static
QColor
mixColors
(
const
QColor
&
a
,
const
QColor
&
b
);
...
...
src/plugins/projectexplorer/outputwindow.cpp
View file @
8fd480bd
...
...
@@ -278,20 +278,11 @@ void OutputPane::createNewOutputWindow(RunControl *rc)
}
void
OutputPane
::
appendApplicationOutput
(
RunControl
*
rc
,
const
QString
&
out
,
bool
onStdErr
)
bool
onStdErr
,
bool
sameLine
)
{
const
int
index
=
indexOf
(
rc
);
if
(
index
!=
-
1
)
m_runControlTabs
.
at
(
index
).
window
->
appendApplicationOutput
(
out
,
onStdErr
);
}
void
OutputPane
::
appendApplicationOutputInline
(
RunControl
*
rc
,
const
QString
&
out
,
bool
onStdErr
)
{
const
int
index
=
indexOf
(
rc
);
if
(
index
!=
-
1
)
m_runControlTabs
.
at
(
index
).
window
->
appendApplicationOutputInline
(
out
,
onStdErr
);
m_runControlTabs
.
at
(
index
).
window
->
appendApplicationOutput
(
out
,
onStdErr
,
sameLine
);
}
void
OutputPane
::
appendMessage
(
RunControl
*
rc
,
const
QString
&
out
,
bool
isError
)
...
...
@@ -625,46 +616,39 @@ QString OutputWindow::doNewlineEnfocement(const QString &out)
return
s
;
}
void
OutputWindow
::
appendApplicationOutput
(
const
QString
&
output
,
bool
onStdErr
)
void
OutputWindow
::
appendApplicationOutput
(
const
QString
&
output
,
bool
onStdErr
,
bool
sameLine
)
{
QString
out
=
output
;
out
.
remove
(
QLatin1Char
(
'\r'
));
setMaximumBlockCount
(
MaxBlockCount
);
const
bool
atBottom
=
isScrollbarAtBottom
();
m_formatter
->
appendMessage
(
doNewlineEnfocement
(
out
),
onStdErr
?
StdErrFormat
:
StdOutFormat
);
if
(
atBottom
)
scrollToBottom
();
enableUndoRedo
();
}
void
OutputWindow
::
appendApplicationOutputInline
(
const
QString
&
output
,
bool
onStdErr
)
{
QString
out
=
output
;
out
.
remove
(
QLatin1Char
(
'\r'
));
m_scrollToBottom
=
true
;
setMaximumBlockCount
(
MaxBlockCount
);
if
(
sameLine
)
{
m_scrollToBottom
=
true
;
int
newline
=
-
1
;
bool
enforceNewline
=
m_enforceNewline
;
m_enforceNewline
=
false
;
const
bool
atBottom
=
isScrollbarAtBottom
();
int
newline
=
-
1
;
bool
enforceNewline
=
m_enforceNewline
;
m_enforceNewline
=
false
;
if
(
!
enforceNewline
)
{
newline
=
out
.
indexOf
(
QLatin1Char
(
'\n'
));
moveCursor
(
QTextCursor
::
End
);
if
(
newline
!=
-
1
)
m_formatter
->
appendMessage
(
out
.
left
(
newline
),
onStdErr
?
StdErrFormat
:
StdOutFormat
);
// doesn't enforce new paragraph like appendPlainText
}
if
(
!
enforceNewline
)
{
newline
=
out
.
indexOf
(
QLatin1Char
(
'\n'
));
moveCursor
(
QTextCursor
::
End
);
if
(
newline
!=
-
1
)
m_formatter
->
appendMessage
(
out
.
left
(
newline
),
onStdErr
?
StdErrFormat
:
StdOutFormat
);
// doesn't enforce new paragraph like appendPlainText
}
QString
s
=
out
.
mid
(
newline
+
1
);
if
(
s
.
isEmpty
())
{
m_enforceNewline
=
true
;
}
else
{
if
(
s
.
endsWith
(
QLatin1Char
(
'\n'
)))
{
QString
s
=
out
.
mid
(
newline
+
1
);
if
(
s
.
isEmpty
())
{
m_enforceNewline
=
true
;
s
.
chop
(
1
);
}
else
{
if
(
s
.
endsWith
(
QLatin1Char
(
'\n'
)))
{
m_enforceNewline
=
true
;
s
.
chop
(
1
);
}
m_formatter
->
appendMessage
(
QLatin1Char
(
'\n'
)
+
s
,
onStdErr
?
StdErrFormat
:
StdOutFormat
);
}
m_formatter
->
appendMessage
(
QLatin1Char
(
'\n'
)
+
s
,
onStdErr
?
StdErrFormat
:
StdOutFormat
);
}
else
{
m_formatter
->
appendMessage
(
doNewlineEnfocement
(
out
),
onStdErr
?
StdErrFormat
:
StdOutFormat
);
}
if
(
atBottom
)
...
...
src/plugins/projectexplorer/outputwindow.h
View file @
8fd480bd
...
...
@@ -97,14 +97,12 @@ signals:
void
allRunControlsFinished
();
public
slots
:
// ApplicationOutputspecifics
// ApplicationOutput
specifics
void
createNewOutputWindow
(
RunControl
*
rc
);
void
projectRemoved
();
void
appendApplicationOutput
(
ProjectExplorer
::
RunControl
*
rc
,
const
QString
&
out
,
bool
onStdErr
);
void
appendApplicationOutputInline
(
ProjectExplorer
::
RunControl
*
rc
,
const
QString
&
out
,
bool
onStdErr
);
bool
onStdErr
,
bool
sameLine
);
void
appendMessage
(
ProjectExplorer
::
RunControl
*
rc
,
const
QString
&
out
,
bool
isError
);
private
slots
:
...
...
@@ -157,8 +155,7 @@ public:
OutputFormatter
*
formatter
()
const
;
void
setFormatter
(
OutputFormatter
*
formatter
);
void
appendApplicationOutput
(
const
QString
&
out
,
bool
onStdErr
);
void
appendApplicationOutputInline
(
const
QString
&
out
,
bool
onStdErr
);
void
appendApplicationOutput
(
const
QString
&
out
,
bool
onStdErr
,
bool
sameLine
);
void
appendMessage
(
const
QString
&
out
,
bool
isError
);
/// appends a \p text using \p format without using formater
void
appendText
(
const
QString
&
text
,
const
QTextCharFormat
&
format
,
int
maxLineCount
);
...
...
src/plugins/projectexplorer/projectexplorer.cpp
View file @
8fd480bd
...
...
@@ -1387,10 +1387,8 @@ void ProjectExplorerPlugin::startRunControl(RunControl *runControl, const QStrin
d
->
m_outputPane
->
popup
(
false
);
d
->
m_outputPane
->
showTabFor
(
runControl
);
connect
(
runControl
,
SIGNAL
(
addToOutputWindow
(
ProjectExplorer
::
RunControl
*
,
QString
,
bool
)),
d
->
m_outputPane
,
SLOT
(
appendApplicationOutput
(
ProjectExplorer
::
RunControl
*
,
QString
,
bool
)));
connect
(
runControl
,
SIGNAL
(
addToOutputWindowInline
(
ProjectExplorer
::
RunControl
*
,
QString
,
bool
)),
d
->
m_outputPane
,
SLOT
(
appendApplicationOutputInline
(
ProjectExplorer
::
RunControl
*
,
QString
,
bool
)));
connect
(
runControl
,
SIGNAL
(
addToOutputWindow
(
ProjectExplorer
::
RunControl
*
,
QString
,
bool
,
bool
)),
d
->
m_outputPane
,
SLOT
(
appendApplicationOutput
(
ProjectExplorer
::
RunControl
*
,
QString
,
bool
,
bool
)));
connect
(
runControl
,
SIGNAL
(
appendMessage
(
ProjectExplorer
::
RunControl
*
,
QString
,
bool
)),
d
->
m_outputPane
,
SLOT
(
appendMessage
(
ProjectExplorer
::
RunControl
*
,
QString
,
bool
)));
...
...
src/plugins/projectexplorer/projectexplorerconstants.h
View file @
8fd480bd
...
...
@@ -147,8 +147,8 @@ const char * const G_SESSION_FILES = "Session.Group.Files";
const
char
*
const
G_SESSION_OTHER
=
"Session.Group.Other"
;
const
char
*
const
G_SESSION_CONFIG
=
"Session.Group.Config"
;
const
char
*
const
G_PROJECT_FIRST
=
"Project.Group.Open"
;
const
char
*
const
G_PROJECT_FILES
=
"Project.Group.Files"
;
const
char
*
const
G_PROJECT_FIRST
=
"Project.Group.Open"
;
const
char
*
const
G_PROJECT_BUILD
=
"Project.Group.Build"
;
const
char
*
const
G_PROJECT_OTHER
=
"Project.Group.Other"
;
const
char
*
const
G_PROJECT_RUN
=
"Project.Group.Run"
;
...
...
src/plugins/projectexplorer/runconfiguration.h
View file @
8fd480bd
...
...
@@ -201,8 +201,7 @@ public:
QString
runMode
()
const
;
signals:
void
addToOutputWindow
(
ProjectExplorer
::
RunControl
*
,
const
QString
&
line
,
bool
onStdErr
);
void
addToOutputWindowInline
(
ProjectExplorer
::
RunControl
*
,
const
QString
&
line
,
bool
onStdErr
);
void
addToOutputWindow
(
ProjectExplorer
::
RunControl
*
,
const
QString
&
line
,
bool
onStdErr
,
bool
sameLine
);
void
appendMessage
(
ProjectExplorer
::
RunControl
*
,
const
QString
&
error
,
bool
isError
);
void
started
();
void
finished
();
...
...
src/plugins/qmlprojectmanager/qmlprojectruncontrol.cpp
View file @
8fd480bd
...
...
@@ -126,7 +126,7 @@ void QmlRunControl::slotError(const QString &err, bool isError)
void
QmlRunControl
::
slotAddToOutputWindow
(
const
QString
&
line
,
bool
onStdErr
)
{
emit
addToOutputWindow
Inline
(
this
,
line
,
onStdErr
);
emit
addToOutputWindow
(
this
,
line
,
onStdErr
,
true
);
}
void
QmlRunControl
::
processExited
(
int
exitCode
)
...
...
src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp
View file @
8fd480bd
...
...
@@ -119,12 +119,12 @@ void MaemoRunControl::handleRemoteProcessFinished(qint64 exitCode)
void
MaemoRunControl
::
handleRemoteOutput
(
const
QByteArray
&
output
)
{
emit
addToOutputWindow
Inline
(
this
,
QString
::
fromUtf8
(
output
),
false
);
emit
addToOutputWindow
(
this
,
QString
::
fromUtf8
(
output
),
false
,
true
);
}
void
MaemoRunControl
::
handleRemoteErrorOutput
(
const
QByteArray
&
output
)
{
emit
addToOutputWindow
Inline
(
this
,
QString
::
fromUtf8
(
output
),
true
);
emit
addToOutputWindow
(
this
,
QString
::
fromUtf8
(
output
),
true
,
true
);
}
void
MaemoRunControl
::
handleProgressReport
(
const
QString
&
progressString
)
...
...
@@ -134,7 +134,7 @@ void MaemoRunControl::handleProgressReport(const QString &progressString)
void
MaemoRunControl
::
handleMountDebugOutput
(
const
QString
&
output
)
{
emit
addToOutputWindow
Inline
(
this
,
output
,
true
);
emit
addToOutputWindow
(
this
,
output
,
true
,
true
);
}
bool
MaemoRunControl
::
isRunning
()
const
...
...
src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
View file @
8fd480bd
...
...
@@ -649,9 +649,9 @@ void S60DeviceRunControl::reportDeployFinished()
}
}
void
S60DeviceRunControl
::
processStopped
(
uint
pc
,
uint
pid
,
uint
tid
,
const
QString
&
reason
)
void
S60DeviceRunControl
::
processStopped
(
uint
pc
,
uint
pid
,
uint
tid
,
const
QString
&
reason
)
{
emit
addToOutputWindow
(
this
,
trk
::
Launcher
::
msgStopped
(
pid
,
tid
,
pc
,
reason
),
false
);
emit
addToOutputWindow
(
this
,
trk
::
Launcher
::
msgStopped
(
pid
,
tid
,
pc
,
reason
),
false
,
false
);
m_launcher
->
terminate
();
}
...
...
@@ -694,7 +694,7 @@ void S60DeviceRunControl::printApplicationOutput(const QString &output)
void
S60DeviceRunControl
::
printApplicationOutput
(
const
QString
&
output
,
bool
onStdErr
)
{
emit
addToOutputWindow
Inline
(
this
,
output
,
onStdErr
);
emit
addToOutputWindow
(
this
,
output
,
onStdErr
,
true
);
}
void
S60DeviceRunControl
::
deviceRemoved
(
const
SymbianUtils
::
SymbianDevice
&
d
)
...
...
src/plugins/qt4projectmanager/qt-s60/s60emulatorrunconfiguration.cpp
View file @
8fd480bd
...
...
@@ -374,7 +374,7 @@ void S60EmulatorRunControl::slotAddToOutputWindow(const QString &line, bool onSt
static
int
prefixLength
=
prefix
.
length
();
int
index
=
line
.
indexOf
(
prefix
);
if
(
index
!=
-
1
)
{
emit
addToOutputWindow
Inline
(
this
,
line
.
mid
(
index
+
prefixLength
+
1
),
onStdErr
);
emit
addToOutputWindow
(
this
,
line
.
mid
(
index
+
prefixLength
+
1
),
onStdErr
,
true
);
}
}
...
...
src/plugins/qt4projectmanager/qtoutputformatter.cpp
View file @
8fd480bd
...
...
@@ -86,7 +86,7 @@ LinkResult QtOutputFormatter::matchLine(const QString &line) const
return
lr
;
}
void
QtOutputFormatter
::
append
ApplicationOutput
(
const
QString
&
txt
,
bool
onStdErr
)
void
QtOutputFormatter
::
append
Message
(
const
QString
&
txt
,
OutputFormat
format
)
{
QTextCursor
cursor
(
plainTextEdit
()
->
document
());
cursor
.
movePosition
(
QTextCursor
::
End
);
...
...
@@ -108,10 +108,10 @@ void QtOutputFormatter::appendApplicationOutput(const QString &txt, bool onStdEr
LinkResult
lr
=
matchLine
(
line
);
if
(
!
lr
.
href
.
isEmpty
())
{
// Found something && line continuation
cursor
.
insertText
(
deferedText
,
format
(
onStdErr
?
StdErrFormat
:
StdOutF
ormat
));
cursor
.
insertText
(
deferedText
,
charFormat
(
f
ormat
));
deferedText
.
clear
();
clearLastLine
();
appendLine
(
cursor
,
lr
,
line
,
onStdErr
);
appendLine
(
cursor
,
lr
,
line
,
format
);
}
else
{
// Found nothing, just emit the new part
deferedText
+=
newPart
;
...
...
@@ -122,9 +122,9 @@ void QtOutputFormatter::appendApplicationOutput(const QString &txt, bool onStdEr
const
QString
line
=
txt
.
mid
(
start
,
pos
-
start
+
1
);
LinkResult
lr
=
matchLine
(
line
);
if
(
!
lr
.
href
.
isEmpty
())
{
cursor
.
insertText
(
deferedText
,
format
(
onStdErr
?
StdErrFormat
:
StdOutF
ormat
));
cursor
.
insertText
(
deferedText
,
charFormat
(
f
ormat
));
deferedText
.
clear
();
appendLine
(
cursor
,
lr
,
line
,
onStdErr
);
appendLine
(
cursor
,
lr
,
line
,
format
);
}
else
{
deferedText
+=
line
;
}
...
...
@@ -142,10 +142,10 @@ void QtOutputFormatter::appendApplicationOutput(const QString &txt, bool onStdEr
LinkResult
lr
=
matchLine
(
m_lastLine
);
if
(
!
lr
.
href
.
isEmpty
())
{
// Found something && line continuation
cursor
.
insertText
(
deferedText
,
format
(
onStdErr
?
StdErrFormat
:
StdOutF
ormat
));
cursor
.
insertText
(
deferedText
,
charFormat
(
f
ormat
));
deferedText
.
clear
();
clearLastLine
();
appendLine
(
cursor
,
lr
,
m_lastLine
,
onStdErr
);
appendLine
(
cursor
,
lr
,
m_lastLine
,
format
);
}
else
{
// Found nothing, just emit the new part
deferedText
+=
newPart
;
...
...
@@ -154,22 +154,23 @@ void QtOutputFormatter::appendApplicationOutput(const QString &txt, bool onStdEr
m_lastLine
=
txt
.
mid
(
start
);
LinkResult
lr
=
matchLine
(
m_lastLine
);
if
(
!
lr
.
href
.
isEmpty
())
{
cursor
.
insertText
(
deferedText
,
format
(
onStdErr
?
StdErrFormat
:
StdOutF
ormat
));
cursor
.
insertText
(
deferedText
,
charFormat
(
f
ormat
));
deferedText
.
clear
();
appendLine
(
cursor
,
lr
,
m_lastLine
,
onStdErr
);
appendLine
(
cursor
,
lr
,
m_lastLine
,
format
);
}
else
{
deferedText
+=
m_lastLine
;
}
}
}
cursor
.
insertText
(
deferedText
,
format
(
onStdErr
?
StdErrFormat
:
StdOutF
ormat
));
cursor
.
insertText
(
deferedText
,
charFormat
(
f
ormat
));
// deferedText.clear();
cursor
.
endEditBlock
();
}
void
QtOutputFormatter
::
appendLine
(
QTextCursor
&
cursor
,
LinkResult
lr
,
const
QString
&
line
,
bool
onStdErr
)
void
QtOutputFormatter
::
appendLine
(
QTextCursor
&
cursor
,
LinkResult
lr
,
const
QString
&
line
,
ProjectExplorer
::
OutputFormat
format
)
{
const
QTextCharFormat
normalFormat
=
format
(
onStdErr
?
StdErrFormat
:
StdOutF
ormat
);
const
QTextCharFormat
normalFormat
=
charFormat
(
f
ormat
);
cursor
.
insertText
(
line
.
left
(
lr
.
start
),
normalFormat
);
QTextCharFormat
linkFormat
=
normalFormat
;
...
...
@@ -179,7 +180,6 @@ void QtOutputFormatter::appendLine(QTextCursor &cursor, LinkResult lr, const QSt
linkFormat
.
setAnchor
(
true
);
linkFormat
.
setAnchorHref
(
lr
.
href
);
cursor
.
insertText
(
line
.
mid
(
lr
.
start
,
lr
.
end
-
lr
.
start
),
linkFormat
);
cursor
.
insertText
(
line
.
mid
(
lr
.
end
),
normalFormat
);
}
...
...
src/plugins/qt4projectmanager/qtoutputformatter.h
View file @
8fd480bd
...
...
@@ -48,8 +48,7 @@ namespace ProjectExplorer {
class
Project
;
}
// namespace ProjectExplorer
namespace
Qt4ProjectManager
{
namespace
Qt4ProjectManager
{
struct
LinkResult
{
...
...
@@ -58,18 +57,20 @@ struct LinkResult
QString
href
;
};
class
QT4PROJECTMANAGER_EXPORT
QtOutputFormatter
:
public
ProjectExplorer
::
OutputFormatter
class
QT4PROJECTMANAGER_EXPORT
QtOutputFormatter
:
public
ProjectExplorer
::
OutputFormatter
{
public:
QtOutputFormatter
(
ProjectExplorer
::
Project
*
project
);
virtual
void
append
ApplicationOutput
(
const
QString
&
text
,
bool
onStdErr
);
virtual
void
append
Message
(
const
QString
&
text
,
ProjectExplorer
::
OutputFormat
format
);
virtual
void
handleLink
(
const
QString
&
href
);
private:
LinkResult
matchLine
(
const
QString
&
line
)
const
;
void
appendLine
(
QTextCursor
&
cursor
,
LinkResult
lr
,
const
QString
&
line
,
bool
onStdError
);
void
appendLine
(
QTextCursor
&
cursor
,
LinkResult
lr
,
const
QString
&
line
,
ProjectExplorer
::
OutputFormat
);
QRegExp
m_qmlError
;
QRegExp
m_qtError
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment