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
20c0817a
Commit
20c0817a
authored
Mar 31, 2010
by
Jarek Kobus
Browse files
Replace QWizard with Utils::Wizard
parent
9408378a
Changes
49
Hide whitespace changes
Inline
Side-by-side
src/libs/utils/filewizarddialog.cpp
View file @
20c0817a
...
...
@@ -35,13 +35,14 @@
namespace
Utils
{
FileWizardDialog
::
FileWizardDialog
(
QWidget
*
parent
)
:
Q
Wizard
(
parent
),
Wizard
(
parent
),
m_filePage
(
new
FileWizardPage
)
{
setWindowFlags
(
windowFlags
()
&
~
Qt
::
WindowContextHelpButtonHint
);
setOption
(
QWizard
::
NoCancelButton
,
false
);
setOption
(
QWizard
::
NoDefaultButton
,
false
);
addPage
(
m_filePage
);
const
int
filePageId
=
addPage
(
m_filePage
);
wizardProgress
()
->
item
(
filePageId
)
->
setTitle
(
tr
(
"Location"
));
connect
(
m_filePage
,
SIGNAL
(
activated
()),
button
(
QWizard
::
FinishButton
),
SLOT
(
animateClick
()));
}
...
...
src/libs/utils/filewizarddialog.h
View file @
20c0817a
...
...
@@ -31,8 +31,7 @@
#define FILEWIZARDDIALOG_H
#include "utils_global.h"
#include <QtGui/QWizard>
#include "wizard.h"
namespace
Utils
{
...
...
@@ -43,7 +42,7 @@ class FileWizardPage;
and path. Custom pages can be added via Core::IWizardExtension.
*/
class
QTCREATOR_UTILS_EXPORT
FileWizardDialog
:
public
Q
Wizard
{
class
QTCREATOR_UTILS_EXPORT
FileWizardDialog
:
public
Wizard
{
Q_OBJECT
Q_DISABLE_COPY
(
FileWizardDialog
)
public:
...
...
src/libs/utils/filewizardpage.ui
View file @
20c0817a
...
...
@@ -11,7 +11,7 @@
</rect>
</property>
<property
name=
"title"
>
<string>
Choose the
l
ocation
</string>
<string>
Choose the
L
ocation
</string>
</property>
<layout
class=
"QFormLayout"
name=
"formLayout"
>
<item
row=
"0"
column=
"0"
>
...
...
@@ -37,17 +37,17 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>
Utils::FileNameValidatingLineEdit
</class>
<extends>
QLineEdit
</extends>
<header
location=
"global"
>
utils/filenamevalidatinglineedit.h
</header>
</customwidget>
<customwidget>
<class>
Utils::PathChooser
</class>
<extends>
QWidget
</extends>
<header>
pathchooser.h
</header>
<container>
1
</container>
</customwidget>
<customwidget>
<class>
Utils::FileNameValidatingLineEdit
</class>
<extends>
QLineEdit
</extends>
<header>
filenamevalidatinglineedit.h
</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
...
...
src/libs/utils/wizard.cpp
View file @
20c0817a
...
...
@@ -33,6 +33,7 @@
#include <QHBoxLayout>
#include <QMap>
#include <QHash>
#include <QVariant>
namespace
Utils
{
...
...
src/libs/utils/wizard.h
View file @
20c0817a
...
...
@@ -38,6 +38,7 @@
namespace
Utils
{
class
Wizard
;
class
WizardProgress
;
class
WizardPrivate
;
...
...
src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp
View file @
20c0817a
...
...
@@ -84,6 +84,13 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
setPage
(
ShadowBuildPageId
,
new
ShadowBuildPage
(
this
));
setPage
(
CMakeRunPageId
,
new
CMakeRunPage
(
this
));
Utils
::
WizardProgress
*
wp
=
wizardProgress
();
Utils
::
WizardProgressItem
*
inSourceItem
=
wp
->
item
(
InSourcePageId
);
Utils
::
WizardProgressItem
*
shadowBuildItem
=
wp
->
item
(
ShadowBuildPageId
);
Utils
::
WizardProgressItem
*
cmakeRunItem
=
wp
->
item
(
CMakeRunPageId
);
inSourceItem
->
setNextItems
(
QList
<
Utils
::
WizardProgressItem
*>
()
<<
cmakeRunItem
);
shadowBuildItem
->
setNextItems
(
QList
<
Utils
::
WizardProgressItem
*>
()
<<
cmakeRunItem
);
setStartId
(
startid
);
init
();
}
...
...
@@ -216,6 +223,7 @@ InSourceBuildPage::InSourceBuildPage(CMakeOpenProjectWizard *cmakeWizard)
"If you want a shadow build, clean your source directory and re-open the project."
)
.
arg
(
m_cmakeWizard
->
buildDirectory
()));
layout
()
->
addWidget
(
label
);
setTitle
(
tr
(
"Build Location"
));
}
...
...
@@ -239,6 +247,7 @@ ShadowBuildPage::ShadowBuildPage(CMakeOpenProjectWizard *cmakeWizard, bool chang
m_pc
->
setPath
(
m_cmakeWizard
->
buildDirectory
());
connect
(
m_pc
,
SIGNAL
(
changed
(
QString
)),
this
,
SLOT
(
buildDirectoryChanged
()));
fl
->
addRow
(
tr
(
"Build directory:"
),
m_pc
);
setTitle
(
tr
(
"Build Location"
));
}
void
ShadowBuildPage
::
buildDirectoryChanged
()
...
...
@@ -312,6 +321,7 @@ void CMakeRunPage::initWidgets()
pl
.
setVerticalStretch
(
1
);
m_output
->
setSizePolicy
(
pl
);
fl
->
addRow
(
m_output
);
setTitle
(
tr
(
"Run CMake"
));
}
void
CMakeRunPage
::
initializePage
()
...
...
src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h
View file @
20c0817a
...
...
@@ -31,13 +31,13 @@
#define CMAKEOPENPROJECTWIZARD_H
#include <projectexplorer/environment.h>
#include <utils/wizard.h>
#include <QtCore/QProcess>
#include <QtGui/QPushButton>
#include <QtGui/QComboBox>
#include <QtGui/QLineEdit>
#include <QtGui/QLabel>
#include <QtGui/QWizard>
#include <QtGui/QPlainTextEdit>
namespace
Utils
{
...
...
@@ -49,7 +49,7 @@ namespace Internal {
class
CMakeManager
;
class
CMakeOpenProjectWizard
:
public
Q
Wizard
class
CMakeOpenProjectWizard
:
public
Utils
::
Wizard
{
Q_OBJECT
public:
...
...
src/plugins/coreplugin/basefilewizard.cpp
View file @
20c0817a
...
...
@@ -569,6 +569,21 @@ void BaseFileWizard::setupWizard(QWizard *w)
w
->
setOption
(
QWizard
::
NoBackButtonOnStartPage
,
true
);
}
void
BaseFileWizard
::
applyExtensionPageShortTitle
(
Utils
::
Wizard
*
wizard
,
int
pageId
)
{
if
(
pageId
<
0
)
return
;
QWizardPage
*
p
=
wizard
->
page
(
pageId
);
if
(
!
p
)
return
;
Utils
::
WizardProgressItem
*
item
=
wizard
->
wizardProgress
()
->
item
(
pageId
);
if
(
!
item
)
return
;
const
QString
shortTitle
=
p
->
property
(
"shortTitle"
).
toString
();
if
(
!
shortTitle
.
isEmpty
())
item
->
setTitle
(
shortTitle
);
}
bool
BaseFileWizard
::
postGenerateFiles
(
const
QWizard
*
w
,
const
GeneratedFiles
&
l
,
QString
*
errorMessage
)
{
Q_UNUSED
(
w
);
...
...
@@ -691,7 +706,7 @@ QWizard *StandardFileWizard::createWizardDialog(QWidget *parent,
setupWizard
(
standardWizardDialog
);
standardWizardDialog
->
setPath
(
defaultPath
);
foreach
(
QWizardPage
*
p
,
extensionPages
)
standardWizardDialog
->
addPage
(
p
);
BaseFileWizard
::
applyExtensionPageShortTitle
(
standardWizardDialog
,
standardWizardDialog
->
addPage
(
p
)
)
;
return
standardWizardDialog
;
}
...
...
src/plugins/coreplugin/basefilewizard.h
View file @
20c0817a
...
...
@@ -44,6 +44,10 @@ class QWizardPage;
class
QDebug
;
QT_END_NAMESPACE
namespace
Utils
{
class
Wizard
;
}
namespace
Core
{
class
IEditor
;
...
...
@@ -172,6 +176,9 @@ public:
// Sets some standard options on a QWizard
static
void
setupWizard
(
QWizard
*
);
// Read "shortTitle" dynamic property of the pageId and apply it as the title of corresponding progress item
static
void
applyExtensionPageShortTitle
(
Utils
::
Wizard
*
wizard
,
int
pageId
);
protected:
typedef
QList
<
QWizardPage
*>
WizardPageList
;
...
...
src/plugins/cppeditor/cppclasswizard.cpp
View file @
20c0817a
...
...
@@ -60,7 +60,7 @@ ClassNamePage::ClassNamePage(QWidget *parent) :
QWizardPage
(
parent
),
m_isValid
(
false
)
{
setTitle
(
tr
(
"Enter
c
lass
n
ame"
));
setTitle
(
tr
(
"Enter
C
lass
N
ame"
));
setSubTitle
(
tr
(
"The header and source file names will be derived from the class name"
));
m_newClassWidget
=
new
Utils
::
NewClassWidget
;
...
...
@@ -133,12 +133,13 @@ void ClassNamePage::slotValidChanged()
}
CppClassWizardDialog
::
CppClassWizardDialog
(
QWidget
*
parent
)
:
Q
Wizard
(
parent
),
Utils
::
Wizard
(
parent
),
m_classNamePage
(
new
ClassNamePage
(
this
))
{
Core
::
BaseFileWizard
::
setupWizard
(
this
);
setWindowTitle
(
tr
(
"C++ Class Wizard"
));
addPage
(
m_classNamePage
);
const
int
classNameId
=
addPage
(
m_classNamePage
);
wizardProgress
()
->
item
(
classNameId
)
->
setTitle
(
tr
(
"Details"
));
}
void
CppClassWizardDialog
::
setPath
(
const
QString
&
path
)
...
...
@@ -183,7 +184,7 @@ QWizard *CppClassWizard::createWizardDialog(QWidget *parent,
{
CppClassWizardDialog
*
wizard
=
new
CppClassWizardDialog
(
parent
);
foreach
(
QWizardPage
*
p
,
extensionPages
)
wizard
->
addPage
(
p
);
BaseFileWizard
::
applyExtensionPageShortTitle
(
wizard
,
wizard
->
addPage
(
p
)
)
;
wizard
->
setPath
(
defaultPath
);
return
wizard
;
}
...
...
src/plugins/cppeditor/cppclasswizard.h
View file @
20c0817a
...
...
@@ -31,10 +31,10 @@
#define CPPCLASSWIZARD_H
#include <coreplugin/basefilewizard.h>
#include <utils/wizard.h>
#include <QtCore/QStringList>
#include <QtGui/QWizardPage>
#include <QtGui/QWizard>
namespace
Utils
{
...
...
@@ -77,7 +77,7 @@ struct CppClassWizardParameters
int
classType
;
};
class
CppClassWizardDialog
:
public
Q
Wizard
class
CppClassWizardDialog
:
public
Utils
::
Wizard
{
Q_OBJECT
Q_DISABLE_COPY
(
CppClassWizardDialog
)
...
...
src/plugins/cvs/checkoutwizardpage.cpp
View file @
20c0817a
...
...
@@ -35,6 +35,7 @@ namespace Internal {
CheckoutWizardPage
::
CheckoutWizardPage
(
QWidget
*
parent
)
:
VCSBase
::
BaseCheckoutWizardPage
(
parent
)
{
setTitle
(
tr
(
"Location"
));
setSubTitle
(
tr
(
"Specify repository and path."
));
setRepositoryLabel
(
tr
(
"Repository:"
));
setDirectoryVisible
(
false
);
...
...
src/plugins/designer/cpp/formclasswizarddialog.cpp
View file @
20c0817a
...
...
@@ -32,6 +32,8 @@
#include "formclasswizardpage.h"
#include "formclasswizardparameters.h"
#include <coreplugin/basefilewizard.h>
#include <QtCore/QDebug>
#include <QtGui/QAbstractButton>
...
...
@@ -43,20 +45,22 @@ namespace Internal {
// ----------------- FormClassWizardDialog
FormClassWizardDialog
::
FormClassWizardDialog
(
const
WizardPageList
&
extensionPages
,
QWidget
*
parent
)
:
Q
Wizard
(
parent
),
Utils
::
Wizard
(
parent
),
m_formPage
(
new
FormTemplateWizardPage
),
m_classPage
(
new
FormClassWizardPage
)
{
setWindowTitle
(
tr
(
"Qt Designer Form Class"
));
setPage
(
FormPageId
,
m_formPage
);
wizardProgress
()
->
item
(
FormPageId
)
->
setTitle
(
tr
(
"Form Template"
));
connect
(
m_formPage
,
SIGNAL
(
templateActivated
()),
button
(
QWizard
::
NextButton
),
SLOT
(
animateClick
()));
setPage
(
ClassPageId
,
m_classPage
);
wizardProgress
()
->
item
(
ClassPageId
)
->
setTitle
(
tr
(
"Class Details"
));
foreach
(
QWizardPage
*
p
,
extensionPages
)
addPage
(
p
);
Core
::
BaseFileWizard
::
applyExtensionPageShortTitle
(
this
,
addPage
(
p
)
)
;
}
QString
FormClassWizardDialog
::
path
()
const
...
...
src/plugins/designer/cpp/formclasswizarddialog.h
View file @
20c0817a
...
...
@@ -30,7 +30,7 @@
#ifndef FORMCLASSWIZARDDIALOG_H
#define FORMCLASSWIZARDDIALOG_H
#include <
QtGui/QW
izard>
#include <
utils/w
izard
.h
>
namespace
Designer
{
...
...
@@ -42,7 +42,7 @@ namespace Internal {
class
FormClassWizardPage
;
class
FormTemplateWizardPage
;
class
FormClassWizardDialog
:
public
Q
Wizard
class
FormClassWizardDialog
:
public
Utils
::
Wizard
{
Q_DISABLE_COPY
(
FormClassWizardDialog
)
Q_OBJECT
...
...
src/plugins/designer/cpp/formclasswizardpage.ui
View file @
20c0817a
...
...
@@ -11,7 +11,7 @@
</rect>
</property>
<property
name=
"title"
>
<string>
Choose a
c
lass
n
ame
</string>
<string>
Choose a
C
lass
N
ame
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"0"
>
...
...
@@ -21,7 +21,7 @@
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<item>
<widget
class=
"Utils::NewClassWidget"
name=
"newClassWidget"
/>
<widget
class=
"Utils::NewClassWidget"
name=
"newClassWidget"
native=
"true"
/>
</item>
</layout>
</widget>
...
...
@@ -62,7 +62,4 @@
</customwidgets>
<resources/>
<connections/>
<buttongroups>
<buttongroup
name=
"buttonGroup"
/>
</buttongroups>
</ui>
src/plugins/designer/formtemplatewizardpage.cpp
View file @
20c0817a
...
...
@@ -59,7 +59,7 @@ FormTemplateWizardPage::FormTemplateWizardPage(QWidget * parent) :
m_newFormWidget
(
QDesignerNewFormWidgetInterface
::
createNewFormWidget
(
FormEditorW
::
instance
()
->
designerEditor
())),
m_templateSelected
(
m_newFormWidget
->
hasCurrentTemplate
())
{
setTitle
(
tr
(
"Choose a
f
orm
t
emplate"
));
setTitle
(
tr
(
"Choose a
F
orm
T
emplate"
));
QVBoxLayout
*
layout
=
new
QVBoxLayout
;
connect
(
m_newFormWidget
,
SIGNAL
(
currentTemplateChanged
(
bool
)),
...
...
src/plugins/designer/formwizarddialog.cpp
View file @
20c0817a
...
...
@@ -48,7 +48,7 @@ namespace Internal {
// ----------------- FormWizardDialog
FormWizardDialog
::
FormWizardDialog
(
const
WizardPageList
&
extensionPages
,
QWidget
*
parent
)
:
Q
Wizard
(
parent
),
:
Utils
::
Wizard
(
parent
),
m_formPage
(
new
FormTemplateWizardPage
)
{
init
(
extensionPages
);
...
...
@@ -59,11 +59,15 @@ void FormWizardDialog::init(const WizardPageList &extensionPages)
Core
::
BaseFileWizard
::
setupWizard
(
this
);
setWindowTitle
(
tr
(
"Qt Designer Form"
));
setPage
(
FormPageId
,
m_formPage
);
wizardProgress
()
->
item
(
FormPageId
)
->
setTitle
(
tr
(
"Form Template"
));
if
(
!
extensionPages
.
empty
())
{
int
id
=
FirstExtensionPageId
;
foreach
(
QWizardPage
*
p
,
extensionPages
)
setPage
(
id
++
,
p
);
foreach
(
QWizardPage
*
p
,
extensionPages
)
{
setPage
(
id
,
p
);
Core
::
BaseFileWizard
::
applyExtensionPageShortTitle
(
this
,
id
);
id
++
;
}
}
}
...
...
@@ -82,6 +86,7 @@ FormFileWizardDialog::FormFileWizardDialog(const WizardPageList &extensionPages,
m_filePage
(
new
Utils
::
FileWizardPage
)
{
setPage
(
FilePageId
,
m_filePage
);
wizardProgress
()
->
item
(
FilePageId
)
->
setTitle
(
tr
(
"Location"
));
connect
(
m_filePage
,
SIGNAL
(
activated
()),
button
(
QWizard
::
FinishButton
),
SLOT
(
animateClick
()));
...
...
src/plugins/designer/formwizarddialog.h
View file @
20c0817a
...
...
@@ -30,7 +30,7 @@
#ifndef FORMWIZARDDIALOG_H
#define FORMWIZARDDIALOG_H
#include <
QtGui/QW
izard>
#include <
utils/w
izard
.h
>
namespace
Utils
{
class
FileWizardPage
;
...
...
@@ -44,7 +44,7 @@ class FormTemplateWizardPage;
// Single-Page Wizard for new forms offering all types known to Qt Designer.
// To be used for Mode "CreateNewEditor" [not currently used]
class
FormWizardDialog
:
public
Q
Wizard
class
FormWizardDialog
:
public
Utils
::
Wizard
{
Q_DISABLE_COPY
(
FormWizardDialog
)
Q_OBJECT
...
...
src/plugins/genericprojectmanager/genericprojectwizard.cpp
View file @
20c0817a
...
...
@@ -51,7 +51,7 @@ using namespace Utils;
//////////////////////////////////////////////////////////////////////////////
GenericProjectWizardDialog
::
GenericProjectWizardDialog
(
QWidget
*
parent
)
:
Q
Wizard
(
parent
)
:
Utils
::
Wizard
(
parent
)
{
setWindowTitle
(
tr
(
"Import Existing Project"
));
...
...
@@ -61,7 +61,8 @@ GenericProjectWizardDialog::GenericProjectWizardDialog(QWidget *parent)
m_firstPage
->
setFileNameLabel
(
tr
(
"Project name:"
));
m_firstPage
->
setPathLabel
(
tr
(
"Location:"
));
addPage
(
m_firstPage
);
const
int
firstPageId
=
addPage
(
m_firstPage
);
wizardProgress
()
->
item
(
firstPageId
)
->
setTitle
(
tr
(
"Location"
));
}
GenericProjectWizardDialog
::~
GenericProjectWizardDialog
()
...
...
@@ -111,7 +112,7 @@ QWizard *GenericProjectWizard::createWizardDialog(QWidget *parent,
wizard
->
setPath
(
defaultPath
);
foreach
(
QWizardPage
*
p
,
extensionPages
)
wizard
->
addPage
(
p
);
BaseFileWizard
::
applyExtensionPageShortTitle
(
wizard
,
wizard
->
addPage
(
p
)
)
;
return
wizard
;
}
...
...
src/plugins/genericprojectmanager/genericprojectwizard.h
View file @
20c0817a
...
...
@@ -31,8 +31,7 @@
#define GENERICPROJECTWIZARD_H
#include <coreplugin/basefilewizard.h>
#include <QtGui/QWizard>
#include <utils/wizard.h>
QT_BEGIN_NAMESPACE
class
QFileInfo
;
...
...
@@ -48,7 +47,7 @@ class FileWizardPage;
namespace
GenericProjectManager
{
namespace
Internal
{
class
GenericProjectWizardDialog
:
public
Q
Wizard
class
GenericProjectWizardDialog
:
public
Utils
::
Wizard
{
Q_OBJECT
...
...
Prev
1
2
3
Next
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