forked from qt-creator/qt-creator
QtDesignStudio: Split "New Files" from "New Project"
Just having the "New Project" dialog there is confusing to many users and they do not know how to add new files. Upstream in master we can remove the condition and split the dialog also for Qt Creator. Task-number: QDS-5494 Change-Id: I9a21f27fad932759fcfc412ecfac7f3f6d2bcfee Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
This commit is contained in:
@@ -527,7 +527,9 @@ void MainWindow::registerDefaultActions()
|
||||
|
||||
// New File Action
|
||||
QIcon icon = QIcon::fromTheme(QLatin1String("document-new"), Utils::Icons::NEWFILE.icon());
|
||||
QString newActionText = isQtDesignStudio() ? tr("&New Project...") : tr("&New File or Project...");
|
||||
|
||||
const bool isQDS = isQtDesignStudio();
|
||||
const QString newActionText = isQDS ? tr("&New Project...") : tr("&New File or Project...");
|
||||
m_newAction = new QAction(icon, newActionText, this);
|
||||
cmd = ActionManager::registerAction(m_newAction, Constants::NEW);
|
||||
cmd->setDefaultKeySequence(QKeySequence::New);
|
||||
@@ -541,6 +543,24 @@ void MainWindow::registerDefaultActions()
|
||||
}
|
||||
});
|
||||
|
||||
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());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Open Action
|
||||
icon = QIcon::fromTheme(QLatin1String("document-open"), Utils::Icons::OPENFILE.icon());
|
||||
m_openAction = new QAction(icon, tr("&Open File or Project..."), this);
|
||||
|
||||
Reference in New Issue
Block a user