Split "New File or Project" into "File" and "Project" parts

This was non-standard to begin with, and splitting it makes it
possible to have different designs for New Project and New File dialogs
that are more tailored for the different needs (as is done in
Design Studio)

Change-Id: Ie6246e3c3f3527702c4562ec6f8fcbf5fae6c6ad
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Eike Ziller
2021-11-19 11:28:25 +01:00
parent 510ab1a659
commit d097314873
23 changed files with 66 additions and 61 deletions

View File

@@ -159,7 +159,7 @@
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New File} >
\uicontrol Modeling > \uicontrol Model > or
\uicontrol {Scratch Model} > \uicontrol Choose to create a model
or a scratch model.

View File

@@ -110,7 +110,7 @@
\li Select \uicontrol {Restart Now} to restart \QC and load the plugin.
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New File} >
\uicontrol {Files and Classes} > \uicontrol Modeling >
\uicontrol {State Chart} > \uicontrol Choose to create an empty
state chart and to open it in the SCXML editor.

View File

@@ -143,7 +143,10 @@
\li Open file or project
\li Ctrl+O
\row
\li New file or project
\li New project
\li Ctrl+Shift+N
\row
\li New file
\li Ctrl+N
\row
\li Open in external editor

View File

@@ -81,7 +81,7 @@
To create a Qt or Qt Quick test:
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New Project} >
\uicontrol {Other Project} > \uicontrol {Auto Test Project} >
\uicontrol Choose to create a project with boilerplate code for a
Qt test or a Qt Quick test.
@@ -126,7 +126,7 @@
To create a Google test:
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New Project} >
\uicontrol {Other Project} > \uicontrol {Auto Test Project} >
\uicontrol Choose to create a project with boilerplate code for a
Google test.
@@ -180,7 +180,7 @@
To create a Boost test:
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New Project} >
\uicontrol {Other Project} > \uicontrol {Auto Test Project} >
\uicontrol Choose to create a project with boilerplate code for a
Boost test.
@@ -221,7 +221,7 @@
To create a basic Catch2 test:
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New Project} >
\uicontrol {Other Project} > \uicontrol {Auto Test Project} >
\uicontrol Choose to create a project with boilerplate code for a
Catch2 test.

View File

@@ -326,8 +326,8 @@
\section1 Quickly write down notes somewhere
Select \uicontrol File > \uicontrol {New File or Project} >
\uicontrol {Files and Classes} > \uicontrol General > \uicontrol {Scratch Buffer}.
Select \uicontrol File > \uicontrol {New File} >
\uicontrol General > \uicontrol {Scratch Buffer}.
Alternatively, \key {Ctrl+N} can be used to open this dialog, which is
fully navigable via keyboard by using the up and down arrow keys and the
tab key.

View File

@@ -184,7 +184,7 @@
To create an application and run it on a MCU board:
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New Project} >
\uicontrol {Application (Qt for MCU)} >
\uicontrol {MCU Support Application} > \uicontrol Choose.
\li Follow the instructions of the wizard to create the project.

View File

@@ -226,7 +226,7 @@
This enables you to use \QC as a code editor.
\endtable
To create a new project, select \uicontrol File > \uicontrol{New File or Project} and
To create a new project, select \uicontrol File > \uicontrol{New Project} and
select the type of your project. The contents of the wizard dialogs depend
on the project type and the \l{glossary-buildandrun-kit}{kits} that you select in the
\uicontrol {Kit Selection} dialog. Follow the instructions of the wizard.
@@ -387,7 +387,7 @@
platform-independent mechanism for storing files in the application's
executable.
\image qtcreator-add-resource-wizard.png "New File or Project dialog"
\image qtcreator-add-resource-wizard.png "New File dialog"
The wizard creates a resource collection file (.qrc) that you can manage in
the resource editor.
@@ -472,7 +472,7 @@
must specify that qmake uses the \c subdirs template to build the project.
To create a root project, select \uicontrol File >
\uicontrol {New File or Project} > \uicontrol {Other Project} >
\uicontrol {New Project} > \uicontrol {Other Project} >
\uicontrol {Subdirs Project} > \uicontrol Choose.
On the \uicontrol Summary page, select \uicontrol {Finish & Add Subproject} to create
@@ -503,7 +503,7 @@
If you use a wizard regularly, you can bind a custom keyboard shortcut to
it. Triggering this keyboard shortcut will directly open the wizard without
the need to navigate to \uicontrol File > \uicontrol {New File or Project}.
the need to navigate to \uicontrol File > \uicontrol {New File} or \uicontrol {New Project}.
Keyboard shortcuts for wizards can be set in \uicontrol Tools >
\uicontrol Options > \uicontrol Environment > \uicontrol Keyboard >

View File

