Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
abedeeb9
Commit
abedeeb9
authored
Feb 23, 2011
by
dt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMakeProjec: Add "Run cmake" to Build menu and context menus
parent
b2610f87
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
0 deletions
+84
-0
src/plugins/cmakeprojectmanager/cmakeprojectconstants.h
src/plugins/cmakeprojectmanager/cmakeprojectconstants.h
+2
-0
src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
+71
-0
src/plugins/cmakeprojectmanager/cmakeprojectmanager.h
src/plugins/cmakeprojectmanager/cmakeprojectmanager.h
+11
-0
No files found.
src/plugins/cmakeprojectmanager/cmakeprojectconstants.h
View file @
abedeeb9
...
...
@@ -42,6 +42,8 @@ const char * const CMAKEMIMETYPE = "text/x-cmake"; // TOOD check that this is c
const
char
*
const
CMAKE_EDITOR_ID
=
"CMakeProject.CMakeEditor"
;
const
char
*
const
CMAKE_EDITOR_DISPLAY_NAME
=
"CMake Editor"
;
const
char
*
const
C_CMAKEEDITOR
=
"CMakeProject.Context.CMakeEditor"
;
const
char
*
const
RUNCMAKE
=
"CMakeProject.RunCMake"
;
const
char
*
const
RUNCMAKECONTEXTMENU
=
"CMakeProject.RunCMakeContextMenu"
;
// Project
const
char
*
const
CMAKEPROJECT_ID
=
"CMakeProjectManager.CMakeProject"
;
...
...
src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp
View file @
abedeeb9
...
...
@@ -31,6 +31,7 @@
**
**************************************************************************/
#include "cmakeopenprojectwizard.h"
#include "cmakeprojectmanager.h"
#include "cmakeprojectconstants.h"
#include "cmakeproject.h"
...
...
@@ -40,7 +41,11 @@
#include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectexplorer.h>
#include <qtconcurrent/QtConcurrentTools>
#include <QtCore/QtConcurrentRun>
#include <QtCore/QCoreApplication>
...
...
@@ -60,6 +65,72 @@ CMakeManager::CMakeManager(CMakeSettingsPage *cmakeSettingsPage)
{
m_projectContext
=
Core
::
Context
(
CMakeProjectManager
::
Constants
::
PROJECTCONTEXT
);
m_projectLanguage
=
Core
::
Context
(
ProjectExplorer
::
Constants
::
LANG_CXX
);
ProjectExplorer
::
ProjectExplorerPlugin
*
projectExplorer
=
ProjectExplorer
::
ProjectExplorerPlugin
::
instance
();
connect
(
projectExplorer
,
SIGNAL
(
aboutToShowContextMenu
(
ProjectExplorer
::
Project
*
,
ProjectExplorer
::
Node
*
)),
this
,
SLOT
(
updateContextMenu
(
ProjectExplorer
::
Project
*
,
ProjectExplorer
::
Node
*
)));
Core
::
ActionManager
*
am
=
Core
::
ICore
::
instance
()
->
actionManager
();
Core
::
ActionContainer
*
mbuild
=
am
->
actionContainer
(
ProjectExplorer
::
Constants
::
M_BUILDPROJECT
);
Core
::
ActionContainer
*
mproject
=
am
->
actionContainer
(
ProjectExplorer
::
Constants
::
M_PROJECTCONTEXT
);
Core
::
ActionContainer
*
msubproject
=
am
->
actionContainer
(
ProjectExplorer
::
Constants
::
M_SUBPROJECTCONTEXT
);
m_runCMakeAction
=
new
QAction
(
QIcon
(),
tr
(
"Run cmake"
),
this
);
Core
::
Command
*
command
=
am
->
registerAction
(
m_runCMakeAction
,
Constants
::
RUNCMAKE
,
m_projectContext
);
command
->
setAttribute
(
Core
::
Command
::
CA_Hide
);
mbuild
->
addAction
(
command
,
ProjectExplorer
::
Constants
::
G_BUILD_PROJECT
);
connect
(
m_runCMakeAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
runCMake
()));
m_runCMakeActionContextMenu
=
new
QAction
(
QIcon
(),
tr
(
"Run cmake"
),
this
);
command
=
am
->
registerAction
(
m_runCMakeActionContextMenu
,
Constants
::
RUNCMAKECONTEXTMENU
,
m_projectContext
);
command
->
setAttribute
(
Core
::
Command
::
CA_Hide
);
mproject
->
addAction
(
command
,
ProjectExplorer
::
Constants
::
G_PROJECT_BUILD
);
msubproject
->
addAction
(
command
,
ProjectExplorer
::
Constants
::
G_PROJECT_BUILD
);
connect
(
m_runCMakeActionContextMenu
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
runCMakeContextMenu
()));
}
void
CMakeManager
::
updateContextMenu
(
ProjectExplorer
::
Project
*
project
,
ProjectExplorer
::
Node
*
node
)
{
Q_UNUSED
(
node
);
m_contextProject
=
project
;
}
void
CMakeManager
::
runCMake
()
{
runCMake
(
ProjectExplorer
::
ProjectExplorerPlugin
::
instance
()
->
currentProject
());
}
void
CMakeManager
::
runCMakeContextMenu
()
{
runCMake
(
m_contextProject
);
}
void
CMakeManager
::
runCMake
(
ProjectExplorer
::
Project
*
project
)
{
if
(
!
project
)
return
;
CMakeProject
*
cmakeProject
=
qobject_cast
<
CMakeProject
*>
(
project
);
if
(
!
cmakeProject
)
return
;
if
(
!
cmakeProject
->
activeTarget
())
return
;
if
(
!
cmakeProject
->
activeTarget
()
->
activeBuildConfiguration
())
return
;
CMakeBuildConfiguration
*
bc
=
cmakeProject
->
activeTarget
()
->
activeBuildConfiguration
();
CMakeOpenProjectWizard
copw
(
this
,
cmakeProject
->
projectDirectory
(),
bc
->
buildDirectory
(),
CMakeOpenProjectWizard
::
WantToUpdate
,
bc
->
environment
());
if
(
copw
.
exec
()
==
QDialog
::
Accepted
)
{
cmakeProject
->
parseCMakeLists
();
}
}
Core
::
Context
CMakeManager
::
projectContext
()
const
...
...
src/plugins/cmakeprojectmanager/cmakeprojectmanager.h
View file @
abedeeb9
...
...
@@ -36,6 +36,8 @@
#include <projectexplorer/iprojectmanager.h>
#include <coreplugin/dialogs/ioptionspage.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
#include <coreplugin/icontext.h>
#include <utils/environment.h>
...
...
@@ -44,6 +46,7 @@
#include <QtCore/QFuture>
#include <QtCore/QStringList>
#include <QtCore/QDir>
#include <QtGui/QAction>
QT_FORWARD_DECLARE_CLASS
(
QProcess
)
QT_FORWARD_DECLARE_CLASS
(
QLabel
)
...
...
@@ -84,12 +87,20 @@ public:
static
QString
findCbpFile
(
const
QDir
&
);
static
QString
findDumperLibrary
(
const
Utils
::
Environment
&
env
);
private
slots
:
void
updateContextMenu
(
ProjectExplorer
::
Project
*
project
,
ProjectExplorer
::
Node
*
node
);
void
runCMake
();
void
runCMakeContextMenu
();
private:
void
runCMake
(
ProjectExplorer
::
Project
*
project
);
static
QString
qtVersionForQMake
(
const
QString
&
qmakePath
);
static
QPair
<
QString
,
QString
>
findQtDir
(
const
Utils
::
Environment
&
env
);
Core
::
Context
m_projectContext
;
Core
::
Context
m_projectLanguage
;
CMakeSettingsPage
*
m_settingsPage
;
QAction
*
m_runCMakeAction
;
QAction
*
m_runCMakeActionContextMenu
;
ProjectExplorer
::
Project
*
m_contextProject
;
};
struct
CMakeValidator
...
...
Write
Preview
Markdown
is supported
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