diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp index 1fee41925293393c20bdb255209a6c0e94624374..626c888d9ebf7762625a5b5b6483065385e9b315 100644 --- a/src/libs/cplusplus/pp-engine.cpp +++ b/src/libs/cplusplus/pp-engine.cpp @@ -1,4 +1,5 @@ -/** +/************************************************************************** +** ** This file is part of Qt Creator ** ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). diff --git a/src/libs/utils/codegeneration.cpp b/src/libs/utils/codegeneration.cpp index 14448ea4b750f41c0ddbf1d9967391eb9e1cc907..7e019b67c2200af39b5170f2491010cb6c367ecd 100644 --- a/src/libs/utils/codegeneration.cpp +++ b/src/libs/utils/codegeneration.cpp @@ -41,11 +41,14 @@ static QString toAlphaNum(const QString &s) QString rc; const int len = s.size(); const QChar underscore = QLatin1Char('_'); + const QChar dot = QLatin1Char('.'); for (int i = 0; i < len; i++) { const QChar c = s.at(i); if (c == underscore || c.isLetterOrNumber()) rc += c; + else if (c == dot) + rc += underscore; } return rc; } @@ -80,7 +83,6 @@ QString writeOpeningNameSpaces(const QStringList &l, const QString &indent, str << rc << "namespace " << l.at(i) << " {\n"; rc += indent; } - str << '\n'; } return rc; } diff --git a/src/libs/utils/process_stub_unix.c b/src/libs/utils/process_stub_unix.c index e49bea8d51de60cca07f38ed68a2527f6a85aaed..92c38bb5f0d30070ee1ff43339250a0b259327d0 100644 --- a/src/libs/utils/process_stub_unix.c +++ b/src/libs/utils/process_stub_unix.c @@ -1,35 +1,31 @@ -/*************************************************************************** +/************************************************************************** ** ** This file is part of Qt Creator ** -** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Qt Software Information (qt-info@nokia.com) ** +** Commercial Usage ** -** Non-Open Source 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. ** -** Licensees may use this file in accordance with the Qt Beta Version -** License Agreement, Agreement version 2.2 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 ** -** GNU 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. ** -** Alternatively, this file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the packaging -** of this file. Please review the following information to ensure GNU -** General Public Licensing requirements will be met: +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. ** -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt GPL Exception -** version 1.3, included in the file GPL_EXCEPTION.txt in this package. -** -***************************************************************************/ +**************************************************************************/ #include <sys/types.h> #include <sys/stat.h> diff --git a/src/libs/utils/process_stub_win.c b/src/libs/utils/process_stub_win.c index 0ca484eb751324712e417cd0a87d7e6aa4263736..961f1d5ae08d0041e8addbae74c7a99988648df5 100644 --- a/src/libs/utils/process_stub_win.c +++ b/src/libs/utils/process_stub_win.c @@ -1,35 +1,31 @@ -/*************************************************************************** +/************************************************************************** ** ** This file is part of Qt Creator ** -** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). ** ** Contact: Qt Software Information (qt-info@nokia.com) ** +** Commercial Usage ** -** Non-Open Source 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. ** -** Licensees may use this file in accordance with the Qt Beta Version -** License Agreement, Agreement version 2.2 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 ** -** GNU 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. ** -** Alternatively, this file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the packaging -** of this file. Please review the following information to ensure GNU -** General Public Licensing requirements will be met: +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. ** -** http://www.fsf.org/licensing/licenses/info/GPLv2.html and -** http://www.gnu.org/copyleft/gpl.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt GPL Exception -** version 1.3, included in the file GPL_EXCEPTION.txt in this package. -** -***************************************************************************/ +**************************************************************************/ #define _WIN32_WINNT 0x0501 /* WinXP, needed for DebugActiveProcessStop() */ diff --git a/src/libs/utils/submiteditorwidget.cpp b/src/libs/utils/submiteditorwidget.cpp index b9c8259020b99a993a195de2c45c76fbfb8a0015..687813c197b68508cd4b6a070e75817c38e46e80 100644 --- a/src/libs/utils/submiteditorwidget.cpp +++ b/src/libs/utils/submiteditorwidget.cpp @@ -44,6 +44,7 @@ #include <QtGui/QSpacerItem> enum { debug = 0 }; +enum { defaultLineWidth = 72 }; namespace Core { namespace Utils { @@ -131,6 +132,7 @@ struct SubmitEditorWidgetPrivate typedef QPair<QString, QLineEdit*> FieldEntry; QList<FieldEntry> m_fieldEntries; QSignalMapper *m_fieldSignalMapper; + int m_lineWidth; }; SubmitEditorWidgetPrivate::SubmitEditorWidgetPrivate() : @@ -139,7 +141,8 @@ SubmitEditorWidgetPrivate::SubmitEditorWidgetPrivate() : m_fileNameColumn(1), m_activatedRow(-1), m_fieldLayout(0), - m_fieldSignalMapper(0) + m_fieldSignalMapper(0), + m_lineWidth(defaultLineWidth) { } @@ -149,6 +152,7 @@ SubmitEditorWidget::SubmitEditorWidget(QWidget *parent) : { m_d->m_ui.setupUi(this); m_d->m_ui.description->setContextMenuPolicy(Qt::CustomContextMenu); + m_d->m_ui.description->setLineWrapMode(QTextEdit::NoWrap); connect(m_d->m_ui.description, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(editorCustomContextMenuRequested(QPoint))); @@ -189,7 +193,7 @@ void SubmitEditorWidget::registerActions(QAction *editorUndoAction, QAction *ed int count = 0; if (const QAbstractItemModel *model = m_d->m_ui.fileView->model()) count = model->rowCount(); - qDebug() << submitAction << count << "items" << m_d->m_filesChecked; + qDebug() << Q_FUNC_INFO << submitAction << count << "items" << m_d->m_filesChecked; } submitAction->setEnabled(m_d->m_filesChecked); connect(this, SIGNAL(fileCheckStateChanged(bool)), submitAction, SLOT(setEnabled(bool))); @@ -226,17 +230,34 @@ void SubmitEditorWidget::unregisterActions(QAction *editorUndoAction, QAction * } } -QString SubmitEditorWidget::trimmedDescriptionText() const +// Make sure we have one terminating NL +static inline QString trimMessageText(const QString &t) { - // Make sure we have one terminating NL - QString text = descriptionText().trimmed(); - text += QLatin1Char('\n'); - return text; + QString rc = t.trimmed(); + rc += QLatin1Char('\n'); + return rc; +} + +// Extract the wrapped text from a text edit, which performs +// the wrapping only optically. +static QString wrappedText(const QTextEdit *e) +{ + const QChar newLine = QLatin1Char('\n'); + QString rc; + QTextCursor cursor(e->document()); + cursor.movePosition(QTextCursor::Start); + while (!cursor.atEnd()) { + cursor.select(QTextCursor::LineUnderCursor); + rc += cursor.selectedText(); + rc += newLine; + cursor.movePosition(QTextCursor::Right); + } + return rc; } QString SubmitEditorWidget::descriptionText() const { - QString rc = m_d->m_ui.description->toPlainText(); + QString rc = trimMessageText(lineWrap() ? wrappedText(m_d->m_ui.description) : m_d->m_ui.description->toPlainText()); // append field entries foreach(const SubmitEditorWidgetPrivate::FieldEntry &fe, m_d->m_fieldEntries) { const QString fieldText = fe.second->text().trimmed(); @@ -255,6 +276,39 @@ void SubmitEditorWidget::setDescriptionText(const QString &text) m_d->m_ui.description->setPlainText(text); } +bool SubmitEditorWidget::lineWrap() const +{ + return m_d->m_ui.description->lineWrapMode() != QTextEdit::NoWrap; +} + +void SubmitEditorWidget::setLineWrap(bool v) +{ + if (debug) + qDebug() << Q_FUNC_INFO << v; + if (v) { + m_d->m_ui.description->setLineWrapColumnOrWidth(m_d->m_lineWidth); + m_d->m_ui.description->setLineWrapMode(QTextEdit::FixedColumnWidth); + } else { + m_d->m_ui.description->setLineWrapMode(QTextEdit::NoWrap); + } +} + +int SubmitEditorWidget::lineWrapWidth() const +{ + return m_d->m_lineWidth; +} + +void SubmitEditorWidget::setLineWrapWidth(int v) +{ + if (debug) + qDebug() << Q_FUNC_INFO << v << lineWrap(); + if (m_d->m_lineWidth == v) + return; + m_d->m_lineWidth = v; + if (lineWrap()) + m_d->m_ui.description->setLineWrapColumnOrWidth(v); +} + int SubmitEditorWidget::fileNameColumn() const { return m_d->m_fileNameColumn; @@ -332,7 +386,7 @@ QStringList SubmitEditorWidget::checkedFiles() const return rc; } -QPlainTextEdit *SubmitEditorWidget::descriptionEdit() const +QTextEdit *SubmitEditorWidget::descriptionEdit() const { return m_d->m_ui.description; } diff --git a/src/libs/utils/submiteditorwidget.h b/src/libs/utils/submiteditorwidget.h index e77da4379e56d2c351f811be1f8741a60cb4173b..9ed5ecfb115d01d7a3f8b409a29749b11ca20c16 100644 --- a/src/libs/utils/submiteditorwidget.h +++ b/src/libs/utils/submiteditorwidget.h @@ -36,7 +36,7 @@ #include <QtGui/QAbstractItemView> QT_BEGIN_NAMESPACE -class QPlainTextEdit; +class QTextEdit; class QListWidgetItem; class QAction; class QAbstractItemModel; @@ -74,6 +74,8 @@ class QWORKBENCH_UTILS_EXPORT SubmitEditorWidget : public QWidget Q_PROPERTY(QString descriptionText READ descriptionText WRITE setDescriptionText DESIGNABLE true) Q_PROPERTY(int fileNameColumn READ fileNameColumn WRITE setFileNameColumn DESIGNABLE false) Q_PROPERTY(QAbstractItemView::SelectionMode fileListSelectionMode READ fileListSelectionMode WRITE setFileListSelectionMode DESIGNABLE true) + Q_PROPERTY(bool lineWrap READ lineWrap WRITE setLineWrap DESIGNABLE true) + Q_PROPERTY(int lineWrapWidth READ lineWrapWidth WRITE setLineWrapWidth DESIGNABLE true) public: explicit SubmitEditorWidget(QWidget *parent = 0); virtual ~SubmitEditorWidget(); @@ -85,12 +87,16 @@ public: QString descriptionText() const; void setDescriptionText(const QString &text); - // Should be used to normalize newlines. - QString trimmedDescriptionText() const; int fileNameColumn() const; void setFileNameColumn(int c); + bool lineWrap() const; + void setLineWrap(bool); + + int lineWrapWidth() const; + void setLineWrapWidth(int); + QAbstractItemView::SelectionMode fileListSelectionMode() const; void setFileListSelectionMode(QAbstractItemView::SelectionMode sm); @@ -103,7 +109,7 @@ public: // Selected files for diff QStringList selectedFiles() const; - QPlainTextEdit *descriptionEdit() const; + QTextEdit *descriptionEdit() const; void addDescriptionEditContextMenuAction(QAction *a); void insertDescriptionEditContextMenuAction(int pos, QAction *a); diff --git a/src/libs/utils/submiteditorwidget.ui b/src/libs/utils/submiteditorwidget.ui index 2067cad4487dbafbf69f1de5651adb4242c6fec0..7015a2c75b4d6c22ca7b77c094e4a292010d12c2 100644 --- a/src/libs/utils/submiteditorwidget.ui +++ b/src/libs/utils/submiteditorwidget.ui @@ -24,7 +24,11 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QPlainTextEdit" name="description"/> + <widget class="QTextEdit" name="description"> + <property name="acceptRichText"> + <bool>false</bool> + </property> + </widget> </item> </layout> </widget> diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp index 4803f26b9f12dc5a59c6f3f4e10cf4ee43ff9688..6907864e62d8c39719f1467d18c57dd00c435b26 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #include "cmakeopenprojectwizard.h" #include "cmakeprojectmanager.h" diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h index 8d7e212620dd8d876ced4539648106ab52ddbc53..4f8c4a726b0671ec4933639bffb2451385eaebff 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #ifndef CMAKEOPENPROJECTWIZARD_H #define CMAKEOPENPROJECTWIZARD_H diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index de9742e0e4e9428358ce7bcaec5c0bef7a1cd8d8..e97d2b7f0073fb932d03280774ffc981dc91b57b 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -84,7 +84,7 @@ void CMakeProject::parseCMakeLists() { QString sourceDirectory = QFileInfo(m_fileName).absolutePath(); QString cbpFile = CMakeManager::findCbpFile(buildDirectory(activeBuildConfiguration())); - m_rootNode->setFolderName(QFileInfo(cbpFile).baseName()); + m_rootNode->setFolderName(QFileInfo(cbpFile).completeBaseName()); CMakeCbpParser cbpparser; qDebug()<<"Parsing file "<<cbpFile; if (cbpparser.parseCbpFile(cbpFile)) { diff --git a/src/plugins/cppeditor/cppclasswizard.cpp b/src/plugins/cppeditor/cppclasswizard.cpp index d56875e213ca9ea8cdd3232634ea91648a96b561..ad574af51f1f92134c2ff9899400440c6a0e78d6 100644 --- a/src/plugins/cppeditor/cppclasswizard.cpp +++ b/src/plugins/cppeditor/cppclasswizard.cpp @@ -230,19 +230,20 @@ bool CppClassWizard::generateHeaderAndSource(const CppClassWizardParameters &par // == Header file == QTextStream headerStr(header); headerStr << "#ifndef " << guard - << "\n#define " << guard << '\n' << '\n'; + << "\n#define " << guard << '\n'; const QRegExp qtClassExpr(QLatin1String("^Q[A-Z3].+")); QTC_ASSERT(qtClassExpr.isValid(), /**/); const bool superIsQtClass = qtClassExpr.exactMatch(params.baseClass); if (superIsQtClass) { - Core::Utils::writeIncludeFileDirective(params.baseClass, true, headerStr); headerStr << '\n'; + Core::Utils::writeIncludeFileDirective(params.baseClass, true, headerStr); } - const QString namespaceIndent = Core::Utils::writeOpeningNameSpaces(namespaceList, 0, headerStr); + const QString namespaceIndent = Core::Utils::writeOpeningNameSpaces(namespaceList, QString(), headerStr); // Class declaration + headerStr << '\n'; headerStr << namespaceIndent << "class " << unqualifiedClassName; if (!params.baseClass.isEmpty()) headerStr << " : public " << params.baseClass << "\n"; @@ -251,21 +252,23 @@ bool CppClassWizard::generateHeaderAndSource(const CppClassWizardParameters &par headerStr << namespaceIndent << "{\n"; headerStr << namespaceIndent << "public:\n" << namespaceIndent << indent << unqualifiedClassName << "();\n"; - headerStr << namespaceIndent << "};\n\n"; + headerStr << namespaceIndent << "};\n"; + + Core::Utils::writeClosingNameSpaces(namespaceList, QString(), headerStr); - Core::Utils::writeClosingNameSpaces(namespaceList, 0, headerStr); + headerStr << '\n'; headerStr << "#endif // "<< guard << '\n'; // == Source file == QTextStream sourceStr(source); Core::Utils::writeIncludeFileDirective(params.headerFile, false, sourceStr); - Core::Utils::writeOpeningNameSpaces(namespaceList, 0, sourceStr); + Core::Utils::writeOpeningNameSpaces(namespaceList, QString(), sourceStr); // Constructor sourceStr << '\n' << namespaceIndent << unqualifiedClassName << "::" << unqualifiedClassName << "()\n"; sourceStr << namespaceIndent << "{\n" << namespaceIndent << "}\n"; - Core::Utils::writeClosingNameSpaces(namespaceList, indent, sourceStr); + Core::Utils::writeClosingNameSpaces(namespaceList, QString(), sourceStr); return true; } diff --git a/src/plugins/cppeditor/cppfilewizard.cpp b/src/plugins/cppeditor/cppfilewizard.cpp index 2683e2f6c23613c5a1f460284806fbe5eb1ccb6c..ddaf9a88cd3ea0115723755ff228902340ae7021 100644 --- a/src/plugins/cppeditor/cppfilewizard.cpp +++ b/src/plugins/cppeditor/cppfilewizard.cpp @@ -67,7 +67,7 @@ Core::GeneratedFiles CppFileWizard::generateFilesFromPath(const QString &path, QString CppFileWizard::fileContents(FileType type, const QString &fileName) const { - const QString baseName = QFileInfo(fileName).baseName(); + const QString baseName = QFileInfo(fileName).completeBaseName(); QString contents; QTextStream str(&contents); switch (type) { @@ -79,7 +79,9 @@ QString CppFileWizard::fileContents(FileType type, const QString &fileName) cons } break; case Source: - str << QLatin1String("#include \"") << baseName << '.' << preferredSuffix(QLatin1String(Constants::CPP_HEADER_MIMETYPE)) << QLatin1String("\"\n\n"); + str << QLatin1String("#include \"") << baseName + << '.' << preferredSuffix(QLatin1String(Constants::CPP_HEADER_MIMETYPE)) + << QLatin1String("\"\n\n"); break; } return contents; diff --git a/src/plugins/designer/cpp/formclasswizardparameters.cpp b/src/plugins/designer/cpp/formclasswizardparameters.cpp index c7f7407e92588ed568cfa9675ebcfc122cf32968..c21dbb2b7c40dbcb520cd42fe91408542f028cc7 100644 --- a/src/plugins/designer/cpp/formclasswizardparameters.cpp +++ b/src/plugins/designer/cpp/formclasswizardparameters.cpp @@ -76,7 +76,7 @@ bool FormClassWizardParameters::generateCpp(QString *header, QString *source, in const QString guard = Core::Utils::headerGuard(headerFile); QString uiInclude = QLatin1String("ui_"); - uiInclude += QFileInfo(uiFile).baseName(); + uiInclude += QFileInfo(uiFile).completeBaseName(); uiInclude += QLatin1String(".h"); // 1) Header file diff --git a/src/plugins/designer/workbenchintegration.cpp b/src/plugins/designer/workbenchintegration.cpp index 4e264e7a7193cad8b6e9b3add8d9cfabf9c2ae6c..bfdef2054438e63c104c77c4b4e65ff29d6ca887 100644 --- a/src/plugins/designer/workbenchintegration.cpp +++ b/src/plugins/designer/workbenchintegration.cpp @@ -448,7 +448,7 @@ static Document::Ptr addDefinition(const CPlusPlus::Snapshot &docTable, return Document::Ptr(); QFileInfo headerFI(headerFileName); - const QString headerBaseName = headerFI.baseName(); + const QString headerBaseName = headerFI.completeBaseName(); const QString headerAbsolutePath = headerFI.absolutePath(); foreach (const Document::Ptr &doc, docList) { const QFileInfo sourceFI(doc->fileName()); @@ -562,7 +562,7 @@ bool WorkbenchIntegration::navigateToSlot(const QString &objectName, // be generating the ui_<>.h file for it, and the .pro file knows what the generated file's name and its absolute path will be. // So we should somehow get that info from project manager (?) const QFileInfo fi(currentUiFile); - const QString uicedName = QLatin1String("ui_") + fi.baseName() + QLatin1String(".h"); + const QString uicedName = QLatin1String("ui_") + fi.completeBaseName() + QLatin1String(".h"); // take all docs, find the ones that include the ui_xx.h. diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp index c0f497c062dfdb542bad5fb58e09ceb008f49857..0825fb80e6dd801f49f089b781289bb44476d121 100644 --- a/src/plugins/genericprojectmanager/genericproject.cpp +++ b/src/plugins/genericprojectmanager/genericproject.cpp @@ -115,7 +115,7 @@ GenericProject::GenericProject(Manager *manager, const QString &fileName) QFileInfo fileInfo(m_fileName); QDir dir = fileInfo.dir(); - m_projectName = fileInfo.baseName(); + m_projectName = fileInfo.completeBaseName(); m_filesFileName = QFileInfo(dir, m_projectName + QLatin1String(".files")).absoluteFilePath(); m_includesFileName = QFileInfo(dir, m_projectName + QLatin1String(".includes")).absoluteFilePath(); m_configFileName = QFileInfo(dir, m_projectName + QLatin1String(".config")).absoluteFilePath(); diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp index 5577176dca134bcd4ae507a8ca4e92138f45356e..74d3fc16da681240778fd6d55389aa3c44f64a89 100644 --- a/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp +++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.cpp @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #include "genericprojectfileseditor.h" #include "genericprojectmanager.h" #include "genericprojectconstants.h" diff --git a/src/plugins/genericprojectmanager/genericprojectfileseditor.h b/src/plugins/genericprojectmanager/genericprojectfileseditor.h index 18d1d2663605a8bea52bb92597e4f92a8376af56..a3aed60f561d1a77873988860f9da8b467ee9ab4 100644 --- a/src/plugins/genericprojectmanager/genericprojectfileseditor.h +++ b/src/plugins/genericprojectmanager/genericprojectfileseditor.h @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #ifndef GENERICPROJECTFILESEDITOR_H #define GENERICPROJECTFILESEDITOR_H diff --git a/src/plugins/genericprojectmanager/genericprojectnodes.cpp b/src/plugins/genericprojectmanager/genericprojectnodes.cpp index 016ada7f47a23cf725722c42dbbb930c1ccf960c..64a73f6f0f8d6d92858f5a23c10e7c2db227549d 100644 --- a/src/plugins/genericprojectmanager/genericprojectnodes.cpp +++ b/src/plugins/genericprojectmanager/genericprojectnodes.cpp @@ -43,7 +43,7 @@ GenericProjectNode::GenericProjectNode(GenericProject *project, Core::IFile *pro m_project(project), m_projectFile(projectFile) { - setFolderName(QFileInfo(projectFile->fileName()).baseName()); + setFolderName(QFileInfo(projectFile->fileName()).completeBaseName()); } GenericProjectNode::~GenericProjectNode() diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.cpp b/src/plugins/genericprojectmanager/genericprojectwizard.cpp index 7c3185e148b05e8264e00bd88166df68608ee42e..780ce46858668ad296294e4dc3d3c862f69676fb 100644 --- a/src/plugins/genericprojectmanager/genericprojectwizard.cpp +++ b/src/plugins/genericprojectmanager/genericprojectwizard.cpp @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #include "genericprojectwizard.h" #include <coreplugin/icore.h> diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.h b/src/plugins/genericprojectmanager/genericprojectwizard.h index 73cf61e82c8a027359f6735c4d48bb13059838ef..ffbb74d5420c66a87f50652bc6f559c4014f0ef0 100644 --- a/src/plugins/genericprojectmanager/genericprojectwizard.h +++ b/src/plugins/genericprojectmanager/genericprojectwizard.h @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #ifndef GENERICPROJECTWIZARD_H #define GENERICPROJECTWIZARD_H diff --git a/src/plugins/genericprojectmanager/pkgconfigtool.cpp b/src/plugins/genericprojectmanager/pkgconfigtool.cpp index 2ee63acf8d84debbc41fa9dad603d5feba1143cd..2e862faaecd592ff59bb06bb3ec97c7fe6081f38 100644 --- a/src/plugins/genericprojectmanager/pkgconfigtool.cpp +++ b/src/plugins/genericprojectmanager/pkgconfigtool.cpp @@ -1,5 +1,34 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ #include "pkgconfigtool.h" + #include <QProcess> #include <QTextStream> #include <QtDebug> diff --git a/src/plugins/genericprojectmanager/pkgconfigtool.h b/src/plugins/genericprojectmanager/pkgconfigtool.h index cbd474eb58207a88f94ec1accd5a94f3087c64ea..0cbdf1204f0ac0c7e02cbebc0a1800dcfc06cc8b 100644 --- a/src/plugins/genericprojectmanager/pkgconfigtool.h +++ b/src/plugins/genericprojectmanager/pkgconfigtool.h @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #ifndef PKGCONFIGTOOL_H #define PKGCONFIGTOOL_H diff --git a/src/plugins/git/branchdialog.cpp b/src/plugins/git/branchdialog.cpp index f348ac0188165eb92e9936119611748c42aea130..ee561e3b7e5c1ff1d02aaba2e2a9053cf7fe8e1a 100644 --- a/src/plugins/git/branchdialog.cpp +++ b/src/plugins/git/branchdialog.cpp @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #include "branchdialog.h" #include "branchmodel.h" #include "gitclient.h" diff --git a/src/plugins/git/branchdialog.h b/src/plugins/git/branchdialog.h index dcad691d6048f45348930015cf75e263615a64a6..6cf9869d270a5b92184000c24678a7a598d25376 100644 --- a/src/plugins/git/branchdialog.h +++ b/src/plugins/git/branchdialog.h @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #ifndef BRANCHDIALOG_H #define BRANCHDIALOG_H diff --git a/src/plugins/git/branchmodel.cpp b/src/plugins/git/branchmodel.cpp index 23c597b204e112c03fcb45e125ce3a4dbfcbd3bd..d0cd0f37d93d3701b1c208cb872cec17ecb395a8 100644 --- a/src/plugins/git/branchmodel.cpp +++ b/src/plugins/git/branchmodel.cpp @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #include "branchmodel.h" #include "gitclient.h" diff --git a/src/plugins/git/branchmodel.h b/src/plugins/git/branchmodel.h index 54c4c698a77dca667273f5604c9a3d51247ee9db..ec13af6d2054e44a6fba194b10a08d81ec69efc6 100644 --- a/src/plugins/git/branchmodel.h +++ b/src/plugins/git/branchmodel.h @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #ifndef BRANCHMODEL_H #define BRANCHMODEL_H diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 2c043404019ae1203628a3ebfe8b1855b895fef4..93e387d0ded80f72994762d40aaf5348eef71343 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -695,20 +695,22 @@ bool GitPlugin::editorAboutToClose(Core::IEditor *iEditor) const QStringList fileList = editor->checkedFiles(); if (Git::Constants::debug) qDebug() << Q_FUNC_INFO << fileList; + bool closeEditor = true; if (!fileList.empty()) { // get message & commit m_core->fileManager()->blockFileChange(fileIFace); fileIFace->save(); m_core->fileManager()->unblockFileChange(fileIFace); - m_gitClient->addAndCommit(m_submitRepository, - editor->panelData(), - m_changeTmpFile->fileName(), - fileList, - m_submitOrigCommitFiles); + closeEditor = m_gitClient->addAndCommit(m_submitRepository, + editor->panelData(), + m_changeTmpFile->fileName(), + fileList, + m_submitOrigCommitFiles); } - cleanChangeTmpFile(); - return true; + if (closeEditor) + cleanChangeTmpFile(); + return closeEditor; } void GitPlugin::pull() @@ -822,7 +824,7 @@ void GitPlugin::updateActions() if (m_projectExplorer) { if (Node *node = m_projectExplorer->currentNode()) if (Node *projectNode = node->projectNode()) - project = '"' + QFileInfo(projectNode->path()).baseName() + '"'; + project = '"' + QFileInfo(projectNode->path()).completeBaseName() + '"'; } enabled = !project.isEmpty(); diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 25ea4524a6c74c6880f7b331983bd1cb24c5eb45..a3112da078bfbfc6f477c4928ddfa39a62eacc73 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -517,16 +517,14 @@ void PerforcePlugin::submit() m_changeTmpFile = new QTemporaryFile(this); if (!m_changeTmpFile->open()) { showOutput(tr("Cannot create temporary file."), true); - delete m_changeTmpFile; - m_changeTmpFile = 0; + cleanChangeTmpFile(); return; } PerforceResponse result = runP4Cmd(QStringList()<< QLatin1String("change") << QLatin1String("-o"), QStringList(), CommandToWindow|StdErrToWindow|ErrorToWindow); if (result.error) { - delete m_changeTmpFile; - m_changeTmpFile = 0; + cleanChangeTmpFile(); return; } @@ -539,8 +537,7 @@ void PerforcePlugin::submit() PerforceResponse result2 = runP4Cmd(QStringList(QLatin1String("fstat")), nativeFiles, CommandToWindow|StdErrToWindow|ErrorToWindow); if (result2.error) { - delete m_changeTmpFile; - m_changeTmpFile = 0; + cleanChangeTmpFile(); return; } @@ -552,8 +549,7 @@ void PerforcePlugin::submit() } if (depotFileNames.isEmpty()) { showOutput(tr("Project has no files")); - delete m_changeTmpFile; - m_changeTmpFile = 0; + cleanChangeTmpFile(); return; } @@ -959,6 +955,16 @@ void PerforcePlugin::submitCurrentLog() em->closeEditors(QList<Core::IEditor*>() << em->currentEditor()); } +void PerforcePlugin::cleanChangeTmpFile() +{ + if (m_changeTmpFile) { + if (m_changeTmpFile->isOpen()) + m_changeTmpFile->close(); + delete m_changeTmpFile; + m_changeTmpFile = 0; + } +} + bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor) { if (!m_changeTmpFile || !editor) @@ -989,14 +995,13 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor) fileIFace->save(); core->fileManager()->unblockFileChange(fileIFace); if (answer == VCSBase::VCSBaseSubmitEditor::SubmitConfirmed) { + m_changeTmpFile->seek(0); QByteArray change = m_changeTmpFile->readAll(); - m_changeTmpFile->close(); if (!checkP4Command()) { showOutput(tr("No p4 executable specified!"), true); - delete m_changeTmpFile; - m_changeTmpFile = 0; return false; } + QProcess proc; proc.setEnvironment(environment()); @@ -1006,8 +1011,6 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor) if (!proc.waitForStarted(p4Timeout)) { showOutput(tr("Cannot execute p4 submit."), true); QApplication::restoreOverrideCursor(); - delete m_changeTmpFile; - m_changeTmpFile = 0; return false; } proc.write(change); @@ -1016,8 +1019,6 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor) if (!proc.waitForFinished()) { showOutput(tr("Cannot execute p4 submit."), true); QApplication::restoreOverrideCursor(); - delete m_changeTmpFile; - m_changeTmpFile = 0; return false; } const QString output = QString::fromUtf8(proc.readAll()); @@ -1027,9 +1028,7 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor) } QApplication::restoreOverrideCursor(); } - m_changeTmpFile->close(); - delete m_changeTmpFile; - m_changeTmpFile = 0; + cleanChangeTmpFile(); } return true; } diff --git a/src/plugins/perforce/perforceplugin.h b/src/plugins/perforce/perforceplugin.h index 8ac7188994ec5857a5b7d116b608210e9b6a3a54..4191d30e8b2b8f704fa96966d3b11c1c5ab9e928 100644 --- a/src/plugins/perforce/perforceplugin.h +++ b/src/plugins/perforce/perforceplugin.h @@ -167,6 +167,7 @@ private: void showOutput(const QString &output, bool popup = false) const; void annotate(const QString &fileName); void filelog(const QString &fileName); + void cleanChangeTmpFile(); ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; PerforceOutputWindow *m_perforceOutputWindow; diff --git a/src/plugins/perforce/perforcesubmiteditor.cpp b/src/plugins/perforce/perforcesubmiteditor.cpp index 98a9a511acbfc783787da57b77a9a0c207abefbf..ba1aee15aa7c8efaccb65d2543b55cc6fa55536b 100644 --- a/src/plugins/perforce/perforcesubmiteditor.cpp +++ b/src/plugins/perforce/perforcesubmiteditor.cpp @@ -152,9 +152,10 @@ void PerforceSubmitEditor::updateEntries() const QString newLine = QString(QLatin1Char('\n')); const QString tab = QString(QLatin1Char('\t')); - QStringList lines = submitEditorWidget()->trimmedDescriptionText().split(newLine); - while (lines.last().isEmpty()) - lines.removeLast(); + QStringList lines = submitEditorWidget()->descriptionText().split(newLine); + + while (!lines.empty() && lines.last().isEmpty()) + lines.removeLast(); // Description lines.replaceInStrings(QRegExp(QLatin1String("^")), tab); m_entries.insert(QLatin1String("Description"), newLine + lines.join(newLine) + QLatin1String("\n\n")); diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index d7d4d93d62b9a89517aa9699ae30c783b244512c..54d46e2e5bfdf9fe3ff575175455ee6677fd4905 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -1106,7 +1106,7 @@ QString SessionManager::lastSession() const { QSettings *settings = m_core->settings(); QString fileName = settings->value("ProjectExplorer/StartupSession").toString(); - return QFileInfo(fileName).baseName(); + return QFileInfo(fileName).completeBaseName(); } SessionNode *SessionManager::sessionNode() const diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp index e827a5a3d425de346b33d3e4f760be1993a0d7aa..97ea6a7b394d8d68b23279a095a316ad78bd7593 100644 --- a/src/plugins/projectexplorer/toolchain.cpp +++ b/src/plugins/projectexplorer/toolchain.cpp @@ -1,5 +1,35 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #include "toolchain.h" #include "cesdkhandler.h" + #include <QtCore/QFileInfo> #include <QtCore/QProcess> #include <QtCore/QDebug> @@ -28,7 +58,6 @@ ToolChain::ToolChain() ToolChain::~ToolChain() { - } ToolChain *ToolChain::createGccToolChain(const QString &gcc) diff --git a/src/plugins/projectexplorer/toolchain.h b/src/plugins/projectexplorer/toolchain.h index 813092d7bc1e48c3ba5e22a64120a0a45907850d..9356b7afe40bf7782207397e3cda09b7e0974599 100644 --- a/src/plugins/projectexplorer/toolchain.h +++ b/src/plugins/projectexplorer/toolchain.h @@ -1,3 +1,32 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (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 qt-sales@nokia.com. +** +**************************************************************************/ + #ifndef TOOLCHAIN_H #define TOOLCHAIN_H diff --git a/src/plugins/qt4projectmanager/projectloadwizard.cpp b/src/plugins/qt4projectmanager/projectloadwizard.cpp index 170dff878046c558f2f863c1a3388ad890d135b4..91ee513e0a18c76a77c40facfe7199fa0b0b6dba 100644 --- a/src/plugins/qt4projectmanager/projectloadwizard.cpp +++ b/src/plugins/qt4projectmanager/projectloadwizard.cpp @@ -30,29 +30,14 @@ #include "projectloadwizard.h" #include "qt4project.h" -#include "qtversionmanager.h" #include "qt4projectmanager.h" #include "qmakestep.h" #include "makestep.h" -#include <QtCore/QVariant> -#include <QtGui/QAction> -#include <QtGui/QApplication> -#include <QtGui/QButtonGroup> #include <QtGui/QCheckBox> -#include <QtGui/QComboBox> -#include <QtGui/QFileDialog> -#include <QtGui/QFormLayout> -#include <QtGui/QHBoxLayout> #include <QtGui/QHeaderView> #include <QtGui/QLabel> -#include <QtGui/QLineEdit> -#include <QtGui/QListWidget> -#include <QtGui/QRadioButton> -#include <QtGui/QSpacerItem> -#include <QtGui/QToolButton> #include <QtGui/QVBoxLayout> -#include <QtGui/QWizard> #include <QtGui/QWizardPage> using namespace Qt4ProjectManager; diff --git a/src/plugins/qt4projectmanager/projectloadwizard.h b/src/plugins/qt4projectmanager/projectloadwizard.h index 8e8d25a9b6ee94914da55116d74823be4bfa4eaf..b6d886fe1501d89277817a45a01d507e488149ec 100644 --- a/src/plugins/qt4projectmanager/projectloadwizard.h +++ b/src/plugins/qt4projectmanager/projectloadwizard.h @@ -30,34 +30,27 @@ #ifndef PROJECTLOADWIZARD_H #define PROJECTLOADWIZARD_H -#include "qt4project.h" +#include "qtversionmanager.h" #include <QtGui/QWizard> QT_BEGIN_NAMESPACE class QWizardPage; -class QVBoxLayout; -class QHBoxLayout; class QLabel; class QCheckBox; -class QRadioButton; -class QListWidget; -class QLineEdit; -class QToolButton; -class QSpacerItem; -class QFormLayout; -class QComboBox; QT_END_NAMESPACE namespace Qt4ProjectManager { + class Qt4Project; + namespace Internal { class ProjectLoadWizard : public QWizard { Q_OBJECT public: - ProjectLoadWizard(Qt4ProjectManager::Qt4Project *project, QWidget * parent = 0, Qt::WindowFlags flags = 0); + ProjectLoadWizard(Qt4Project *project, QWidget * parent = 0, Qt::WindowFlags flags = 0); virtual ~ProjectLoadWizard(); virtual int nextId() const; virtual void done(int result); diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index e2a9ea8d9d280e5d3f617825516264b313fed0ab..686e6d42cb6999b9f5bc07437789fd020445c32a 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -91,7 +91,7 @@ Qt4PriFileNode::Qt4PriFileNode(Qt4Project *project, Qt4ProFileNode* qt4ProFileNo m_fileWatcher(new FileWatcher(this)) { Q_ASSERT(project); - setFolderName(QFileInfo(filePath).baseName()); + setFolderName(QFileInfo(filePath).completeBaseName()); static QIcon dirIcon; if (dirIcon.isNull()) { @@ -771,7 +771,7 @@ void Qt4ProFileNode::updateUiFiles(const QString &buildDirectory) QStringList newFilePaths; foreach (FileNode *uiFile, uiFiles) { const QString uiHeaderFilePath - = QString("%1/ui_%2.h").arg(uiDir, QFileInfo(uiFile->path()).baseName()); + = QString("%1/ui_%2.h").arg(uiDir, QFileInfo(uiFile->path()).completeBaseName()); if (QFileInfo(uiHeaderFilePath).exists()) newFilePaths << uiHeaderFilePath; } diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index f77bc917c409246b6353b8d9e26a0ccc63ee8beb..fea2b436ee0fb003a0549eacf9449acd5b1f1610 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -51,7 +51,7 @@ using ProjectExplorer::ApplicationRunConfiguration; using ProjectExplorer::PersistentSettingsReader; using ProjectExplorer::PersistentSettingsWriter; -Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, QString proFilePath) +Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, const QString &proFilePath) : ApplicationRunConfiguration(pro), m_proFilePath(proFilePath), m_runMode(Gui), @@ -61,10 +61,10 @@ Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, QString proFilePath) m_workingDirectoryLabel(0), m_cachedTargetInformationValid(false) { - setName(tr("Qt4RunConfiguration")); - if (!m_proFilePath.isEmpty()) { - setName(QFileInfo(m_proFilePath).baseName()); - } + if (!m_proFilePath.isEmpty()) + setName(QFileInfo(m_proFilePath).completeBaseName()); + else + setName(tr("Qt4RunConfiguration")); connect(pro, SIGNAL(activeBuildConfigurationChanged()), this, SLOT(invalidateCachedTargetInformation())); @@ -72,7 +72,6 @@ Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, QString proFilePath) Qt4RunConfiguration::~Qt4RunConfiguration() { - } QString Qt4RunConfiguration::type() const @@ -217,7 +216,7 @@ void Qt4RunConfiguration::restore(const PersistentSettingsReader &reader) if (!m_proFilePath.isEmpty()) { m_cachedTargetInformationValid = false; if (!m_userSetName) - setName(QFileInfo(m_proFilePath).baseName()); + setName(QFileInfo(m_proFilePath).completeBaseName()); } } @@ -462,5 +461,5 @@ QStringList Qt4RunConfigurationFactoryUser::canCreate(ProjectExplorer::Project * QString Qt4RunConfigurationFactoryUser::nameForType(const QString &type) const { QString fileName = type.mid(QString("Qt4RunConfiguration.").size()); - return QFileInfo(fileName).baseName(); + return QFileInfo(fileName).completeBaseName(); } diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.h b/src/plugins/qt4projectmanager/qt4runconfiguration.h index 7828270a5c7b3871405d144795431f8a9b6e2561..30ff16a294fbe2d6540faeb9d5425e006daa2b90 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.h +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.h @@ -57,7 +57,7 @@ class Qt4RunConfiguration : public ProjectExplorer::ApplicationRunConfiguration // to change the name and arguments friend class Qt4RunConfigurationWidget; public: - Qt4RunConfiguration(Qt4Project *pro, QString proFilePath); + Qt4RunConfiguration(Qt4Project *pro, const QString &proFilePath); virtual ~Qt4RunConfiguration(); virtual QString type() const; diff --git a/src/plugins/qt4projectmanager/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h index 63e2d30c42f06aab87823bcdb4162918a94207d5..7252a698cd4c5b07f44d6cb16870d3f78eb52859 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.h +++ b/src/plugins/qt4projectmanager/qtversionmanager.h @@ -36,7 +36,6 @@ #include <projectexplorer/projectexplorer.h> #include <projectexplorer/toolchain.h> -#include <QtCore/QDebug> #include <QtCore/QPointer> #include <QtGui/QWidget> @@ -45,7 +44,8 @@ namespace Internal { class QtDirWidget; -class QtVersion { +class QtVersion +{ friend class QtDirWidget; //for changing name and path friend class QtVersionManager; public: diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 064bb086938adfd48dac153f30ee0232900c14d3..11ad9c2531e10d7a05a9c7791bcdc29c46587588 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -483,15 +483,17 @@ bool SubversionPlugin::editorAboutToClose(Core::IEditor *iEditor) } const QStringList fileList = editor->checkedFiles(); + bool closeEditor = true; if (!fileList.empty()) { // get message & commit Core::ICore::instance()->fileManager()->blockFileChange(fileIFace); fileIFace->save(); Core::ICore::instance()->fileManager()->unblockFileChange(fileIFace); - commit(m_changeTmpFile->fileName(), fileList); + closeEditor= commit(m_changeTmpFile->fileName(), fileList); } - cleanChangeTmpFile(); - return true; + if (closeEditor) + cleanChangeTmpFile(); + return closeEditor; } void SubversionPlugin::diffFiles(const QStringList &files) diff --git a/src/plugins/vcsbase/nicknamedialog.cpp b/src/plugins/vcsbase/nicknamedialog.cpp index d6a10ad30297d98830f0d4543c074d35bc74779c..ad694c1aa85bafd1b2e0e00a04ad85bbbb6e4388 100644 --- a/src/plugins/vcsbase/nicknamedialog.cpp +++ b/src/plugins/vcsbase/nicknamedialog.cpp @@ -28,7 +28,6 @@ **************************************************************************/ #include "nicknamedialog.h" -#include "vcsbaseplugin.h" #include "ui_nicknamedialog.h" #include <QtCore/QDebug> @@ -120,13 +119,18 @@ QString NickNameEntry::nickName() const QList<QStandardItem *> NickNameEntry::toModelRow() const { const QVariant nickNameData = nickName(); + const Qt::ItemFlags flags = Qt::ItemIsSelectable|Qt::ItemIsEnabled; QStandardItem *i1 = new QStandardItem(name); + i1->setFlags(flags); i1->setData(nickNameData, NickNameRole); QStandardItem *i2 = new QStandardItem(email); + i1->setFlags(flags); i2->setData(nickNameData, NickNameRole); QStandardItem *i3 = new QStandardItem(aliasName); + i3->setFlags(flags); i3->setData(nickNameData, NickNameRole); QStandardItem *i4 = new QStandardItem(aliasEmail); + i4->setFlags(flags); i4->setData(nickNameData, NickNameRole); QList<QStandardItem *> row; row << i1 << i2 << i3 << i4; @@ -145,31 +149,10 @@ QDebug operator<<(QDebug d, const NickNameEntry &e) return d; } -// Globally cached model tacked onto the plugin. -static QStandardItemModel *nickModel() -{ - static QStandardItemModel *model = 0; - if (!model) { - model = new QStandardItemModel(VCSBasePlugin::instance()); - QStringList headers; - headers << NickNameDialog::tr("Name") - << NickNameDialog::tr("E-mail") - << NickNameDialog::tr("Alias") - << NickNameDialog::tr("Alias e-mail"); - model->setHorizontalHeaderLabels(headers); - } - return model; -} - -static inline void clearModel(QStandardItemModel *model) -{ - if (const int rowCount = model->rowCount()) - model->removeRows(0, rowCount); -} - -NickNameDialog::NickNameDialog(QWidget *parent) : +NickNameDialog::NickNameDialog(QStandardItemModel *model, QWidget *parent) : QDialog(parent), m_ui(new Ui::NickNameDialog), + m_model(model), m_filterModel(new QSortFilterProxyModel(this)) { setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); @@ -177,7 +160,7 @@ NickNameDialog::NickNameDialog(QWidget *parent) : okButton()->setEnabled(false); // Populate model and grow tree to accommodate it - m_filterModel->setSourceModel(nickModel()); + m_filterModel->setSourceModel(model); m_filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive); m_ui->filterTreeView->setModel(m_filterModel); const int columnCount = m_filterModel->columnCount(); @@ -221,26 +204,35 @@ QString NickNameDialog::nickName() const const QModelIndex index = m_ui->filterTreeView->selectionModel()->currentIndex(); if (index.isValid()) { const QModelIndex sourceIndex = m_filterModel->mapToSource(index); - if (const QStandardItem *item = nickModel()->itemFromIndex(sourceIndex)) + if (const QStandardItem *item = m_model->itemFromIndex(sourceIndex)) return NickNameEntry::nickNameOf(item); } return QString(); } -void NickNameDialog::clearNickNames() +QStandardItemModel *NickNameDialog::createModel(QObject *parent) { - clearModel(nickModel()); + QStandardItemModel *model = new QStandardItemModel(parent); + QStringList headers; + headers << tr("Name") << tr("E-mail") + << tr("Alias") << tr("Alias e-mail"); + model->setHorizontalHeaderLabels(headers); + return model; } -bool NickNameDialog::readNickNamesFromMailCapFile(const QString &fileName, QString *errorMessage) +bool NickNameDialog::populateModelFromMailCapFile(const QString &fileName, + QStandardItemModel *model, + QString *errorMessage) { + if (const int rowCount = model->rowCount()) + model->removeRows(0, rowCount); + if (fileName.isEmpty()) + return true; QFile file(fileName); if (!file.open(QIODevice::ReadOnly|QIODevice::Text)) { *errorMessage = tr("Cannot open '%1': %2").arg(fileName, file.errorString()); return false; } - QStandardItemModel *model = nickModel(); - clearModel(model); // Split into lines and read NickNameEntry entry; const QStringList lines = QString::fromUtf8(file.readAll()).trimmed().split(QLatin1Char('\n')); @@ -256,10 +248,9 @@ bool NickNameDialog::readNickNamesFromMailCapFile(const QString &fileName, QStri return true; } -QStringList NickNameDialog::nickNameList() +QStringList NickNameDialog::nickNameList(const QStandardItemModel *model) { QStringList rc; - const QStandardItemModel *model = nickModel(); const int rowCount = model->rowCount(); for (int r = 0; r < rowCount; r++) rc.push_back(NickNameEntry::nickNameOf(model->item(r, 0))); diff --git a/src/plugins/vcsbase/nicknamedialog.h b/src/plugins/vcsbase/nicknamedialog.h index 7c644105777a916951b58a4c16ec3acc1f5fdb09..51d5a6399eb1e8a4295a2027ee09b4397e31235b 100644 --- a/src/plugins/vcsbase/nicknamedialog.h +++ b/src/plugins/vcsbase/nicknamedialog.h @@ -37,6 +37,7 @@ namespace Ui { class NickNameDialog; } class QSortFilterProxyModel; +class QStandardItemModel; class QModelIndex; class QPushButton; QT_END_NAMESPACE @@ -48,23 +49,24 @@ namespace Internal { * mail cap file, consisting of 4 columns: * "Name Mail [AliasName [AliasMail]]". * The names can be used for insertion into "RevBy:" fields; aliases will - * be preferred. The static functions to read/clear the mail map - * files access a global model which is shared by all instances of the - * dialog to achieve updating. */ + * be preferred. */ class NickNameDialog : public QDialog { Q_OBJECT public: - explicit NickNameDialog(QWidget *parent = 0); + explicit NickNameDialog(QStandardItemModel *model, QWidget *parent = 0); virtual ~NickNameDialog(); QString nickName() const; - // Fill/clear the global nick name cache - static bool readNickNamesFromMailCapFile(const QString &file, QString *errorMessage); - static void clearNickNames(); + // Utilities to initialize/populate the model + static QStandardItemModel *createModel(QObject *parent); + static bool populateModelFromMailCapFile(const QString &file, + QStandardItemModel *model, + QString *errorMessage); + // Return a list for a completer on the field line edits - static QStringList nickNameList(); + static QStringList nickNameList(const QStandardItemModel *model); private slots: void slotCurrentItemChanged(const QModelIndex &); @@ -74,7 +76,9 @@ private: QPushButton *okButton() const; Ui::NickNameDialog *m_ui; + QStandardItemModel *m_model; QSortFilterProxyModel *m_filterModel; + }; } // namespace Internal diff --git a/src/plugins/vcsbase/vcsbaseconstants.h b/src/plugins/vcsbase/vcsbaseconstants.h index bb180213fb24a7a4f2ba2b66f05cce694499c16e..7bffb76a2ee6512b94cf7f7c3eb3ab3a38ec52c6 100644 --- a/src/plugins/vcsbase/vcsbaseconstants.h +++ b/src/plugins/vcsbase/vcsbaseconstants.h @@ -35,7 +35,7 @@ namespace VCSBase { namespace Constants { -const char * const VCS_SETTINGS_CATEGORY = QT_TRANSLATE_NOOP("VCSBase", "Version Control System"); +const char * const VCS_SETTINGS_CATEGORY = QT_TRANSLATE_NOOP("VCSBase", "Version Control"); const char * const VCS_COMMON_SETTINGS_ID = QT_TRANSLATE_NOOP("VCSBase", "Common"); namespace Internal { diff --git a/src/plugins/vcsbase/vcsbaseplugin.cpp b/src/plugins/vcsbase/vcsbaseplugin.cpp index 0de678e80e341a718584427d0860953c26ec3e65..a819411ee022ac108a631abff7e2295cd69273e5 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.cpp +++ b/src/plugins/vcsbase/vcsbaseplugin.cpp @@ -30,6 +30,7 @@ #include "vcsbaseplugin.h" #include "diffhighlighter.h" #include "vcsbasesettingspage.h" +#include "nicknamedialog.h" #include <coreplugin/icore.h> #include <coreplugin/coreconstants.h> @@ -37,6 +38,7 @@ #include <coreplugin/mimedatabase.h> #include <QtCore/QtPlugin> +#include <QtCore/QDebug> namespace VCSBase { namespace Internal { @@ -44,7 +46,8 @@ namespace Internal { VCSBasePlugin *VCSBasePlugin::m_instance = 0; VCSBasePlugin::VCSBasePlugin() : - m_settingsPage(0) + m_settingsPage(0), + m_nickNameModel(0) { m_instance = this; } @@ -65,6 +68,11 @@ bool VCSBasePlugin::initialize(const QStringList &arguments, QString *errorMessa m_settingsPage = new VCSBaseSettingsPage; addAutoReleasedObject(m_settingsPage); + connect(m_settingsPage, SIGNAL(settingsChanged(VCSBase::Internal::VCSBaseSettings)), + this, SIGNAL(settingsChanged(VCSBase::Internal::VCSBaseSettings))); + connect(m_settingsPage, SIGNAL(settingsChanged(VCSBase::Internal::VCSBaseSettings)), + this, SLOT(slotSettingsChanged())); + slotSettingsChanged(); return true; } @@ -82,6 +90,32 @@ VCSBaseSettings VCSBasePlugin::settings() const return m_settingsPage->settings(); } +/* Delayed creation/update of the nick name model. */ +QStandardItemModel *VCSBasePlugin::nickNameModel() +{ + if (!m_nickNameModel) { + m_nickNameModel = NickNameDialog::createModel(this); + populateNickNameModel(); + } + return m_nickNameModel; +} + +void VCSBasePlugin::populateNickNameModel() +{ + QString errorMessage; + if (!NickNameDialog::populateModelFromMailCapFile(settings().nickNameMailMap, + m_nickNameModel, + &errorMessage)) { + qWarning("%s", qPrintable(errorMessage)); + } +} + +void VCSBasePlugin::slotSettingsChanged() +{ + if (m_nickNameModel) + populateNickNameModel(); +} + } // namespace Internal } // namespace VCSBase diff --git a/src/plugins/vcsbase/vcsbaseplugin.h b/src/plugins/vcsbase/vcsbaseplugin.h index 7b845a3055da180bf6cdfe2ad1065e118a5cdb13..e116d1943fcee7ebcc72c39283d71af4d84682ae 100644 --- a/src/plugins/vcsbase/vcsbaseplugin.h +++ b/src/plugins/vcsbase/vcsbaseplugin.h @@ -34,6 +34,10 @@ #include <QtCore/QObject> +QT_BEGIN_NAMESPACE +class QStandardItemModel; +QT_END_NAMESPACE + namespace VCSBase { namespace Internal { @@ -56,9 +60,23 @@ public: VCSBaseSettings settings() const; + // Model of user nick names used for the submit + // editor. Stored centrally here to achieve delayed + // initialization and updating on settings change. + QStandardItemModel *nickNameModel(); + +signals: + void settingsChanged(const VCSBase::Internal::VCSBaseSettings& s); + +private slots: + void slotSettingsChanged(); + private: + void populateNickNameModel(); + static VCSBasePlugin *m_instance; VCSBaseSettingsPage *m_settingsPage; + QStandardItemModel *m_nickNameModel; }; } // namespace Internal diff --git a/src/plugins/vcsbase/vcsbasesettings.cpp b/src/plugins/vcsbase/vcsbasesettings.cpp index d2f6951bbd7eed52d4b5e1503b31eb0bf3b0faec..e5c117b99bb6984ab6a249a6634d3582e727ea73 100644 --- a/src/plugins/vcsbase/vcsbasesettings.cpp +++ b/src/plugins/vcsbase/vcsbasesettings.cpp @@ -37,12 +37,19 @@ static const char *nickNameMailMapKeyC = "NickNameMailMap"; static const char *nickNameFieldListFileKeyC = "NickNameFieldListFile"; static const char *promptForSubmitKeyC = "PromptForSubmit"; static const char *submitMessageCheckScriptKeyC = "SubmitMessageCheckScript"; +static const char *lineWrapKeyC = "LineWrap"; +static const char *lineWrapWidthKeyC = "LineWrapWidth"; + +static const int lineWrapWidthDefault = 72; +static const bool lineWrapDefault = true; namespace VCSBase { namespace Internal { VCSBaseSettings::VCSBaseSettings() : - promptForSubmit(true) + promptForSubmit(true), + lineWrap(lineWrapDefault), + lineWrapWidth(lineWrapWidthDefault) { } @@ -53,6 +60,8 @@ void VCSBaseSettings::toSettings(QSettings *s) const s->setValue(QLatin1String(nickNameFieldListFileKeyC), nickNameFieldListFile); s->setValue(QLatin1String(submitMessageCheckScriptKeyC), submitMessageCheckScript); s->setValue(QLatin1String(promptForSubmitKeyC), promptForSubmit); + s->setValue(QLatin1String(lineWrapKeyC), lineWrap); + s->setValue(QLatin1String(lineWrapWidthKeyC), lineWrapWidth); s->endGroup(); } @@ -63,16 +72,30 @@ void VCSBaseSettings::fromSettings(QSettings *s) nickNameFieldListFile = s->value(QLatin1String(nickNameFieldListFileKeyC), QString()).toString(); submitMessageCheckScript = s->value(QLatin1String(submitMessageCheckScriptKeyC), QString()).toString(); promptForSubmit = s->value(QLatin1String(promptForSubmitKeyC), QVariant(true)).toBool(); + lineWrap = s->value(QLatin1String(lineWrapKeyC), lineWrapDefault).toBool(); + lineWrapWidth = s->value(QLatin1String(lineWrapWidthKeyC), lineWrapWidthDefault).toInt(); s->endGroup(); } bool VCSBaseSettings::equals(const VCSBaseSettings &rhs) const { return promptForSubmit == rhs.promptForSubmit + && lineWrap == rhs.lineWrap + && lineWrapWidth == rhs.lineWrapWidth && nickNameMailMap == rhs.nickNameMailMap && nickNameFieldListFile == rhs.nickNameFieldListFile && submitMessageCheckScript == rhs.submitMessageCheckScript; } +QDebug operator<<(QDebug d,const VCSBaseSettings& s) +{ + d.nospace() << "promptForSubmit=" << s.promptForSubmit + << " lineWrap=" << s.lineWrap + << " lineWrapWidth=" << s.lineWrapWidth + << " nickNameMailMap='" << s.nickNameMailMap + << "' nickNameFieldListFile='" << s.nickNameFieldListFile + << "'submitMessageCheckScript='" << s.submitMessageCheckScript << "'\n"; + return d; +} } } diff --git a/src/plugins/vcsbase/vcsbasesettings.h b/src/plugins/vcsbase/vcsbasesettings.h index b4efd59d33bd607e2ada85f83c3a352797b7b1ac..4ad64a9b589cb03f521fe5ab14ac2b8b58f58f37 100644 --- a/src/plugins/vcsbase/vcsbasesettings.h +++ b/src/plugins/vcsbase/vcsbasesettings.h @@ -35,6 +35,7 @@ QT_BEGIN_NAMESPACE class QSettings; +class QDebug; QT_END_NAMESPACE namespace VCSBase { @@ -51,6 +52,9 @@ struct VCSBaseSettings { QString submitMessageCheckScript; + bool lineWrap; + int lineWrapWidth; + void toSettings(QSettings *) const; void fromSettings(QSettings *); @@ -60,6 +64,7 @@ struct VCSBaseSettings { inline bool operator==(const VCSBaseSettings &s1, const VCSBaseSettings &s2) { return s1.equals(s2); } inline bool operator!=(const VCSBaseSettings &s1, const VCSBaseSettings &s2) { return !s1.equals(s2); } +QDebug operator<<(QDebug,const VCSBaseSettings& ); } // namespace Internal } // namespace VCSBase diff --git a/src/plugins/vcsbase/vcsbasesettingspage.cpp b/src/plugins/vcsbase/vcsbasesettingspage.cpp index 0cc528a2e7b2c8ce22d0b367ef1ef3f22724e615..e6530f4fda9a9948c9ced993f19a8af12a0faf86 100644 --- a/src/plugins/vcsbase/vcsbasesettingspage.cpp +++ b/src/plugins/vcsbase/vcsbasesettingspage.cpp @@ -67,16 +67,19 @@ VCSBaseSettings VCSBaseSettingsWidget::settings() const rc.nickNameFieldListFile = m_ui->nickNameFieldsFileChooser->path(); rc.submitMessageCheckScript = m_ui->submitMessageCheckScriptChooser->path(); rc.promptForSubmit = m_ui->promptForSubmitCheckBox->isChecked(); + rc.lineWrap= m_ui->lineWrapCheckBox->isChecked(); + rc.lineWrapWidth = m_ui->lineWrapSpinBox->value(); return rc; } void VCSBaseSettingsWidget::setSettings(const VCSBaseSettings &s) { - m_ui->nickNameMailMapChooser->setPath(s.nickNameMailMap); m_ui->nickNameFieldsFileChooser->setPath(s.nickNameFieldListFile); m_ui->submitMessageCheckScriptChooser->setPath(s.submitMessageCheckScript); m_ui->promptForSubmitCheckBox->setChecked(s.promptForSubmit); + m_ui->lineWrapCheckBox->setChecked(s.lineWrap); + m_ui->lineWrapSpinBox->setValue(s.lineWrapWidth); } // --------------- VCSBaseSettingsPage @@ -84,18 +87,10 @@ VCSBaseSettingsPage::VCSBaseSettingsPage(QObject *parent) : Core::IOptionsPage(parent) { m_settings.fromSettings(Core::ICore::instance()->settings()); - updateNickNames(); } void VCSBaseSettingsPage::updateNickNames() { - if (m_settings.nickNameMailMap.isEmpty()) { - NickNameDialog::clearNickNames(); - } else { - QString errorMessage; - if (!NickNameDialog::readNickNamesFromMailCapFile(m_settings.nickNameMailMap, &errorMessage)) - qWarning("%s", qPrintable(errorMessage)); - } } VCSBaseSettingsPage::~VCSBaseSettingsPage() @@ -136,7 +131,7 @@ void VCSBaseSettingsPage::apply() if (newSettings != m_settings) { m_settings = newSettings; m_settings.toSettings(Core::ICore::instance()->settings()); - updateNickNames(); + emit settingsChanged(m_settings); } } } diff --git a/src/plugins/vcsbase/vcsbasesettingspage.h b/src/plugins/vcsbase/vcsbasesettingspage.h index 4492f665444af240ea6933b399262c0da4278541..9c271c561e9dcb710eb0fddc472e8c0143e1695a 100644 --- a/src/plugins/vcsbase/vcsbasesettingspage.h +++ b/src/plugins/vcsbase/vcsbasesettingspage.h @@ -59,6 +59,7 @@ private: class VCSBaseSettingsPage : public Core::IOptionsPage { + Q_OBJECT public: explicit VCSBaseSettingsPage(QObject *parent = 0); virtual ~VCSBaseSettingsPage(); @@ -74,6 +75,9 @@ public: VCSBaseSettings settings() const { return m_settings; } +signals: + void settingsChanged(const VCSBase::Internal::VCSBaseSettings &s); + private: void updateNickNames(); QPointer<VCSBaseSettingsWidget> m_widget; diff --git a/src/plugins/vcsbase/vcsbasesettingspage.ui b/src/plugins/vcsbase/vcsbasesettingspage.ui index 01e478f8176983f6434ace1814a772c40d6352ae..0585c680e3e259c00bd6b16cdeabf9ae249a7dfa 100644 --- a/src/plugins/vcsbase/vcsbasesettingspage.ui +++ b/src/plugins/vcsbase/vcsbasesettingspage.ui @@ -13,63 +13,102 @@ <property name="windowTitle"> <string>Form</string> </property> - <layout class="QVBoxLayout" name="verticalLayout"> + <layout class="QVBoxLayout" name="verticalLayout_3"> <item> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> - <layout class="QFormLayout" name="formLayout"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::ExpandingFieldsGrow</enum> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="promptForSubmitLabel"> - <property name="text"> - <string>Prompt for submit:</string> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QCheckBox" name="promptForSubmitCheckBox"/> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="submitMessageCheckScriptLabel"> - <property name="toolTip"> - <string>An executable which is called with the submit message in a temporary file as first argument. It should return with an exit != 0 and a message on standard error to indicate failure.</string> - </property> - <property name="text"> - <string>Submit message check script:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="Core::Utils::PathChooser" name="submitMessageCheckScriptChooser" native="true"/> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="promptForSubmitCheckBox"> + <property name="text"> + <string>Prompt to submit</string> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QCheckBox" name="lineWrapCheckBox"> + <property name="text"> + <string>Wrap submit message at:</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="lineWrapSpinBox"> + <property name="minimum"> + <number>40</number> + </property> + <property name="maximum"> + <number>200</number> + </property> + <property name="value"> + <number>72</number> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <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> + </layout> </item> - <item row="2" column="0"> - <widget class="QLabel" name="nickNameMailMapLabel"> - <property name="toolTip"> - <string>A file listing user names and email addresses in a 4-column mailmap format: + <item> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="submitMessageCheckScriptLabel"> + <property name="toolTip"> + <string>An executable which is called with the submit message in a temporary file as first argument. It should return with an exit != 0 and a message on standard error to indicate failure.</string> + </property> + <property name="text"> + <string>Submit message check script:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="Core::Utils::PathChooser" name="submitMessageCheckScriptChooser"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="nickNameMailMapLabel"> + <property name="toolTip"> + <string>A file listing user names and email addresses in a 4-column mailmap format: name <email> alias <email></string> - </property> - <property name="text"> - <string>User/alias configuration file:</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="Core::Utils::PathChooser" name="nickNameMailMapChooser" native="true"/> - </item> - <item row="3" column="0"> - <widget class="QLabel" name="nickNameFieldsFileLabel"> - <property name="toolTip"> - <string>A simple file containing lines with field names like "Reviewed-By:" which will be added below the submit editor.</string> - </property> - <property name="text"> - <string>User fields configuration file:</string> - </property> - </widget> - </item> - <item row="3" column="1"> - <widget class="Core::Utils::PathChooser" name="nickNameFieldsFileChooser" native="true"/> + </property> + <property name="text"> + <string>User/alias configuration file:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="Core::Utils::PathChooser" name="nickNameMailMapChooser"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="nickNameFieldsFileLabel"> + <property name="toolTip"> + <string>A simple file containing lines with field names like "Reviewed-By:" which will be added below the submit editor.</string> + </property> + <property name="text"> + <string>User fields configuration file:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="Core::Utils::PathChooser" name="nickNameFieldsFileChooser"/> + </item> + </layout> </item> </layout> </item> diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 46ae4374cf71a9c339c8d9b7e97e2319e86a8c07..e696f46b126e17ac92758783f677aeedf86b17d2 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -136,6 +136,13 @@ VCSBaseSubmitEditor::VCSBaseSubmitEditor(const VCSBaseSubmitEditorParameters *pa if (!settings.nickNameFieldListFile.isEmpty()) createUserFields(settings.nickNameFieldListFile); connect(m_d->m_widget, SIGNAL(fieldDialogRequested(int)), this, SLOT(slotSetFieldNickName(int))); + + // wrapping. etc + slotUpdateEditorSettings(settings); + connect(Internal::VCSBasePlugin::instance(), + SIGNAL(settingsChanged(VCSBase::Internal::VCSBaseSettings)), + this, SLOT(slotUpdateEditorSettings(VCSBase::Internal::VCSBaseSettings))); + Aggregation::Aggregate *aggregate = new Aggregation::Aggregate; aggregate->add(new Find::BaseTextFind(m_d->m_widget->descriptionEdit())); aggregate->add(this); @@ -148,6 +155,12 @@ VCSBaseSubmitEditor::~VCSBaseSubmitEditor() delete m_d; } +void VCSBaseSubmitEditor::slotUpdateEditorSettings(const Internal::VCSBaseSettings &s) +{ + setLineWrapWidth(s.lineWrapWidth); + setLineWrap(s.lineWrap); +} + void VCSBaseSubmitEditor::createUserFields(const QString &fieldConfigFile) { QFile fieldFile(fieldConfigFile); @@ -160,7 +173,8 @@ void VCSBaseSubmitEditor::createUserFields(const QString &fieldConfigFile) if (fields.empty()) return; // Create a completer on user names - QCompleter *completer = new QCompleter(Internal::NickNameDialog::nickNameList(), this); + const QStandardItemModel *nickNameModel = Internal::VCSBasePlugin::instance()->nickNameModel(); + QCompleter *completer = new QCompleter(Internal::NickNameDialog::nickNameList(nickNameModel), this); foreach(const QString &field, fields) { const QString trimmedField = field.trimmed(); if (!trimmedField.isEmpty()) @@ -202,6 +216,26 @@ void VCSBaseSubmitEditor::setFileListSelectionMode(QAbstractItemView::SelectionM m_d->m_widget->setFileListSelectionMode(sm); } +bool VCSBaseSubmitEditor::lineWrap() const +{ + return m_d->m_widget->lineWrap(); +} + +void VCSBaseSubmitEditor::setLineWrap(bool w) +{ + m_d->m_widget->setLineWrap(w); +} + +int VCSBaseSubmitEditor::lineWrapWidth() const +{ + return m_d->m_widget->lineWrapWidth(); +} + +void VCSBaseSubmitEditor::setLineWrapWidth(int w) +{ + m_d->m_widget->setLineWrapWidth(w); +} + void VCSBaseSubmitEditor::slotDescriptionChanged() { } @@ -357,7 +391,7 @@ bool VCSBaseSubmitEditor::save(const QString &fileName) QString VCSBaseSubmitEditor::fileContents() const { - return m_d->m_widget->trimmedDescriptionText(); + return m_d->m_widget->descriptionText(); } bool VCSBaseSubmitEditor::setFileContents(const QString &contents) @@ -412,7 +446,7 @@ VCSBaseSubmitEditor::PromptSubmitResult QString VCSBaseSubmitEditor::promptForNickName() { if (!m_d->m_nickNameDialog) - m_d->m_nickNameDialog = new Internal::NickNameDialog(m_d->m_widget); + m_d->m_nickNameDialog = new Internal::NickNameDialog(Internal::VCSBasePlugin::instance()->nickNameModel(), m_d->m_widget); if (m_d->m_nickNameDialog->exec() == QDialog::Accepted) return m_d->m_nickNameDialog->nickName(); return QString(); diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.h b/src/plugins/vcsbase/vcsbasesubmiteditor.h index 4a02d262a29f8fd5311d347b0a1ec6e3be9cc0b7..3cd2e62bcba6785a61eaef47450695cd737f9bde 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.h +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.h @@ -90,6 +90,8 @@ class VCSBASE_EXPORT VCSBaseSubmitEditor : public Core::IEditor Q_OBJECT Q_PROPERTY(int fileNameColumn READ fileNameColumn WRITE setFileNameColumn DESIGNABLE false) Q_PROPERTY(QAbstractItemView::SelectionMode fileListSelectionMode READ fileListSelectionMode WRITE setFileListSelectionMode DESIGNABLE true) + Q_PROPERTY(bool lineWrap READ lineWrap WRITE setLineWrap DESIGNABLE true); + Q_PROPERTY(int lineWrapWidth READ lineWrapWidth WRITE setLineWrapWidth DESIGNABLE true); public: typedef QList<int> Context; @@ -121,6 +123,12 @@ public: QAbstractItemView::SelectionMode fileListSelectionMode() const; void setFileListSelectionMode(QAbstractItemView::SelectionMode sm); + bool lineWrap() const; + void setLineWrap(bool); + + int lineWrapWidth() const; + void setLineWrapWidth(int); + // Core::IEditor virtual bool createNew(const QString &contents); virtual bool open(const QString &fileName); @@ -161,6 +169,7 @@ private slots: void slotCheckSubmitMessage(); void slotInsertNickName(); void slotSetFieldNickName(int); + void slotUpdateEditorSettings(const VCSBase::Internal::VCSBaseSettings &); protected: /* These hooks allow for modifying the contents that goes to diff --git a/src/shared/cplusplus/Lexer.cpp b/src/shared/cplusplus/Lexer.cpp index ab3c35e67bea94c9251d745611962cbebb138345..88ccd334ce86316a42ed83d4105985910f03c557 100644 --- a/src/shared/cplusplus/Lexer.cpp +++ b/src/shared/cplusplus/Lexer.cpp @@ -410,6 +410,9 @@ void Lexer::scan_helper(Token *tok) if (_yychar == '/' || _yychar == '!') { yyinp(); + if (_yychar == '<') + yyinp(); + if (_yychar != '\n' && std::isspace(_yychar)) doxy = true; } @@ -435,6 +438,9 @@ void Lexer::scan_helper(Token *tok) if (ch == '*' && _yychar == '/') goto _Ldone; + if (_yychar == '<') + yyinp(); + if (! _yychar || std::isspace(_yychar)) doxy = true; }