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
Marco Bubke
flatpak-qt-creator
Commits
2993f898
Commit
2993f898
authored
Nov 24, 2010
by
Christian Kandeler
Browse files
ProjectExplorer: Add publishing infrastructure.
Reviewed-by: dt
parent
5c67e102
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/projectexplorer.cpp
View file @
2993f898
...
...
@@ -76,6 +76,8 @@
#include
"buildconfigdialog.h"
#include
"miniprojecttargetselector.h"
#include
"taskhub.h"
#include
"publishing/ipublishingwizardfactory.h"
#include
"publishing/publishingwizardselectiondialog.h"
#include
<coreplugin/basemode.h>
#include
<coreplugin/coreconstants.h>
...
...
@@ -114,6 +116,7 @@
#include
<QtGui/QMenu>
#include
<QtGui/QMessageBox>
#include
<QtGui/QMainWindow>
#include
<QtGui/QWizard>
Q_DECLARE_METATYPE
(
Core
::
IEditorFactory
*
);
Q_DECLARE_METATYPE
(
Core
::
IExternalEditor
*
);
...
...
@@ -154,6 +157,7 @@ struct ProjectExplorerPluginPrivate {
Utils
::
ParameterAction
*
m_deployAction
;
Utils
::
ParameterAction
*
m_deployActionContextMenu
;
QAction
*
m_deploySessionAction
;
Utils
::
ParameterAction
*
m_publishAction
;
Utils
::
ParameterAction
*
m_cleanAction
;
Utils
::
ParameterAction
*
m_cleanActionContextMenu
;
QAction
*
m_cleanSessionAction
;
...
...
@@ -613,6 +617,14 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
cmd
->
setDefaultText
(
d
->
m_deployAction
->
text
());
mbuild
->
addAction
(
cmd
,
Constants
::
G_BUILD_PROJECT
);
// Publish action
d
->
m_publishAction
=
new
Utils
::
ParameterAction
(
tr
(
"Publish Project..."
),
tr
(
"Publish Project
\"
%1
\"
..."
),
Utils
::
ParameterAction
::
AlwaysEnabled
,
this
);
cmd
=
am
->
registerAction
(
d
->
m_publishAction
,
Constants
::
PUBLISH
,
globalcontext
);
cmd
->
setAttribute
(
Core
::
Command
::
CA_UpdateText
);
cmd
->
setDefaultText
(
d
->
m_publishAction
->
text
());
mbuild
->
addAction
(
cmd
,
Constants
::
G_BUILD_PROJECT
);
// clean action
d
->
m_cleanAction
=
new
Utils
::
ParameterAction
(
tr
(
"Clean Project"
),
tr
(
"Clean Project
\"
%1
\"
"
),
Utils
::
ParameterAction
::
AlwaysEnabled
,
this
);
...
...
@@ -823,6 +835,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
connect
(
d
->
m_deployAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
deployProject
()));
connect
(
d
->
m_deployActionContextMenu
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
deployProjectContextMenu
()));
connect
(
d
->
m_deploySessionAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
deploySession
()));
connect
(
d
->
m_publishAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
publishProject
()));
connect
(
d
->
m_cleanProjectOnlyAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cleanProjectOnly
()));
connect
(
d
->
m_cleanAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cleanProject
()));
connect
(
d
->
m_cleanActionContextMenu
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cleanProjectContextMenu
()));
...
...
@@ -1023,6 +1036,19 @@ void ProjectExplorerPlugin::setStartupProject(Project *project)
updateActions
();
}
void
ProjectExplorerPlugin
::
publishProject
()
{
const
Project
*
const
project
=
d
->
m_session
->
startupProject
();
QTC_ASSERT
(
project
,
return
);
PublishingWizardSelectionDialog
selectionDialog
(
project
);
if
(
selectionDialog
.
exec
()
==
QDialog
::
Accepted
)
{
QWizard
*
const
publishingWizard
=
selectionDialog
.
createSelectedWizard
();
publishingWizard
->
exec
();
delete
publishingWizard
;
}
}
void
ProjectExplorerPlugin
::
savePersistentSettings
()
{
if
(
debug
)
...
...
@@ -1479,6 +1505,8 @@ void ProjectExplorerPlugin::updateActions()
d
->
m_cleanSessionAction
->
setEnabled
(
hasProjects
&&
!
building
);
d
->
m_cancelBuildAction
->
setEnabled
(
building
);
d
->
m_publishAction
->
setEnabled
(
hasProjects
);
d
->
m_projectSelectorAction
->
setEnabled
(
!
session
()
->
projects
().
isEmpty
());
d
->
m_projectSelectorActionMenu
->
setEnabled
(
!
session
()
->
projects
().
isEmpty
());
...
...
src/plugins/projectexplorer/projectexplorer.h
View file @
2993f898
...
...
@@ -206,6 +206,8 @@ private slots:
void
updateActions
();
void
loadCustomWizards
();
void
publishProject
();
#ifdef WITH_TESTS
void
testGccOutputParsers_data
();
void
testGccOutputParsers
();
...
...
src/plugins/projectexplorer/projectexplorer.pro
View file @
2993f898
...
...
@@ -96,7 +96,10 @@ HEADERS += projectexplorer.h \
taskhub
.
h
\
localapplicationruncontrol
.
h
\
customexecutableconfigurationwidget
.
h
\
sessionnodeimpl
.
h
sessionnodeimpl
.
h
\
publishing
/
publishingwizardselectiondialog
.
h
\
publishing
/
ipublishingwizardfactory
.
h
SOURCES
+=
projectexplorer
.
cpp
\
projectwindow
.
cpp
\
buildmanager
.
cpp
\
...
...
@@ -177,7 +180,9 @@ SOURCES += projectexplorer.cpp \
processparameters
.
cpp
\
localapplicationruncontrol
.
cpp
\
customexecutableconfigurationwidget
.
cpp
\
sessionnodeimpl
.
cpp
sessionnodeimpl
.
cpp
\
publishing
/
publishingwizardselectiondialog
.
cpp
FORMS
+=
processstep
.
ui
\
editorsettingspropertiespage
.
ui
\
runsettingspropertiespage
.
ui
\
...
...
@@ -187,7 +192,8 @@ FORMS += processstep.ui \
projectexplorersettingspage
.
ui
\
projectwelcomepagewidget
.
ui
\
targetsettingswidget
.
ui
\
doubletabwidget
.
ui
doubletabwidget
.
ui
\
publishing
/
publishingwizardselectiondialog
.
ui
equals
(
TEST
,
1
)
{
SOURCES
+=
\
...
...
src/plugins/projectexplorer/projectexplorerconstants.h
View file @
2993f898
...
...
@@ -57,6 +57,7 @@ const char * const DEPLOYPROJECTONLY = "ProjectExplorer.DeployProjectOnly";
const
char
*
const
DEPLOY
=
"ProjectExplorer.Deploy"
;
const
char
*
const
DEPLOYCM
=
"ProjectExplorer.DeployCM"
;
const
char
*
const
DEPLOYSESSION
=
"ProjectExplorer.DeploySession"
;
const
char
*
const
PUBLISH
=
"ProjectExplorer.Publish"
;
const
char
*
const
CLEANPROJECTONLY
=
"ProjectExplorer.CleanProjectOnly"
;
const
char
*
const
CLEAN
=
"ProjectExplorer.Clean"
;
const
char
*
const
CLEANCM
=
"ProjectExplorer.CleanCM"
;
...
...
src/plugins/projectexplorer/publishing/ipublishingwizardfactory.h
0 → 100644
View file @
2993f898
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef IPUBLISHING_WIZARD_FACTORY_H
#define IPUBLISHING_WIZARD_FACTORY_H
#include
<projectexplorer/projectexplorer_export.h>
#include
<extensionsystem/pluginmanager.h>
#include
<QtCore/QList>
#include
<QtGui/QWizard>
namespace
ProjectExplorer
{
class
Project
;
/*!
\class ProjectExplorer::IPublishingWizardFactory
\brief Provides an interface for creating wizards to publish a project.
A class implementing this interface is used to create an associated wizard
that allows users to publish their project to a remote facility, e.g. an
app store.
Such a wizard would typically transform the project's content into
a form expected by that facility ("packaging") and also upload it, if possible.
The factory objects have to be added to the global object pool via
\c ExtensionSystem::PluginManager::addObject().
\sa ExtensionSystem::PluginManager::addObject()
*/
class
PROJECTEXPLORER_EXPORT
IPublishingWizardFactory
:
public
QObject
{
Q_OBJECT
Q_DISABLE_COPY
(
IPublishingWizardFactory
)
public:
/*!
A short, one-line description of the type of wizard that this
factory can create.
*/
virtual
QString
displayName
()
const
=
0
;
/*!
A longer description explaining the exact purpose of the wizard
created by this factory.
*/
virtual
QString
description
()
const
=
0
;
/*!
Returns true iff the type of wizard that this factory can create
is available for the given project.
*/
virtual
bool
canCreateWizard
(
const
Project
*
project
)
const
=
0
;
/*!
Creates a wizard that can publish the given project.
Behavior is undefined if canCreateWizard() returns false for
that project.
\return The newly created publishing wizard
\sa canCreateWizard()
*/
virtual
QWizard
*
createWizard
(
const
Project
*
project
)
const
=
0
;
protected:
IPublishingWizardFactory
(
QObject
*
parent
=
0
)
:
QObject
(
parent
)
{}
};
}
// namespace ProjectExplorer
#endif // IPUBLISHING_WIZARD_FACTORY_H
src/plugins/projectexplorer/publishing/publishingwizardselectiondialog.cpp
0 → 100644
View file @
2993f898
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#include
"publishingwizardselectiondialog.h"
#include
"ui_publishingwizardselectiondialog.h"
#include
"ipublishingwizardfactory.h"
#include
<extensionsystem/pluginmanager.h>
#include
<projectexplorer/project.h>
#include
<utils/qtcassert.h>
#include
<QtGui/QPushButton>
namespace
ProjectExplorer
{
namespace
Internal
{
PublishingWizardSelectionDialog
::
PublishingWizardSelectionDialog
(
const
Project
*
project
,
QWidget
*
parent
)
:
QDialog
(
parent
),
ui
(
new
Ui
::
PublishingWizardSelectionDialog
),
m_project
(
project
)
{
ui
->
setupUi
(
this
);
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Ok
)
->
setText
(
tr
(
"Start Wizard"
));
const
QList
<
IPublishingWizardFactory
*>
&
factories
=
ExtensionSystem
::
PluginManager
::
instance
()
->
getObjects
<
IPublishingWizardFactory
>
();
foreach
(
const
IPublishingWizardFactory
*
const
factory
,
factories
)
{
if
(
factory
->
canCreateWizard
(
project
))
{
m_factories
<<
factory
;
ui
->
serviceComboBox
->
addItem
(
factory
->
displayName
());
}
}
if
(
!
m_factories
.
isEmpty
())
{
connect
(
ui
->
serviceComboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
SLOT
(
handleWizardIndexChanged
(
int
)));
ui
->
serviceComboBox
->
setCurrentIndex
(
0
);
handleWizardIndexChanged
(
ui
->
serviceComboBox
->
currentIndex
());
}
else
{
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Ok
)
->
setEnabled
(
false
);
ui
->
descriptionTextArea
->
appendHtml
(
QLatin1String
(
"<font color=
\"
red
\"
>"
)
+
tr
(
"Publishing is currently not possible for project '%1'."
)
.
arg
(
project
->
displayName
())
+
QLatin1String
(
"</font>"
));
}
}
PublishingWizardSelectionDialog
::~
PublishingWizardSelectionDialog
()
{
delete
ui
;
}
QWizard
*
PublishingWizardSelectionDialog
::
createSelectedWizard
()
const
{
return
m_factories
.
at
(
ui
->
serviceComboBox
->
currentIndex
())
->
createWizard
(
m_project
);
}
void
PublishingWizardSelectionDialog
::
handleWizardIndexChanged
(
int
index
)
{
ui
->
descriptionTextArea
->
setPlainText
(
m_factories
.
at
(
index
)
->
description
());
}
}
// namespace Internal
}
// namespace ProjectExplorer
src/plugins/projectexplorer/publishing/publishingwizardselectiondialog.h
0 → 100644
View file @
2993f898
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef PUBLISHINGWIZARDSELECTIONDIALOG_H
#define PUBLISHINGWIZARDSELECTIONDIALOG_H
#include
<QtCore/QList>
#include
<QtGui/QDialog>
QT_FORWARD_DECLARE_CLASS
(
QWizard
);
namespace
ProjectExplorer
{
class
IPublishingWizardFactory
;
class
Project
;
namespace
Internal
{
namespace
Ui
{
class
PublishingWizardSelectionDialog
;
}
class
PublishingWizardSelectionDialog
:
public
QDialog
{
Q_OBJECT
public:
explicit
PublishingWizardSelectionDialog
(
const
Project
*
project
,
QWidget
*
parent
=
0
);
~
PublishingWizardSelectionDialog
();
QWizard
*
createSelectedWizard
()
const
;
private
slots
:
void
handleWizardIndexChanged
(
int
index
);
private:
Ui
::
PublishingWizardSelectionDialog
*
ui
;
const
Project
*
const
m_project
;
QList
<
const
IPublishingWizardFactory
*>
m_factories
;
};
}
// namespace Internal
}
// namespace ProjectExplorer
#endif // PUBLISHINGWIZARDSELECTIONDIALOG_H
src/plugins/projectexplorer/publishing/publishingwizardselectiondialog.ui
0 → 100644
View file @
2993f898
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
ProjectExplorer::Internal::PublishingWizardSelectionDialog
</class>
<widget
class=
"QDialog"
name=
"ProjectExplorer::Internal::PublishingWizardSelectionDialog"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
409
</width>
<height>
330
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Publishing Wizard Selection
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Available Wizards:
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"serviceComboBox"
/>
</item>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget
class=
"QPlainTextEdit"
name=
"descriptionTextArea"
>
<property
name=
"readOnly"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>
buttonBox
</sender>
<signal>
accepted()
</signal>
<receiver>
ProjectExplorer::Internal::PublishingWizardSelectionDialog
</receiver>
<slot>
accept()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
248
</x>
<y>
254
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
157
</x>
<y>
274
</y>
</hint>
</hints>
</connection>
<connection>
<sender>
buttonBox
</sender>
<signal>
rejected()
</signal>
<receiver>
ProjectExplorer::Internal::PublishingWizardSelectionDialog
</receiver>
<slot>
reject()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
316
</x>
<y>
260
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
286
</x>
<y>
274
</y>
</hint>
</hints>
</connection>
</connections>
</ui>
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