Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qt-creator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Hunger
qt-creator
Commits
288ece11
Commit
288ece11
authored
15 years ago
by
Friedemann Kleint
Browse files
Options
Downloads
Patches
Plain Diff
VCS[git]: Add "Clean project"
in the same fashion as "Clean repository".
parent
47d6195c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/plugins/git/gitplugin.cpp
+28
-7
28 additions, 7 deletions
src/plugins/git/gitplugin.cpp
src/plugins/git/gitplugin.h
+4
-1
4 additions, 1 deletion
src/plugins/git/gitplugin.h
src/plugins/vcsbase/cleandialog.cpp
+3
-1
3 additions, 1 deletion
src/plugins/vcsbase/cleandialog.cpp
with
35 additions
and
9 deletions
src/plugins/git/gitplugin.cpp
+
28
−
7
View file @
288ece11
...
...
@@ -133,7 +133,8 @@ GitPlugin::GitPlugin() :
m_commitAction
(
0
),
m_pullAction
(
0
),
m_pushAction
(
0
),
m_cleanAction
(
0
),
m_cleanProjectAction
(
0
),
m_cleanRepositoryAction
(
0
),
m_submitCurrentAction
(
0
),
m_diffSelectedFilesAction
(
0
),
m_undoAction
(
0
),
...
...
@@ -304,6 +305,13 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
gitContainer
->
addAction
(
command
);
m_commandLocator
->
appendCommand
(
command
);
m_cleanProjectAction
=
new
Utils
::
ParameterAction
(
tr
(
"Clean Project..."
),
tr
(
"Clean Project
\"
%1
\"
..."
),
Utils
::
ParameterAction
::
AlwaysEnabled
,
this
);
command
=
actionManager
->
registerAction
(
m_cleanProjectAction
,
"Git.CleanProject"
,
globalcontext
);
command
->
setAttribute
(
Core
::
Command
::
CA_UpdateText
);
connect
(
m_cleanProjectAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cleanProject
()));
gitContainer
->
addAction
(
command
);
m_commandLocator
->
appendCommand
(
command
);
gitContainer
->
addAction
(
createSeparator
(
actionManager
,
globalcontext
,
QLatin1String
(
"Git.Sep.Repository"
),
this
));
m_diffRepositoryAction
=
new
QAction
(
tr
(
"Diff Repository"
),
this
);
...
...
@@ -334,9 +342,9 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
connect
(
m_createRepositoryAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
createRepository
()));
gitContainer
->
addAction
(
command
);
m_cleanAction
=
new
QAction
(
tr
(
"Clean Repository..."
),
this
);
command
=
actionManager
->
registerAction
(
m_cleanAction
,
"Git.CleanRepository"
,
globalcontext
);
connect
(
m_cleanAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cleanRepository
()));
m_clean
Repository
Action
=
new
QAction
(
tr
(
"Clean Repository..."
),
this
);
command
=
actionManager
->
registerAction
(
m_clean
Repository
Action
,
"Git.CleanRepository"
,
globalcontext
);
connect
(
m_clean
Repository
Action
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cleanRepository
()));
gitContainer
->
addAction
(
command
);
m_commandLocator
->
appendCommand
(
command
);
...
...
@@ -688,16 +696,27 @@ void GitPlugin::push()
m_gitClient
->
push
(
state
.
topLevel
());
}
void
GitPlugin
::
cleanProject
()
{
const
VCSBase
::
VCSBasePluginState
state
=
currentState
();
QTC_ASSERT
(
state
.
hasProject
(),
return
)
cleanRepository
(
state
.
currentProjectPath
());
}
void
GitPlugin
::
cleanRepository
()
{
const
VCSBase
::
VCSBasePluginState
state
=
currentState
();
QTC_ASSERT
(
state
.
hasTopLevel
(),
return
);
cleanRepository
(
state
.
topLevel
());
}
void
GitPlugin
::
cleanRepository
(
const
QString
&
directory
)
{
// Find files to be deleted
QString
errorMessage
;
QStringList
files
;
QApplication
::
setOverrideCursor
(
Qt
::
WaitCursor
);
const
bool
gotFiles
=
m_gitClient
->
synchronousCleanList
(
state
.
topLevel
()
,
&
files
,
&
errorMessage
);
const
bool
gotFiles
=
m_gitClient
->
synchronousCleanList
(
directory
,
&
files
,
&
errorMessage
);
QApplication
::
restoreOverrideCursor
();
QWidget
*
parent
=
Core
::
ICore
::
instance
()
->
mainWindow
();
...
...
@@ -720,7 +739,7 @@ void GitPlugin::cleanRepository()
// Show in dialog
VCSBase
::
CleanDialog
dialog
(
parent
);
dialog
.
setFileList
(
state
.
topLevel
()
,
files
);
dialog
.
setFileList
(
directory
,
files
);
dialog
.
exec
();
}
...
...
@@ -811,6 +830,8 @@ void GitPlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as)
m_diffProjectAction
->
setParameter
(
projectName
);
m_logProjectAction
->
setEnabled
(
projectEnabled
);
m_logProjectAction
->
setParameter
(
projectName
);
m_cleanProjectAction
->
setParameter
(
projectName
);
m_cleanProjectAction
->
setEnabled
(
projectEnabled
);
m_diffRepositoryAction
->
setEnabled
(
repositoryEnabled
);
m_statusRepositoryAction
->
setEnabled
(
repositoryEnabled
);
...
...
@@ -824,7 +845,7 @@ void GitPlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as)
m_logRepositoryAction
->
setEnabled
(
repositoryEnabled
);
m_undoRepositoryAction
->
setEnabled
(
repositoryEnabled
);
m_pushAction
->
setEnabled
(
repositoryEnabled
);
m_cleanAction
->
setEnabled
(
repositoryEnabled
);
m_clean
Repository
Action
->
setEnabled
(
repositoryEnabled
);
// Prompts for repo.
m_showAction
->
setEnabled
(
true
);
...
...
This diff is collapsed.
Click to expand it.
src/plugins/git/gitplugin.h
+
4
−
1
View file @
288ece11
...
...
@@ -105,6 +105,7 @@ private slots:
void
undoRepositoryChanges
();
void
stageFile
();
void
unstageFile
();
void
cleanProject
();
void
cleanRepository
();
void
showCommit
();
...
...
@@ -125,6 +126,7 @@ private:
bool
isCommitEditorOpen
()
const
;
Core
::
IEditor
*
openSubmitEditor
(
const
QString
&
fileName
,
const
CommitData
&
cd
);
void
cleanCommitMessageFile
();
void
cleanRepository
(
const
QString
&
directory
);
static
GitPlugin
*
m_instance
;
Core
::
ICore
*
m_core
;
...
...
@@ -147,7 +149,8 @@ private:
QAction
*
m_commitAction
;
QAction
*
m_pullAction
;
QAction
*
m_pushAction
;
QAction
*
m_cleanAction
;
Utils
::
ParameterAction
*
m_cleanProjectAction
;
QAction
*
m_cleanRepositoryAction
;
QAction
*
m_submitCurrentAction
;
QAction
*
m_diffSelectedFilesAction
;
...
...
This diff is collapsed.
Click to expand it.
src/plugins/vcsbase/cleandialog.cpp
+
3
−
1
View file @
288ece11
...
...
@@ -167,6 +167,7 @@ void CleanDialog::setFileList(const QString &workingDirectory, const QStringList
const
QString
diffSuffix
=
QLatin1String
(
".diff"
);
const
QString
patchSuffix
=
QLatin1String
(
".patch"
);
const
QString
proUserSuffix
=
QLatin1String
(
".pro.user"
);
const
QString
qmlProUserSuffix
=
QLatin1String
(
".qmlproject.user"
);
const
QChar
slash
=
QLatin1Char
(
'/'
);
// Do not initially check patches or 'pro.user' files for deletion.
foreach
(
const
QString
&
fileName
,
l
)
{
...
...
@@ -177,7 +178,8 @@ void CleanDialog::setFileList(const QString &workingDirectory, const QStringList
nameItem
->
setIcon
(
isDir
?
folderIcon
:
fileIcon
);
const
bool
saveFile
=
!
isDir
&&
(
fileName
.
endsWith
(
diffSuffix
)
||
fileName
.
endsWith
(
patchSuffix
)
||
fileName
.
endsWith
(
proUserSuffix
));
||
fileName
.
endsWith
(
proUserSuffix
)
||
fileName
.
endsWith
(
qmlProUserSuffix
));
nameItem
->
setCheckable
(
true
);
nameItem
->
setCheckState
(
saveFile
?
Qt
::
Unchecked
:
Qt
::
Checked
);
nameItem
->
setData
(
QVariant
(
fi
.
absoluteFilePath
()),
fileNameRole
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment