From 679d15f4844dd3aeeb3fa2dbc93d9626ed511316 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Thu, 12 Mar 2009 13:44:37 +0100 Subject: [PATCH] Fixes: Remove "Class" prefix from UI-classes generated by the gui app wizards; give new item dialog home path as default when creating files out of project contexts. --- share/qtcreator/templates/qt4project/mywidget_form.cpp | 2 +- share/qtcreator/templates/qt4project/mywidget_form.h | 4 ++-- share/qtcreator/templates/qt4project/widget.ui | 2 +- src/plugins/coreplugin/mainwindow.cpp | 9 +++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/share/qtcreator/templates/qt4project/mywidget_form.cpp b/share/qtcreator/templates/qt4project/mywidget_form.cpp index 33b14afab8e..b7e3ae6200b 100644 --- a/share/qtcreator/templates/qt4project/mywidget_form.cpp +++ b/share/qtcreator/templates/qt4project/mywidget_form.cpp @@ -2,7 +2,7 @@ #include "%UI_HDR%" %CLASS%::%CLASS%(QWidget *parent) - : %BASECLASS%(parent), ui(new Ui::%CLASS%Class) + : %BASECLASS%(parent), ui(new Ui::%CLASS%) { ui->setupUi(this); } diff --git a/share/qtcreator/templates/qt4project/mywidget_form.h b/share/qtcreator/templates/qt4project/mywidget_form.h index fd4d3732772..7293a8b17d6 100644 --- a/share/qtcreator/templates/qt4project/mywidget_form.h +++ b/share/qtcreator/templates/qt4project/mywidget_form.h @@ -5,7 +5,7 @@ namespace Ui { - class %CLASS%Class; + class %CLASS%; } class %CLASS% : public %BASECLASS% @@ -17,7 +17,7 @@ public: ~%CLASS%(); private: - Ui::%CLASS%Class *ui; + Ui::%CLASS% *ui; }; #endif // %PRE_DEF% diff --git a/share/qtcreator/templates/qt4project/widget.ui b/share/qtcreator/templates/qt4project/widget.ui index 91d5fa37d59..f4e94939e46 100644 --- a/share/qtcreator/templates/qt4project/widget.ui +++ b/share/qtcreator/templates/qt4project/widget.ui @@ -1,6 +1,6 @@ <ui version="4.0"> <class>%CLASS%Class</class> - <widget class="%BASECLASS%" name="%CLASS%Class" > + <widget class="%BASECLASS%" name="%CLASS%" > <property name="geometry" > <rect> <x>0</x> diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index aea62962134..5e2914df46d 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -65,6 +65,7 @@ #include "basefilewizard.h" #include <coreplugin/findplaceholder.h> +#include <utils/pathchooser.h> #include <extensionsystem/pluginmanager.h> #include <QtCore/QDebug> @@ -836,10 +837,10 @@ QStringList MainWindow::showNewItemDialog(const QString &title, const QString &defaultLocation) { QString defaultDir = defaultLocation; - if (defaultDir.isEmpty()) { - if (!m_coreImpl->fileManager()->currentFile().isEmpty()) - defaultDir = QFileInfo(m_coreImpl->fileManager()->currentFile()).absolutePath(); - } + if (defaultDir.isEmpty() && !m_coreImpl->fileManager()->currentFile().isEmpty()) + defaultDir = QFileInfo(m_coreImpl->fileManager()->currentFile()).absolutePath(); + if (defaultDir.isEmpty()) + defaultDir = Core::Utils::PathChooser::homePath(); // Scan for wizards matching the filter and pick one. Don't show // dialog if there is only one. -- GitLab