@@ -60,7 +60,7 @@
directories \QC searches wizards from.
\QC displays the wizards that it finds in the
\uicontrol {New File or Project} dialog. For each wizard, an icon (1), a
\uicontrol {New File} and \uicontrol {New Project} dialogs. For each wizard, an icon (1), a
display name (2), and a description (3) are displayed.
\image qtcreator-custom-wizard.png
@@ -126,7 +126,7 @@
\li \uicontrol {Factory.Reset}
\li Triggering this action makes \QC forget all wizard factories,
causing it to reload all wizard definitions when for example
opening \uicontrol File > \uicontrol {New File or Project}.
opening \uicontrol File > \uicontrol {New Project}.
This way you can avoid having to restart \QC for your changes to
a wizard definition to become visible.
\endtable

View File

@@ -51,7 +51,7 @@
\list 1
\li Select \uicontrol File > \uicontrol{New File or Project} > \uicontrol{Import Project}
\li Select \uicontrol File > \uicontrol{New Project} > \uicontrol{Import Project}
> \uicontrol{Import Existing Project}.
\li In \uicontrol{Import Existing Project}, enter the project name

View File

@@ -104,7 +104,7 @@
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New Project} >
\uicontrol Library > \uicontrol {C++ Library}.
\li Select \uicontrol Choose to open the \uicontrol {Project Location}

View File

@@ -71,8 +71,8 @@
managed with Nimble:
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\uicontrol Projects > \uicontrol {Non-Qt Project} >
\li Select \uicontrol File > \uicontrol {New Project} >
\uicontrol {Non-Qt Project} >
\uicontrol {Nimble Application}.
\li Specify the name and location of the application.
\li Select \uicontrol Next.

View File

@@ -77,8 +77,8 @@
To create a custom QML type:
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\uicontrol {Files and Classes} > \uicontrol Qt >
\li Select \uicontrol File > \uicontrol {New File} >
\uicontrol Qt >
\uicontrol {QML File (Qt Quick 2)}.
\li Select \uicontrol Choose to open the \uicontrol Location dialog.
\li In the \uicontrol {File name} field, enter a name for the custom

View File

@@ -36,7 +36,7 @@
\title Creating Qt Quick Projects
\image qmldesigner-new-project.png "New File or Project dialog"
\image qmldesigner-new-project.png "New Project dialog"
The following table lists the wizard templates for creating a new
Qt Quick project from scratch.
@@ -90,7 +90,7 @@
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New Project} >
\uicontrol {Application (Qt)} > \uicontrol {Qt Quick Application}
> \uicontrol Choose.
@@ -185,7 +185,7 @@
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New Project} >
\uicontrol {Other Project} > \uicontrol {Qt Quick UI Prototype}.
\li Select \uicontrol Choose to open the \uicontrol {Project Location}

View File

@@ -99,7 +99,7 @@
file:
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New Project} >
\uicontrol {Application (Qt)} > \uicontrol {Qt Quick Application} >
\uicontrol Choose.
\li In the \uicontrol {Build system} field, select \l qmake as the build

View File

@@ -105,7 +105,7 @@
in the submenu for the version control system.
To import a project that is under version control, choose \uicontrol File >
\uicontrol {New File or Project} > \uicontrol {Project from Version Control}
\uicontrol {New Project} > \uicontrol {Project from Version Control}
and select the version control system that you use. Follow the instructions
of the wizard to import the project.

View File

@@ -47,11 +47,11 @@
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New Project} >
\uicontrol {Application (Qt)} > \uicontrol {Qt Widgets Application}
> \uicontrol Choose.
\image qtcreator-new-qt-gui-application.png "New File or Project dialog"
\image qtcreator-new-qt-gui-application.png "New Project dialog"
The \uicontrol{Introduction and Project Location} dialog opens.
@@ -301,10 +301,10 @@
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New File} >
\uicontrol Qt > \uicontrol {Qt Resource File} > \uicontrol Choose.
\image qtcreator-add-resource-wizard.png "New File or Project dialog"
\image qtcreator-add-resource-wizard.png "New File dialog"
The \uicontrol {Choose the Location} dialog opens.

View File

@@ -61,7 +61,7 @@
\row
\li Add a new wizard.
\li You can extend the wizards in \uicontrol File >
\uicontrol {New File or Project} with your own file
\uicontrol {New File} and \uicontrol {New Project} with your own file
and project templates. We recommend that you create
JSON-based wizards instead of implementing new
wizards in C++ code.

View File

@@ -48,7 +48,7 @@
with.
\list 1
\li Select \uicontrol File > \uicontrol {New File or Project} >
\li Select \uicontrol File > \uicontrol {New Project} >
\uicontrol Library > \uicontrol {Qt Creator Plugin} >
\uicontrol Choose.

View File

