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
0a73401d
Commit
0a73401d
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
c5a261b1
f59964d1
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/perforce/perforceplugin.cpp
View file @
0a73401d
...
...
@@ -405,17 +405,17 @@ void PerforcePlugin::extensionsInitialized()
void
PerforcePlugin
::
openCurrentFile
()
{
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"edit"
)
<<
currentFileName
(),
QStringList
(),
true
);
vcsOpen
(
currentFileName
()
);
}
void
PerforcePlugin
::
addCurrentFile
()
{
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"add"
)
<<
currentFileName
(),
QStringList
(),
true
);
vcsAdd
(
currentFileName
()
);
}
void
PerforcePlugin
::
deleteCurrentFile
()
{
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"delete"
)
<<
currentFileName
(),
QStringList
(),
true
);
vcsDelete
(
currentFileName
()
);
}
void
PerforcePlugin
::
revertCurrentFile
()
...
...
@@ -426,7 +426,7 @@ void PerforcePlugin::revertCurrentFile()
QTextCodec
*
codec
=
VCSBase
::
VCSBaseEditor
::
getCodec
(
m_coreInstance
,
fileName
);
QStringList
args
;
args
<<
QLatin1String
(
"diff"
)
<<
QLatin1String
(
"-sa"
);
PerforceResponse
result
=
runP4Cmd
(
args
,
QStringList
(),
false
,
true
,
codec
);
PerforceResponse
result
=
runP4Cmd
(
args
,
QStringList
(),
CommandToWindow
|
StdErrToWindow
|
ErrorToWindow
,
codec
);
if
(
result
.
error
)
return
;
...
...
@@ -444,7 +444,7 @@ void PerforcePlugin::revertCurrentFile()
foreach
(
Core
::
IFile
*
file
,
files
)
{
fm
->
blockFileChange
(
file
);
}
PerforceResponse
result2
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"revert"
)
<<
fileName
,
QStringList
(),
true
);
PerforceResponse
result2
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"revert"
)
<<
fileName
,
QStringList
(),
CommandToWindow
|
StdOutToWindow
|
StdErrToWindow
|
ErrorToWindow
);
Core
::
IFile
::
ReloadBehavior
tempBehavior
=
Core
::
IFile
::
ReloadAll
;
foreach
(
Core
::
IFile
*
file
,
files
)
{
...
...
@@ -489,7 +489,7 @@ void PerforcePlugin::printOpenedFileList()
Core
::
IEditor
*
e
=
m_coreInstance
->
editorManager
()
->
currentEditor
();
if
(
e
)
e
->
widget
()
->
setFocus
();
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"opened"
),
QStringList
(),
true
);
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"opened"
),
QStringList
(),
CommandToWindow
|
StdOutToWindow
|
StdErrToWindow
|
ErrorToWindow
);
}
#ifdef USE_P4_API
...
...
@@ -522,7 +522,8 @@ void PerforcePlugin::submit()
return
;
}
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"change"
)
<<
QLatin1String
(
"-o"
),
QStringList
(),
false
);
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"change"
)
<<
QLatin1String
(
"-o"
),
QStringList
(),
CommandToWindow
|
StdErrToWindow
|
ErrorToWindow
);
if
(
result
.
error
)
{
delete
m_changeTmpFile
;
m_changeTmpFile
=
0
;
...
...
@@ -550,7 +551,8 @@ void PerforcePlugin::submit()
foreach
(
const
QString
&
f
,
files
)
nativeFiles
<<
QDir
::
toNativeSeparators
(
f
);
PerforceResponse
result2
=
runP4Cmd
(
QStringList
(
QLatin1String
(
"fstat"
)),
nativeFiles
,
false
);
PerforceResponse
result2
=
runP4Cmd
(
QStringList
(
QLatin1String
(
"fstat"
)),
nativeFiles
,
CommandToWindow
|
StdErrToWindow
|
ErrorToWindow
);
if
(
result2
.
error
)
{
delete
m_changeTmpFile
;
m_changeTmpFile
=
0
;
...
...
@@ -597,8 +599,10 @@ void PerforcePlugin::printPendingChanges()
PendingChangesDialog
dia
(
pendingChangesData
(),
m_coreInstance
->
mainWindow
());
qApp
->
restoreOverrideCursor
();
if
(
dia
.
exec
()
==
QDialog
::
Accepted
)
{
int
i
=
dia
.
changeNumber
();
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
"submit"
<<
"-c"
<<
QString
::
number
(
i
),
QStringList
(),
true
);
const
int
i
=
dia
.
changeNumber
();
QStringList
args
(
QLatin1String
(
"submit"
));
args
<<
QLatin1String
(
"-c"
)
<<
QString
::
number
(
i
);
runP4Cmd
(
args
,
QStringList
(),
CommandToWindow
|
StdOutToWindow
|
StdErrToWindow
|
ErrorToWindow
);
}
}
...
...
@@ -628,7 +632,8 @@ void PerforcePlugin::annotate(const QString &fileName)
QTextCodec
*
codec
=
VCSBase
::
VCSBaseEditor
::
getCodec
(
m_coreInstance
,
fileName
);
QStringList
args
;
args
<<
QLatin1String
(
"annotate"
)
<<
QLatin1String
(
"-cqi"
)
<<
fileName
;
const
PerforceResponse
result
=
runP4Cmd
(
args
,
QStringList
(),
false
,
true
,
codec
);
const
PerforceResponse
result
=
runP4Cmd
(
args
,
QStringList
(),
CommandToWindow
|
StdErrToWindow
|
ErrorToWindow
,
codec
);
if
(
!
result
.
error
)
{
const
QFileInfo
fi
(
fileName
);
showOutputInEditor
(
tr
(
"p4 annotate %1"
).
arg
(
fi
.
fileName
()),
result
.
stdOut
,
VCSBase
::
AnnotateOutput
,
codec
);
...
...
@@ -654,7 +659,8 @@ void PerforcePlugin::filelog(const QString &fileName)
QTextCodec
*
codec
=
VCSBase
::
VCSBaseEditor
::
getCodec
(
m_coreInstance
,
fileName
);
QStringList
args
;
args
<<
QLatin1String
(
"filelog"
)
<<
QLatin1String
(
"-li"
)
<<
fileName
;
const
PerforceResponse
result
=
runP4Cmd
(
args
,
QStringList
(),
false
,
true
,
codec
);
const
PerforceResponse
result
=
runP4Cmd
(
args
,
QStringList
(),
CommandToWindow
|
StdErrToWindow
|
ErrorToWindow
,
codec
);
if
(
!
result
.
error
)
{
const
QFileInfo
fi
(
fileName
);
showOutputInEditor
(
tr
(
"p4 filelog %1"
).
arg
(
fi
.
fileName
()),
result
.
stdOut
,
VCSBase
::
LogOutput
,
codec
);
...
...
@@ -718,18 +724,19 @@ bool PerforcePlugin::managesDirectory(const QString &directory) const
QStringList
args
;
args
<<
QLatin1String
(
"fstat"
)
<<
QLatin1String
(
"-m1"
)
<<
p4Path
;
const
PerforceResponse
result
=
runP4Cmd
(
args
,
QStringList
(),
false
,
false
);
const
PerforceResponse
result
=
runP4Cmd
(
args
,
QStringList
(),
0u
);
return
result
.
stdOut
.
contains
(
"depotFile"
)
||
result
.
stdErr
.
contains
(
"... - no such file(s)"
);
}
QString
PerforcePlugin
::
findTopLevelForDirectory
(
const
QString
&
/* dir */
)
const
{
// First check with p4 client -o
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"client"
)
<<
QLatin1String
(
"-o"
),
QStringList
(),
false
,
false
);
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"client"
)
<<
QLatin1String
(
"-o"
),
QStringList
(),
0u
);
if
(
result
.
error
)
return
QString
::
null
;
QRegExp
regExp
(
QLatin1String
(
"(
\\
n|
\\
r
\\
n|
\\
r)Root:
\\
s*(.*)(
\\
n|
\\
r
\\
n|
\\
r)"
));
Q_ASSERT
(
regExp
.
isValid
());
regExp
.
setMinimal
(
true
);
if
(
regExp
.
indexIn
(
result
.
stdOut
)
!=
-
1
)
{
QString
file
=
regExp
.
cap
(
2
).
trimmed
();
...
...
@@ -741,20 +748,24 @@ QString PerforcePlugin::findTopLevelForDirectory(const QString & /* dir */) cons
bool
PerforcePlugin
::
vcsOpen
(
const
QString
&
fileName
)
{
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"edit"
)
<<
QDir
::
toNativeSeparators
(
fileName
),
QStringList
(),
true
);
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"edit"
)
<<
QDir
::
toNativeSeparators
(
fileName
),
QStringList
(),
CommandToWindow
|
StdOutToWindow
|
StdErrToWindow
|
ErrorToWindow
);
return
!
result
.
error
;
}
bool
PerforcePlugin
::
vcsAdd
(
const
QString
&
fileName
)
{
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"add"
)
<<
fileName
,
QStringList
(),
true
);
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"add"
)
<<
fileName
,
QStringList
(),
CommandToWindow
|
StdOutToWindow
|
StdErrToWindow
|
ErrorToWindow
);
return
!
result
.
error
;
}
bool
PerforcePlugin
::
vcsDelete
(
const
QString
&
fileName
)
{
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"revert"
)
<<
fileName
,
QStringList
(),
true
);
PerforceResponse
result2
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"delete"
)
<<
fileName
,
QStringList
(),
true
);
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"revert"
)
<<
fileName
,
QStringList
(),
CommandToWindow
|
StdOutToWindow
|
StdErrToWindow
|
ErrorToWindow
);
PerforceResponse
result2
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"delete"
)
<<
fileName
,
QStringList
(),
CommandToWindow
|
StdOutToWindow
|
StdErrToWindow
|
ErrorToWindow
);
// TODO need to carefully parse the actual messages from perforce
// or do a fstat before to decide what to do
...
...
@@ -767,8 +778,7 @@ bool PerforcePlugin::vcsDelete(const QString &fileName)
PerforceResponse
PerforcePlugin
::
runP4Cmd
(
const
QStringList
&
args
,
const
QStringList
&
extraArgs
,
bool
showStdOutInOutputWindow
,
bool
showStdErrInOutputWindow
,
unsigned
logFlags
,
QTextCodec
*
outputCodec
)
const
{
if
(
Perforce
::
Constants
::
debug
)
...
...
@@ -801,12 +811,14 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
}
actualArgs
<<
args
;
response
.
command
=
m_settings
.
p4Command
;
response
.
command
+=
blank
;
response
.
command
+=
actualArgs
.
join
(
QString
(
blank
));
const
QString
timeStamp
=
QTime
::
currentTime
().
toString
(
QLatin1String
(
"HH:mm"
));
const
QString
outputText
=
tr
(
"%1 Executing: %2
\n
"
).
arg
(
timeStamp
,
response
.
command
);
showOutput
(
outputText
,
false
);
if
(
logFlags
&
CommandToWindow
)
{
QString
command
=
m_settings
.
p4Command
;
command
+=
blank
;
command
+=
actualArgs
.
join
(
QString
(
blank
));
const
QString
timeStamp
=
QTime
::
currentTime
().
toString
(
QLatin1String
(
"HH:mm"
));
const
QString
outputText
=
tr
(
"%1 Executing: %2
\n
"
).
arg
(
timeStamp
,
command
);
showOutput
(
outputText
,
false
);
}
// Run, connect stderr to the output window
Core
::
Utils
::
SynchronousProcess
process
;
...
...
@@ -815,13 +827,13 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
process
.
setEnvironment
(
environment
());
// connect stderr to the output window if desired
if
(
showStdErrInOutput
Window
)
{
if
(
logFlags
&
StdErrTo
Window
)
{
process
.
setStdErrBufferedSignalsEnabled
(
true
);
connect
(
&
process
,
SIGNAL
(
stdErrBuffered
(
QString
,
bool
)),
m_perforceOutputWindow
,
SLOT
(
append
(
QString
,
bool
)));
}
// connect stdout to the output window if desired
if
(
showStdOutInOutput
Window
)
{
if
(
logFlags
&
StdOutTo
Window
)
{
process
.
setStdOutBufferedSignalsEnabled
(
true
);
connect
(
&
process
,
SIGNAL
(
stdOutBuffered
(
QString
,
bool
)),
m_perforceOutputWindow
,
SLOT
(
append
(
QString
,
bool
)));
}
...
...
@@ -847,13 +859,15 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
response
.
message
=
tr
(
"Could not start perforce '%1'. Please check your settings in the preferences."
).
arg
(
m_settings
.
p4Command
);
break
;
case
Core
::
Utils
::
SynchronousProcessResponse
::
Hang
:
response
.
message
=
tr
(
"
Subversion
did not respond within timeout limit (%1 ms)."
).
arg
(
p4Timeout
);
response
.
message
=
tr
(
"
Perforce
did not respond within timeout limit (%1 ms)."
).
arg
(
p4Timeout
);
break
;
}
if
(
response
.
error
)
m_perforceOutputWindow
->
append
(
response
.
message
,
true
);
if
(
response
.
error
)
{
if
(
Perforce
::
Constants
::
debug
)
qDebug
()
<<
response
.
message
;
if
(
logFlags
&
ErrorToWindow
)
m_perforceOutputWindow
->
append
(
response
.
message
,
true
);
}
return
response
;
}
...
...
@@ -923,7 +937,7 @@ void PerforcePlugin::p4Diff(const QStringList &files, QString diffname)
}
}
const
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"diff"
)
<<
QLatin1String
(
"-du"
),
files
,
false
,
codec
);
const
PerforceResponse
result
=
runP4Cmd
(
QStringList
()
<<
QLatin1String
(
"diff"
)
<<
QLatin1String
(
"-du"
),
files
,
CommandToWindow
|
StdErrToWindow
|
ErrorToWindow
,
codec
);
if
(
result
.
error
)
return
;
...
...
@@ -948,7 +962,7 @@ void PerforcePlugin::describe(const QString & source, const QString &n)
QTextCodec
*
codec
=
source
.
isEmpty
()
?
static_cast
<
QTextCodec
*>
(
0
)
:
VCSBase
::
VCSBaseEditor
::
getCodec
(
m_coreInstance
,
source
);
QStringList
args
;
args
<<
QLatin1String
(
"describe"
)
<<
QLatin1String
(
"-du"
)
<<
n
;
const
PerforceResponse
result
=
runP4Cmd
(
args
,
QStringList
(),
codec
);
const
PerforceResponse
result
=
runP4Cmd
(
args
,
QStringList
(),
CommandToWindow
|
StdErrToWindow
|
ErrorToWindow
,
codec
);
if
(
!
result
.
error
)
showOutputInEditor
(
tr
(
"p4 describe %1"
).
arg
(
n
),
result
.
stdOut
,
VCSBase
::
DiffOutput
,
codec
);
}
...
...
src/plugins/perforce/perforceplugin.h
View file @
0a73401d
...
...
@@ -86,7 +86,6 @@ private:
struct
PerforceResponse
{
bool
error
;
QString
command
;
QString
stdOut
;
QString
stdErr
;
QString
message
;
...
...
@@ -161,12 +160,15 @@ private:
Core
::
IEditor
*
showOutputInEditor
(
const
QString
&
title
,
const
QString
output
,
int
editorType
,
QTextCodec
*
codec
=
0
);
// Verbosity flags for runP4Cmd.
enum
RunLogFlags
{
CommandToWindow
=
0x1
,
StdOutToWindow
=
0x2
,
StdErrToWindow
=
0x4
,
ErrorToWindow
=
0x8
};
// args are passed as command line arguments
// extra args via a tempfile and the option -x "temp-filename"
PerforceResponse
runP4Cmd
(
const
QStringList
&
args
,
const
QStringList
&
extraArgs
=
QStringList
(),
bool
showStdOutInOutputWindow
=
false
,
bool
showStdErrInOutputWindow
=
true
,
unsigned
logFlags
=
CommandToWindow
|
StdErrToWindow
|
ErrorToWindow
,
QTextCodec
*
outputCodec
=
0
)
const
;
void
openFiles
(
const
QStringList
&
files
);
...
...
src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.cpp
View file @
0a73401d
...
...
@@ -35,6 +35,7 @@
#include
"consoleappwizard.h"
#include
"modulespage.h"
#include
<QtCore/QDebug>
#include
<utils/projectintropage.h>
namespace
Qt4ProjectManager
{
...
...
@@ -51,13 +52,11 @@ ConsoleAppWizardDialog::ConsoleAppWizardDialog(const QString &templateName,
setWindowIcon
(
icon
);
setWindowTitle
(
templateName
);
Core
::
BaseFileWizard
::
setupWizard
(
this
);
setOptions
(
QWizard
::
IndependentPages
|
QWizard
::
HaveNextButtonOnLastPage
);
m_introPage
->
setDescription
(
tr
(
"This wizard generates a Qt4 console application "
"project. The application derives from QCoreApplication and does not "
"present a GUI. You can press 'Finish' at any point in time."
));
m_introPage
->
setFinalPage
(
true
);
addPage
(
m_introPage
);
m_modulesPage
->
setModuleSelected
(
QLatin1String
(
"core"
));
...
...
src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp
View file @
0a73401d
...
...
@@ -63,7 +63,6 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName,
setWindowIcon
(
icon
);
setWindowTitle
(
templateName
);
Core
::
BaseFileWizard
::
setupWizard
(
this
);
setOptions
(
QWizard
::
IndependentPages
);
m_introPage
->
setDescription
(
tr
(
"This wizard generates a Qt4 GUI application "
"project. The application derives by default from QApplication "
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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