@@ -44,7 +44,7 @@
the wizard does and what its UI looks like.
\li Providing a set of parameters that determine how the wizard shows up
in the list of wizards in the \uicontrol {New File or Project} dialog.
in the list of wizards in the \uicontrol {New File} or \uicontrol {New Project} dialog.
When deriving from Core::IWizardFactory, the constructor has to call
the following setters provided by the base class:
@@ -103,7 +103,7 @@
\section2 Setters and Getters of IWizardFactory
The setters and getters listed below determine how the wizard shows up
in the list of wizards in the \uicontrol {New File or Project} dialog.
in the list of wizards in the \uicontrol {New File} or \uicontrol {New Project} dialog.
\table
\header
@@ -151,6 +151,6 @@
\endtable
All wizards that have the same category set will be grouped together in the
\uicontrol {New File or Project} dialog.
\uicontrol {New File} or \uicontrol {New Project} dialog.
*/

View File

@@ -67,7 +67,7 @@
\section2 File and Project Templates
You can extend the wizards in \uicontrol File >
\uicontrol {New File or Project} with your own file and project templates by
\uicontrol {New File} or \uicontrol {New Project} with your own file and project templates by
writing JSON definition files for them.
\list
\li \l{https://doc.qt.io/qtcreator/creator-project-wizards.html}

View File

@@ -285,6 +285,8 @@ void NewDialogWidget::setWizardFactories(QList<IWizardFactory *> factories,
}
addItem(kindItem, factory);
}
if (filesKindItem->columnCount() == 0)
parentItem->removeRow(1);
if (projectKindItem->columnCount() == 0)
parentItem->removeRow(0);
}

View File

@@ -54,7 +54,7 @@
{Adding New Custom Wizards}.
The wizard interface is a very thin abstraction for the wizards in
\uicontrol File > \uicontrol {New File or Project}.
\uicontrol File > \uicontrol {New File} and \uicontrol{New Project}.
Basically, it defines what to show to the user in the wizard selection dialogs,
and a hook that is called if the user selects the wizard.

View File

@@ -528,38 +528,38 @@ void MainWindow::registerDefaultActions()
// New File Action
QIcon icon = QIcon::fromTheme(QLatin1String("document-new"), Utils::Icons::NEWFILE.icon());
const bool isQDS = isQtDesignStudio();
const QString newActionText = isQDS ? tr("&New Project...") : tr("&New File or Project...");
m_newAction = new QAction(icon, newActionText, this);
m_newAction = new QAction(icon, tr("&New Project..."), this);
cmd = ActionManager::registerAction(m_newAction, Constants::NEW);
cmd->setDefaultKeySequence(QKeySequence::New);
cmd->setDefaultKeySequence(QKeySequence("Ctrl+Shift+N"));
mfile->addAction(cmd, Constants::G_FILE_NEW);
connect(m_newAction, &QAction::triggered, this, []() {
if (!ICore::isNewItemDialogRunning()) {
ICore::showNewItemDialog(tr("New File or Project", "Title of dialog"),
IWizardFactory::allWizardFactories(), FilePath());
ICore::showNewItemDialog(
tr("New Project", "Title of dialog"),
Utils::filtered(Core::IWizardFactory::allWizardFactories(),
Utils::equal(&Core::IWizardFactory::kind,
Core::IWizardFactory::ProjectWizard)),
FilePath());
} else {
ICore::raiseWindow(ICore::newItemDialog());
}
});
if (isQDS) {
auto action = new QAction(icon, tr("New File..."), this);
cmd = ActionManager::registerAction(action, Constants::NEW_FILE);
mfile->addAction(cmd, Constants::G_FILE_NEW);
connect(action, &QAction::triggered, this, []() {
if (!ICore::isNewItemDialogRunning()) {
ICore::showNewItemDialog(
tr("New File", "Title of dialog"),
Utils::filtered(Core::IWizardFactory::allWizardFactories(),
Utils::equal(&Core::IWizardFactory::kind,
Core::IWizardFactory::FileWizard)),
FilePath());
} else {
ICore::raiseWindow(ICore::newItemDialog());
}
});
}
auto action = new QAction(icon, tr("New File..."), this);
cmd = ActionManager::registerAction(action, Constants::NEW_FILE);
cmd->setDefaultKeySequence(QKeySequence::New);
mfile->addAction(cmd, Constants::G_FILE_NEW);
connect(action, &QAction::triggered, this, []() {
if (!ICore::isNewItemDialogRunning()) {
ICore::showNewItemDialog(tr("New File", "Title of dialog"),
Utils::filtered(Core::IWizardFactory::allWizardFactories(),
Utils::equal(&Core::IWizardFactory::kind,
Core::IWizardFactory::FileWizard)),
FilePath());
} else {
ICore::raiseWindow(ICore::newItemDialog());
}
});
// Open Action
icon = QIcon::fromTheme(QLatin1String("document-open"), Utils::Icons::OPENFILE.icon());