diff --git a/src/libs/cplusplus/CheckUndefinedSymbols.cpp b/src/libs/cplusplus/CheckUndefinedSymbols.cpp index febb19e27230f631a01a09d6cbe0c2f85fcb0f72..5f0b6b2d27df826c8d5e9fb8f9646b34de32e6fb 100644 --- a/src/libs/cplusplus/CheckUndefinedSymbols.cpp +++ b/src/libs/cplusplus/CheckUndefinedSymbols.cpp @@ -51,6 +51,7 @@ void CheckUndefinedSymbols::setGlobalNamespaceBinding(NamespaceBindingPtr global { _globalNamespaceBinding = globalNamespaceBinding; _types.clear(); + _protocols.clear(); if (_globalNamespaceBinding) { QSet<NamespaceBinding *> processed; @@ -130,6 +131,20 @@ void CheckUndefinedSymbols::addType(Name *name) _types.insert(QByteArray(id->chars(), id->size())); } +void CheckUndefinedSymbols::addProtocol(Name *name) +{ + if (!name) + return; + + if (Identifier *id = name->identifier()) + _protocols.insert(QByteArray(id->chars(), id->size())); +} + +bool CheckUndefinedSymbols::isProtocol(const QByteArray &name) const +{ + return _protocols.contains(name); +} + void CheckUndefinedSymbols::buildTypeMap(Class *klass) { addType(klass->name()); @@ -186,9 +201,9 @@ void CheckUndefinedSymbols::buildTypeMap(NamespaceBinding *binding, QSet<Namespa for (unsigned i = 0; i < klass->memberCount(); ++i) buildMemberTypeMap(klass->memberAt(i)); } else if (ObjCForwardProtocolDeclaration *fProto = member->asObjCForwardProtocolDeclaration()) { - addType(fProto->name()); + addProtocol(fProto->name()); } else if (ObjCProtocol *proto = member->asObjCProtocol()) { - addType(proto->name()); + addProtocol(proto->name()); for (unsigned i = 0; i < proto->memberCount(); ++i) buildMemberTypeMap(proto->memberAt(i)); @@ -466,3 +481,53 @@ bool CheckUndefinedSymbols::visit(SizeofExpressionAST *ast) return true; } + +bool CheckUndefinedSymbols::visit(ObjCClassDeclarationAST *ast) +{ + if (NameAST *nameAST = ast->superclass) { + bool resolvedSuperClassName = false; + + if (Name *name = nameAST->name) { + Identifier *id = name->identifier(); + const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size()); + if (isType(spell)) + resolvedSuperClassName = true; + } + + if (! resolvedSuperClassName) { + translationUnit()->warning(nameAST->firstToken(), + "expected class-name after ':' token"); + } + } + + return true; +} + +bool CheckUndefinedSymbols::visit(ObjCProtocolRefsAST *ast) +{ + for (IdentifierListAST *iter = ast->identifier_list; iter; iter = iter->next) { + if (NameAST *nameAST = iter->name) { + bool resolvedProtocolName = false; + + if (Name *name = nameAST->name) { + Identifier *id = name->identifier(); + const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size()); + if (isProtocol(spell)) + resolvedProtocolName = true; + } + + if (!resolvedProtocolName) { + char after; + + if (iter == ast->identifier_list) + after = '<'; + else + after = ','; + + translationUnit()->warning(nameAST->firstToken(), "expected protocol name after '%c' token", after); + } + } + } + + return false; +} diff --git a/src/libs/cplusplus/CheckUndefinedSymbols.h b/src/libs/cplusplus/CheckUndefinedSymbols.h index 745ee50b11124942e2398f8913a6121e8f333ebf..fbdca0f94ec9d2c1fdc7629d8fc0516b693bde3b 100644 --- a/src/libs/cplusplus/CheckUndefinedSymbols.h +++ b/src/libs/cplusplus/CheckUndefinedSymbols.h @@ -59,6 +59,8 @@ protected: void buildTypeMap(Class *klass); void buildMemberTypeMap(Symbol *member); void buildTypeMap(NamespaceBinding *binding, QSet<NamespaceBinding *> *processed); + void addProtocol(Name *name); + bool isProtocol(const QByteArray &name) const; FunctionDeclaratorAST *currentFunctionDeclarator() const; CompoundStatementAST *compoundStatement() const; @@ -92,6 +94,9 @@ protected: virtual bool visit(CastExpressionAST *ast); virtual bool visit(SizeofExpressionAST *ast); + virtual bool visit(ObjCClassDeclarationAST *ast); + virtual bool visit(ObjCProtocolRefsAST *ast); + private: Document::Ptr _doc; NamespaceBindingPtr _globalNamespaceBinding; @@ -100,6 +105,7 @@ private: QList<TemplateDeclarationAST *> _templateDeclarationStack; QList<CompoundStatementAST *> _compoundStatementStack; QSet<QByteArray> _types; + QSet<QByteArray> _protocols; QSet<QByteArray> _namespaceNames; }; diff --git a/src/libs/cplusplus/MatchingText.cpp b/src/libs/cplusplus/MatchingText.cpp index bbbb06b83112c5f223423f5deb86b690f16fa04b..20aa34f068325864c02684c1c47e31107b30010d 100644 --- a/src/libs/cplusplus/MatchingText.cpp +++ b/src/libs/cplusplus/MatchingText.cpp @@ -104,21 +104,43 @@ QString MatchingText::insertMatchingBrace(const QTextCursor &cursor, const QStri const QChar &la, int *skippedChars) const { QTextCursor tc = cursor; + QTextDocument *doc = tc.document(); QString text = textToProcess; const QString blockText = tc.block().text().mid(tc.columnNumber()); const int length = qMin(blockText.length(), textToProcess.length()); - for (int i = 0; i < length; ++i) { - const QChar ch1 = blockText.at(i); - const QChar ch2 = textToProcess.at(i); + const QChar previousChar = doc->characterAt(tc.selectionEnd() - 1); - if (ch1 != ch2) - break; - else if (! shouldOverrideChar(ch1)) - break; + bool escape = false; + + if (! text.isEmpty() && (text.at(0) == QLatin1Char('"') || + text.at(0) == QLatin1Char('\''))) { + if (previousChar == QLatin1Char('\\')) { + int escapeCount = 0; + int index = tc.selectionEnd() - 1; + do { + ++escapeCount; + --index; + } while (doc->characterAt(index) == QLatin1Char('\\')); - ++*skippedChars; + if ((escapeCount % 2) != 0) + escape = true; + } + } + + if (! escape) { + for (int i = 0; i < length; ++i) { + const QChar ch1 = blockText.at(i); + const QChar ch2 = textToProcess.at(i); + + if (ch1 != ch2) + break; + else if (! shouldOverrideChar(ch1)) + break; + + ++*skippedChars; + } } if (*skippedChars != 0) { @@ -142,6 +164,8 @@ QString MatchingText::insertMatchingBrace(const QTextCursor &cursor, const QStri if (isCompleteStringLiteral(tk, index - 1)) return QLatin1String("\""); + qDebug() << "*** here"; + return QString(); } else if (text.at(0) == QLatin1Char('\'') && (token.is(T_CHAR_LITERAL) || token.is(T_WIDE_CHAR_LITERAL))) { if (text.length() != 1) diff --git a/src/libs/utils/abstractprocess.h b/src/libs/utils/abstractprocess.h index c0373b64ee82e3c3eae5a059c6e84f22e1b7f0b8..3dcdee9617ded7b48d41be725e616a8806f1d915 100644 --- a/src/libs/utils/abstractprocess.h +++ b/src/libs/utils/abstractprocess.h @@ -34,7 +34,6 @@ #include <QtCore/QStringList> -namespace Core { namespace Utils { class QTCREATOR_UTILS_EXPORT AbstractProcess @@ -75,7 +74,6 @@ private: }; } //namespace Utils -} //namespace Core #endif // ABSTRACTPROCESS_H diff --git a/src/libs/utils/abstractprocess_win.cpp b/src/libs/utils/abstractprocess_win.cpp index 6f038988a4213f3bbb42905785b474c7a3c8611f..70aa028e1cb1fe9ec1fd5bea926058c3994f94e1 100644 --- a/src/libs/utils/abstractprocess_win.cpp +++ b/src/libs/utils/abstractprocess_win.cpp @@ -31,7 +31,6 @@ #include <windows.h> -namespace Core { namespace Utils { QStringList AbstractProcess::fixWinEnvironment(const QStringList &env) @@ -114,4 +113,3 @@ QByteArray AbstractProcess::createWinEnvironment(const QStringList &env) } } //namespace Utils -} //namespace Core diff --git a/src/libs/utils/basevalidatinglineedit.cpp b/src/libs/utils/basevalidatinglineedit.cpp index c648b59cc7b1679198eaf08ef3f34934b1b0c2c8..c70aa59e1f5020fe5d4c072af15ec77e4b6ef77c 100644 --- a/src/libs/utils/basevalidatinglineedit.cpp +++ b/src/libs/utils/basevalidatinglineedit.cpp @@ -33,7 +33,6 @@ enum { debug = 0 }; -namespace Core { namespace Utils { struct BaseValidatingLineEditPrivate { @@ -156,4 +155,3 @@ void BaseValidatingLineEdit::triggerChanged() } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/basevalidatinglineedit.h b/src/libs/utils/basevalidatinglineedit.h index 34dddf367b7a5877b097d50acef8a63a86983f7c..77031bbd96c0efa2929c5e965d59c51aa0b6d0c1 100644 --- a/src/libs/utils/basevalidatinglineedit.h +++ b/src/libs/utils/basevalidatinglineedit.h @@ -34,7 +34,6 @@ #include <QtGui/QLineEdit> -namespace Core { namespace Utils { struct BaseValidatingLineEditPrivate; @@ -98,6 +97,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // BASEVALIDATINGLINEEDIT_H diff --git a/src/libs/utils/checkablemessagebox.cpp b/src/libs/utils/checkablemessagebox.cpp index d72bd9e6da43a1fdc3fe542a9e31af9dec7b67a7..68c30656521412b54fbe2ec8b6b0fb501b511e0a 100644 --- a/src/libs/utils/checkablemessagebox.cpp +++ b/src/libs/utils/checkablemessagebox.cpp @@ -4,7 +4,6 @@ #include <QtGui/QPushButton> #include <QtCore/QDebug> -namespace Core { namespace Utils { struct CheckableMessageBoxPrivate { @@ -147,4 +146,3 @@ QMessageBox::StandardButton CheckableMessageBox::dialogButtonBoxToMessageBoxButt } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/checkablemessagebox.h b/src/libs/utils/checkablemessagebox.h index 4b57e25fa3be56c04516ad13dbb9ec9488d5a54f..e14908b4b771e08869472f8ddd8a07b0eedde06c 100644 --- a/src/libs/utils/checkablemessagebox.h +++ b/src/libs/utils/checkablemessagebox.h @@ -7,7 +7,6 @@ #include <QtGui/QMessageBox> #include <QtGui/QDialog> -namespace Core { namespace Utils { struct CheckableMessageBoxPrivate; @@ -72,6 +71,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // CHECKABLEMESSAGEBOX_H diff --git a/src/libs/utils/checkablemessagebox.ui b/src/libs/utils/checkablemessagebox.ui index c5f6d7265b5a1aa4ae7d5eeaf337b654825e6590..7491a849162f780d910cadd27faf7a6a7aa25847 100644 --- a/src/libs/utils/checkablemessagebox.ui +++ b/src/libs/utils/checkablemessagebox.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Core::Utils::CheckableMessageBox</class> - <widget class="QDialog" name="Core::Utils::CheckableMessageBox"> + <class>Utils::CheckableMessageBox</class> + <widget class="QDialog" name="Utils::CheckableMessageBox"> <property name="geometry"> <rect> <x>0</x> @@ -121,7 +121,7 @@ <connection> <sender>buttonBox</sender> <signal>accepted()</signal> - <receiver>Core::Utils::CheckableMessageBox</receiver> + <receiver>Utils::CheckableMessageBox</receiver> <slot>accept()</slot> <hints> <hint type="sourcelabel"> @@ -137,7 +137,7 @@ <connection> <sender>buttonBox</sender> <signal>rejected()</signal> - <receiver>Core::Utils::CheckableMessageBox</receiver> + <receiver>Utils::CheckableMessageBox</receiver> <slot>reject()</slot> <hints> <hint type="sourcelabel"> diff --git a/src/libs/utils/classnamevalidatinglineedit.cpp b/src/libs/utils/classnamevalidatinglineedit.cpp index 324c5d4dd62d58cd6b14663ded05bb0776c8ce45..462e698b605219f5c675eac792fafc4e14f86c7e 100644 --- a/src/libs/utils/classnamevalidatinglineedit.cpp +++ b/src/libs/utils/classnamevalidatinglineedit.cpp @@ -34,7 +34,6 @@ #include <QtCore/QDebug> #include <QtCore/QRegExp> -namespace Core { namespace Utils { struct ClassNameValidatingLineEditPrivate { @@ -58,7 +57,7 @@ ClassNameValidatingLineEditPrivate:: ClassNameValidatingLineEditPrivate() : // --------------------- ClassNameValidatingLineEdit ClassNameValidatingLineEdit::ClassNameValidatingLineEdit(QWidget *parent) : - Core::Utils::BaseValidatingLineEdit(parent), + Utils::BaseValidatingLineEdit(parent), m_d(new ClassNameValidatingLineEditPrivate) { } @@ -98,7 +97,7 @@ bool ClassNameValidatingLineEdit::validate(const QString &value, QString *errorM void ClassNameValidatingLineEdit::slotChanged(const QString &t) { - Core::Utils::BaseValidatingLineEdit::slotChanged(t); + Utils::BaseValidatingLineEdit::slotChanged(t); if (isValid()) { // Suggest file names, strip namespaces QString fileName = m_d->m_lowerCaseFileName ? t.toLower() : t; @@ -148,4 +147,3 @@ void ClassNameValidatingLineEdit::setLowerCaseFileName(bool v) } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/classnamevalidatinglineedit.h b/src/libs/utils/classnamevalidatinglineedit.h index 8e7ea31333122ae71980a67e7ab38fd4cb558782..3c650906ed28cbded3ae4c59197dc566e762e489 100644 --- a/src/libs/utils/classnamevalidatinglineedit.h +++ b/src/libs/utils/classnamevalidatinglineedit.h @@ -33,7 +33,6 @@ #include "utils_global.h" #include "basevalidatinglineedit.h" -namespace Core { namespace Utils { struct ClassNameValidatingLineEditPrivate; @@ -42,7 +41,7 @@ struct ClassNameValidatingLineEditPrivate; * to derive suggested file names from it. */ class QTCREATOR_UTILS_EXPORT ClassNameValidatingLineEdit - : public Core::Utils::BaseValidatingLineEdit + : public Utils::BaseValidatingLineEdit { Q_DISABLE_COPY(ClassNameValidatingLineEdit) Q_PROPERTY(bool namespacesEnabled READ namespacesEnabled WRITE setNamespacesEnabled DESIGNABLE true) @@ -76,6 +75,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // CLASSNAMEVALIDATINGLINEEDIT_H diff --git a/src/libs/utils/codegeneration.cpp b/src/libs/utils/codegeneration.cpp index 8b2a2869b014b427dd10054437213bef5e2dfc34..c0b1a64356ac225b07d5db7ba4a0fa9e489b8a3d 100644 --- a/src/libs/utils/codegeneration.cpp +++ b/src/libs/utils/codegeneration.cpp @@ -33,7 +33,6 @@ #include <QtCore/QStringList> #include <QtCore/QFileInfo> -namespace Core { namespace Utils { static QString toAlphaNum(const QString &s) @@ -101,4 +100,3 @@ void writeClosingNameSpaces(const QStringList &l, const QString &indent, } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/codegeneration.h b/src/libs/utils/codegeneration.h index c1e3f5ab7496862e4ad4cc609962aaf478cf020d..5c8fc746ce7aaf50901dd9670444a5dd5fc4b0ee 100644 --- a/src/libs/utils/codegeneration.h +++ b/src/libs/utils/codegeneration.h @@ -38,7 +38,6 @@ class QTextStream; class QStringList; QT_END_NAMESPACE -namespace Core { namespace Utils { QTCREATOR_UTILS_EXPORT QString headerGuard(const QString &file); @@ -62,6 +61,5 @@ void writeClosingNameSpaces(const QStringList &namespaces, QTextStream &str); } // namespace Utils -} // namespace Core #endif // CODEGENERATION_H diff --git a/src/libs/utils/consoleprocess.cpp b/src/libs/utils/consoleprocess.cpp index 0fa3a9b7d3fb4ca3c3b17bcb081dc945fe199d42..d89f9f86a5c1ab31f0dc8f3e2f55183099403d30 100644 --- a/src/libs/utils/consoleprocess.cpp +++ b/src/libs/utils/consoleprocess.cpp @@ -29,7 +29,6 @@ #include "consoleprocess.h" -namespace Core { namespace Utils { QString ConsoleProcess::modeOption(Mode m) @@ -83,4 +82,3 @@ QString ConsoleProcess::msgCannotExecute(const QString & p, const QString &why) } } -} diff --git a/src/libs/utils/consoleprocess.h b/src/libs/utils/consoleprocess.h index 18c684f258c1534e7d1ae236179b2853f7485d80..d3d4ff58cd05ddf601cd59bcd8cbb3816a5f3ee8 100644 --- a/src/libs/utils/consoleprocess.h +++ b/src/libs/utils/consoleprocess.h @@ -51,7 +51,6 @@ class QSettings; class QTemporaryFile; QT_END_NAMESPACE -namespace Core { namespace Utils { class QTCREATOR_UTILS_EXPORT ConsoleProcess : public QObject, public AbstractProcess @@ -138,6 +137,5 @@ private: }; } //namespace Utils -} //namespace Core #endif diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp index 36d8a94b71a7e2f8d0e6fd8b66e1862d88262fd3..5879ab4c9d2a190e30ef493a83e1613398519f12 100644 --- a/src/libs/utils/consoleprocess_unix.cpp +++ b/src/libs/utils/consoleprocess_unix.cpp @@ -42,7 +42,7 @@ #include <string.h> #include <unistd.h> -using namespace Core::Utils; +using namespace Utils; ConsoleProcess::ConsoleProcess(QObject *parent) : QObject(parent), diff --git a/src/libs/utils/consoleprocess_win.cpp b/src/libs/utils/consoleprocess_win.cpp index 9fcf5c976a272c9cb50c2d37b9cf1135d98dfb16..437295d0861669880d0085dd3c3cea8fd4f6cd00 100644 --- a/src/libs/utils/consoleprocess_win.cpp +++ b/src/libs/utils/consoleprocess_win.cpp @@ -40,7 +40,7 @@ #include <stdlib.h> -using namespace Core::Utils; +using namespace Utils; ConsoleProcess::ConsoleProcess(QObject *parent) : QObject(parent), diff --git a/src/libs/utils/fancylineedit.cpp b/src/libs/utils/fancylineedit.cpp index b7e8b770b87b27403c8345081c9b19d944ef455e..3f6d74d175538537240729891d9bc0d0404b2e6e 100644 --- a/src/libs/utils/fancylineedit.cpp +++ b/src/libs/utils/fancylineedit.cpp @@ -39,7 +39,6 @@ enum { margin = 6 }; -namespace Core { namespace Utils { static inline QString sideToStyleSheetString(FancyLineEdit::Side side) @@ -311,4 +310,3 @@ QString FancyLineEdit::typedText() const } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/fancylineedit.h b/src/libs/utils/fancylineedit.h index 4d6dfedff8eafad51c7eb9ed67ea0a7242034c67..754fccbbeb8a5a2e0f2a6c89e38f9c97d5bebb8d 100644 --- a/src/libs/utils/fancylineedit.h +++ b/src/libs/utils/fancylineedit.h @@ -34,7 +34,6 @@ #include <QtGui/QLineEdit> -namespace Core { namespace Utils { class FancyLineEditPrivate; @@ -107,6 +106,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // FANCYLINEEDIT_H diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp index eadb7f2ae27b821b86e2743e13408c38b0f3cc9c..09d05833669fb3201eafd94c4dd7d2871de1776d 100644 --- a/src/libs/utils/fancymainwindow.cpp +++ b/src/libs/utils/fancymainwindow.cpp @@ -35,7 +35,7 @@ #include <QtCore/QSettings> -using namespace Core::Utils; +using namespace Utils; FancyMainWindow::FancyMainWindow(QWidget *parent) : QMainWindow(parent), diff --git a/src/libs/utils/fancymainwindow.h b/src/libs/utils/fancymainwindow.h index 6f4f8668975ceec9da03f85623c2bfaf82fe6c0b..68420183e4a4f68f06cada4a5fb7d15cb48c62fe 100644 --- a/src/libs/utils/fancymainwindow.h +++ b/src/libs/utils/fancymainwindow.h @@ -41,7 +41,6 @@ QT_BEGIN_NAMESPACE class QSettings; QT_END_NAMESPACE -namespace Core { namespace Utils { class QTCREATOR_UTILS_EXPORT FancyMainWindow : public QMainWindow @@ -85,6 +84,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // FANCYMAINWINDOW_H diff --git a/src/libs/utils/filenamevalidatinglineedit.cpp b/src/libs/utils/filenamevalidatinglineedit.cpp index 359ee7a4bb9cad86b77c8de279812af53e73fe4b..70b064e9f48a8bad994f11ae62a1c97f1260f7b2 100644 --- a/src/libs/utils/filenamevalidatinglineedit.cpp +++ b/src/libs/utils/filenamevalidatinglineedit.cpp @@ -33,7 +33,6 @@ #include <QtCore/QRegExp> #include <QtCore/QDebug> -namespace Core { namespace Utils { #define WINDOWS_DEVICES "CON|AUX|PRN|COM1|COM2|LPT1|LPT2|NUL" @@ -133,4 +132,3 @@ bool FileNameValidatingLineEdit::validate(const QString &value, QString *errorM } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/filenamevalidatinglineedit.h b/src/libs/utils/filenamevalidatinglineedit.h index df5556f679a6fb2202530585e3e75b5b31460dbe..2648bb53014b83f76334d1324bad46cb34b854ca 100644 --- a/src/libs/utils/filenamevalidatinglineedit.h +++ b/src/libs/utils/filenamevalidatinglineedit.h @@ -32,7 +32,6 @@ #include "basevalidatinglineedit.h" -namespace Core { namespace Utils { /** @@ -67,6 +66,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // FILENAMEVALIDATINGLINEEDIT_H diff --git a/src/libs/utils/filesearch.cpp b/src/libs/utils/filesearch.cpp index a925e9069bfefc690473e0222e6bc93f9d30abd8..192fa34321c9db7c8cfe23c5ec72aab2d84c070f 100644 --- a/src/libs/utils/filesearch.cpp +++ b/src/libs/utils/filesearch.cpp @@ -40,11 +40,11 @@ #include <qtconcurrent/runextensions.h> -using namespace Core::Utils; +using namespace Utils; static inline QString msgCanceled(const QString &searchTerm, int numMatches, int numFilesSearched) { - return QCoreApplication::translate("Core::Utils::FileSearch", + return QCoreApplication::translate("Utils::FileSearch", "%1: canceled. %n occurrences found in %2 files.", 0, QCoreApplication::CodecForTr, numMatches). arg(searchTerm).arg(numFilesSearched); @@ -52,7 +52,7 @@ static inline QString msgCanceled(const QString &searchTerm, int numMatches, int static inline QString msgFound(const QString &searchTerm, int numMatches, int numFilesSearched) { - return QCoreApplication::translate("Core::Utils::FileSearch", + return QCoreApplication::translate("Utils::FileSearch", "%1: %n occurrences found in %2 files.", 0, QCoreApplication::CodecForTr, numMatches). arg(searchTerm).arg(numFilesSearched); @@ -60,7 +60,7 @@ static inline QString msgFound(const QString &searchTerm, int numMatches, int nu static inline QString msgFound(const QString &searchTerm, int numMatches, int numFilesSearched, int filesSize) { - return QCoreApplication::translate("Core::Utils::FileSearch", + return QCoreApplication::translate("Utils::FileSearch", "%1: %n occurrences found in %2 of %3 files.", 0, QCoreApplication::CodecForTr, numMatches). arg(searchTerm).arg(numFilesSearched).arg(filesSize); @@ -246,14 +246,14 @@ void runFileSearchRegExp(QFutureInterface<FileSearchResult> &future, } // namespace -QFuture<FileSearchResult> Core::Utils::findInFiles(const QString &searchTerm, const QStringList &files, +QFuture<FileSearchResult> Utils::findInFiles(const QString &searchTerm, const QStringList &files, QTextDocument::FindFlags flags, QMap<QString, QString> fileToContentsMap) { return QtConcurrent::run<FileSearchResult, QString, QStringList, QTextDocument::FindFlags, QMap<QString, QString> > (runFileSearch, searchTerm, files, flags, fileToContentsMap); } -QFuture<FileSearchResult> Core::Utils::findInFilesRegExp(const QString &searchTerm, const QStringList &files, +QFuture<FileSearchResult> Utils::findInFilesRegExp(const QString &searchTerm, const QStringList &files, QTextDocument::FindFlags flags, QMap<QString, QString> fileToContentsMap) { return QtConcurrent::run<FileSearchResult, QString, QStringList, QTextDocument::FindFlags, QMap<QString, QString> > diff --git a/src/libs/utils/filesearch.h b/src/libs/utils/filesearch.h index 59dd7d6b4e5c519902eaa379a9fd31f1764b2fb1..6609eb12c6f3a289e0b6cee31f42a278732a0469 100644 --- a/src/libs/utils/filesearch.h +++ b/src/libs/utils/filesearch.h @@ -37,7 +37,6 @@ #include <QtCore/QMap> #include <QtGui/QTextDocument> -namespace Core { namespace Utils { class QTCREATOR_UTILS_EXPORT FileSearchResult @@ -62,6 +61,5 @@ QTCREATOR_UTILS_EXPORT QFuture<FileSearchResult> findInFilesRegExp(const QString QTextDocument::FindFlags flags, QMap<QString, QString> fileToContentsMap = QMap<QString, QString>()); } // namespace Utils -} // namespace Core #endif // FILESEARCH_H diff --git a/src/libs/utils/filewizarddialog.cpp b/src/libs/utils/filewizarddialog.cpp index 5c1003cf265e874856bda986d274ed50638396f3..d1190b0d385d55f443dc20748724900e721fd191 100644 --- a/src/libs/utils/filewizarddialog.cpp +++ b/src/libs/utils/filewizarddialog.cpp @@ -32,7 +32,6 @@ #include <QtGui/QAbstractButton> -namespace Core { namespace Utils { FileWizardDialog::FileWizardDialog(QWidget *parent) : @@ -69,4 +68,3 @@ void FileWizardDialog::setName(const QString &name) } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/filewizarddialog.h b/src/libs/utils/filewizarddialog.h index c4baf284d0ecb76ef3384fa8dcf662a5f81d4510..c408543bb411dfc52d0e5e063b8656fbd46d0bdb 100644 --- a/src/libs/utils/filewizarddialog.h +++ b/src/libs/utils/filewizarddialog.h @@ -34,7 +34,6 @@ #include <QtGui/QWizard> -namespace Core { namespace Utils { class FileWizardPage; @@ -62,6 +61,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // FILEWIZARDDIALOG_H diff --git a/src/libs/utils/filewizardpage.cpp b/src/libs/utils/filewizardpage.cpp index d2901d468f1bc36930af3b29aa0bc92650a30a81..06db5d5c280c2f8f5c3e175ec8726b0e8bdafcdf 100644 --- a/src/libs/utils/filewizardpage.cpp +++ b/src/libs/utils/filewizardpage.cpp @@ -30,7 +30,6 @@ #include "filewizardpage.h" #include "ui_filewizardpage.h" -namespace Core { namespace Utils { struct FileWizardPagePrivate @@ -130,4 +129,3 @@ bool FileWizardPage::validateBaseName(const QString &name, QString *errorMessage } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/filewizardpage.h b/src/libs/utils/filewizardpage.h index f2099c73dccc83fdc29ce93803566fe0c9397b1a..fd2ded147b0c8a422103bcf11cbe13fb91d719f6 100644 --- a/src/libs/utils/filewizardpage.h +++ b/src/libs/utils/filewizardpage.h @@ -34,7 +34,6 @@ #include <QtGui/QWizardPage> -namespace Core { namespace Utils { struct FileWizardPagePrivate; @@ -87,6 +86,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // FILEWIZARDPAGE_H diff --git a/src/libs/utils/filewizardpage.ui b/src/libs/utils/filewizardpage.ui index fea35b9c5b80f7bdad5b5efd140da5e8d4594f40..2657a586bdd350cda06dc504f6bfced6cb5ff82d 100644 --- a/src/libs/utils/filewizardpage.ui +++ b/src/libs/utils/filewizardpage.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Core::Utils::WizardPage</class> - <widget class="QWizardPage" name="Core::Utils::WizardPage"> + <class>Utils::WizardPage</class> + <widget class="QWizardPage" name="Utils::WizardPage"> <property name="geometry"> <rect> <x>0</x> @@ -22,7 +22,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="Core::Utils::FileNameValidatingLineEdit" name="nameLineEdit"/> + <widget class="Utils::FileNameValidatingLineEdit" name="nameLineEdit"/> </item> <item row="1" column="0"> <widget class="QLabel" name="pathLabel"> @@ -32,19 +32,19 @@ </widget> </item> <item row="1" column="1"> - <widget class="Core::Utils::PathChooser" name="pathChooser" native="true"/> + <widget class="Utils::PathChooser" name="pathChooser" native="true"/> </item> </layout> </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header>pathchooser.h</header> <container>1</container> </customwidget> <customwidget> - <class>Core::Utils::FileNameValidatingLineEdit</class> + <class>Utils::FileNameValidatingLineEdit</class> <extends>QLineEdit</extends> <header>filenamevalidatinglineedit.h</header> </customwidget> diff --git a/src/libs/utils/linecolumnlabel.cpp b/src/libs/utils/linecolumnlabel.cpp index b5b6d88f53be4b4e6ba8ba7dadd67a8c1ba5e355..2f8756e40a82314580fa50476a212efc83761e88 100644 --- a/src/libs/utils/linecolumnlabel.cpp +++ b/src/libs/utils/linecolumnlabel.cpp @@ -29,7 +29,6 @@ #include "linecolumnlabel.h" -namespace Core { namespace Utils { LineColumnLabel::LineColumnLabel(QWidget *parent) @@ -62,4 +61,3 @@ void LineColumnLabel::setMaxText(const QString &maxText) } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/linecolumnlabel.h b/src/libs/utils/linecolumnlabel.h index 335d74e36eff31cacb95d03205e1170db90f6e82..c3158daa3bcd0374d6c4ab10eda824d6f019da97 100644 --- a/src/libs/utils/linecolumnlabel.h +++ b/src/libs/utils/linecolumnlabel.h @@ -33,7 +33,6 @@ #include "utils_global.h" #include <QtGui/QLabel> -namespace Core { namespace Utils { /* A label suitable for displaying cursor positions, etc. with a fixed @@ -61,6 +60,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // LINECOLUMNLABEL_H diff --git a/src/libs/utils/listutils.h b/src/libs/utils/listutils.h index b9475f2c636337482251797d9d05b8d37100f9d1..23224ba4595b98324f3899168ee497a942fe74ea 100644 --- a/src/libs/utils/listutils.h +++ b/src/libs/utils/listutils.h @@ -32,7 +32,6 @@ #include <QtCore/QList> -namespace Core { namespace Utils { template <class T1, class T2> @@ -46,6 +45,5 @@ QList<T1> qwConvertList(const QList<T2> &list) } } // namespace Utils -} // namespace Core #endif // LISTUTILS_H diff --git a/src/libs/utils/newclasswidget.cpp b/src/libs/utils/newclasswidget.cpp index 95af0d542f782976cfae31a39fbb2381b5ca968d..42265a062e1cfb4fc51c49486ab2310f44e16546 100644 --- a/src/libs/utils/newclasswidget.cpp +++ b/src/libs/utils/newclasswidget.cpp @@ -41,7 +41,6 @@ enum { debugNewClassWidget = 0 }; -namespace Core { namespace Utils { struct NewClassWidgetPrivate { @@ -485,4 +484,3 @@ QStringList NewClassWidget::files() const } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/newclasswidget.h b/src/libs/utils/newclasswidget.h index c762c247e00686d60e046d5ee56af48a01de5858..52d03720a8eb487014f056d47d60d4da7f28f6d2 100644 --- a/src/libs/utils/newclasswidget.h +++ b/src/libs/utils/newclasswidget.h @@ -38,7 +38,6 @@ QT_BEGIN_NAMESPACE class QStringList; QT_END_NAMESPACE -namespace Core { namespace Utils { struct NewClassWidgetPrivate; @@ -157,6 +156,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // NEWCLASSWIDGET_H diff --git a/src/libs/utils/newclasswidget.ui b/src/libs/utils/newclasswidget.ui index 4399a850a18e6e3b5ae3d9092b15c8c84d0ab9cc..76a093a76fb37673085abae10cfd0c8b50dfed3c 100644 --- a/src/libs/utils/newclasswidget.ui +++ b/src/libs/utils/newclasswidget.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Core::Utils::NewClassWidget</class> - <widget class="QWidget" name="Core::Utils::NewClassWidget"> + <class>Utils::NewClassWidget</class> + <widget class="QWidget" name="Utils::NewClassWidget"> <layout class="QFormLayout" name="formLayout"> <property name="fieldGrowthPolicy"> <enum>QFormLayout::ExpandingFieldsGrow</enum> @@ -17,7 +17,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="Core::Utils::ClassNameValidatingLineEdit" name="classLineEdit"/> + <widget class="Utils::ClassNameValidatingLineEdit" name="classLineEdit"/> </item> <item row="1" column="0"> <widget class="QLabel" name="baseClassLabel"> @@ -76,7 +76,7 @@ </widget> </item> <item row="3" column="1"> - <widget class="Core::Utils::FileNameValidatingLineEdit" name="headerFileLineEdit"/> + <widget class="Utils::FileNameValidatingLineEdit" name="headerFileLineEdit"/> </item> <item row="4" column="0"> <widget class="QLabel" name="sourceLabel"> @@ -86,7 +86,7 @@ </widget> </item> <item row="4" column="1"> - <widget class="Core::Utils::FileNameValidatingLineEdit" name="sourceFileLineEdit"/> + <widget class="Utils::FileNameValidatingLineEdit" name="sourceFileLineEdit"/> </item> <item row="5" column="0"> <widget class="QLabel" name="generateFormLabel"> @@ -103,7 +103,7 @@ </widget> </item> <item row="6" column="1"> - <widget class="Core::Utils::FileNameValidatingLineEdit" name="formFileLineEdit"/> + <widget class="Utils::FileNameValidatingLineEdit" name="formFileLineEdit"/> </item> <item row="7" column="0"> <widget class="QLabel" name="pathLabel"> @@ -113,7 +113,7 @@ </widget> </item> <item row="7" column="1"> - <widget class="Core::Utils::PathChooser" name="pathChooser" native="true"/> + <widget class="Utils::PathChooser" name="pathChooser" native="true"/> </item> <item row="5" column="1"> <widget class="QCheckBox" name="generateFormCheckBox"> @@ -126,18 +126,18 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">pathchooser.h</header> <container>1</container> </customwidget> <customwidget> - <class>Core::Utils::ClassNameValidatingLineEdit</class> + <class>Utils::ClassNameValidatingLineEdit</class> <extends>QLineEdit</extends> <header>classnamevalidatinglineedit.h</header> </customwidget> <customwidget> - <class>Core::Utils::FileNameValidatingLineEdit</class> + <class>Utils::FileNameValidatingLineEdit</class> <extends>QLineEdit</extends> <header location="global">utils/filenamevalidatinglineedit.h</header> </customwidget> diff --git a/src/libs/utils/parameteraction.cpp b/src/libs/utils/parameteraction.cpp index 3653d1ca8f0c46267e0c145ee7896c8453804224..1ab37e7085656f897fa7a1911972df136310c8d2 100644 --- a/src/libs/utils/parameteraction.cpp +++ b/src/libs/utils/parameteraction.cpp @@ -1,6 +1,5 @@ #include "parameteraction.h" -namespace Core { namespace Utils { ParameterAction::ParameterAction(const QString &emptyText, @@ -57,5 +56,3 @@ void ParameterAction::setParameter(const QString &p) } } -} - diff --git a/src/libs/utils/parameteraction.h b/src/libs/utils/parameteraction.h index 2f6444e43bc33bc4e398fcaf5667b59cdc147fd4..8f047d323b5df64b4469d8b0e826ef9e82a9ac24 100644 --- a/src/libs/utils/parameteraction.h +++ b/src/libs/utils/parameteraction.h @@ -34,7 +34,6 @@ #include <QtGui/QAction> -namespace Core { namespace Utils { /* ParameterAction: Intended for actions that act on a 'current', @@ -79,7 +78,6 @@ private: EnablingMode m_enablingMode; }; -} } #endif // PARAMETERACTION_H diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index c0503c402bb7f4ca130c8ccf2b0ed4afff4482a0..c550ecbc39f5a7c5815dd767ca8f14c68789b3c5 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -44,14 +44,13 @@ #include <QtGui/QToolButton> #include <QtGui/QPushButton> -/*static*/ const char * const Core::Utils::PathChooser::browseButtonLabel = +/*static*/ const char * const Utils::PathChooser::browseButtonLabel = #ifdef Q_WS_MAC - QT_TRANSLATE_NOOP("Core::Utils::PathChooser", "Choose..."); + QT_TRANSLATE_NOOP("Utils::PathChooser", "Choose..."); #else - QT_TRANSLATE_NOOP("Core::Utils::PathChooser", "Browse..."); + QT_TRANSLATE_NOOP("Utils::PathChooser", "Browse..."); #endif -namespace Core { namespace Utils { // ------------------ PathValidatingLineEdit @@ -324,4 +323,3 @@ QString PathChooser::makeDialogTitle(const QString &title) } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/pathchooser.h b/src/libs/utils/pathchooser.h index 88b9215115efdc22ae7467ce520839960a7abe6c..ee3e6eaf40cc29576a418718a5de5fb5d80006a7 100644 --- a/src/libs/utils/pathchooser.h +++ b/src/libs/utils/pathchooser.h @@ -35,7 +35,6 @@ #include <QtGui/QWidget> #include <QtGui/QAbstractButton> -namespace Core { namespace Utils { struct PathChooserPrivate; @@ -117,6 +116,6 @@ private: }; } // namespace Utils -} // namespace Core + #endif // PATHCHOOSER_H diff --git a/src/libs/utils/pathlisteditor.cpp b/src/libs/utils/pathlisteditor.cpp index ef315f9bf5bfbced0d3f1baf72bab45b2345b1c5..c0f498b8b2cbb988440a1d788de526e8dcb60d9a 100644 --- a/src/libs/utils/pathlisteditor.cpp +++ b/src/libs/utils/pathlisteditor.cpp @@ -46,7 +46,6 @@ #include <QtCore/QDir> #include <QtCore/QDebug> -namespace Core { namespace Utils { // ------------ PathListPlainTextEdit: @@ -310,4 +309,3 @@ void PathListEditor::deletePathAtCursor() } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/pathlisteditor.h b/src/libs/utils/pathlisteditor.h index 1613819e7a8f2621ec0cf8d84f3c452986c78636..bcab6530021ea5ca766f428e2577aaa72ab21a34 100644 --- a/src/libs/utils/pathlisteditor.h +++ b/src/libs/utils/pathlisteditor.h @@ -39,7 +39,6 @@ QT_BEGIN_NAMESPACE class QAction; QT_END_NAMESPACE -namespace Core { namespace Utils { struct PathListEditorPrivate; @@ -105,6 +104,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // PATHLISTEDITOR_H diff --git a/src/libs/utils/projectintropage.cpp b/src/libs/utils/projectintropage.cpp index ec26dacd205dedc1b4db24649fd23ec1753ee900..da66bb644990badc2dde8d195844144f7f5473ff 100644 --- a/src/libs/utils/projectintropage.cpp +++ b/src/libs/utils/projectintropage.cpp @@ -35,7 +35,6 @@ #include <QtCore/QDir> #include <QtCore/QFileInfo> -namespace Core { namespace Utils { struct ProjectIntroPagePrivate @@ -210,4 +209,3 @@ void ProjectIntroPage::hideStatusLabel() } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/projectintropage.h b/src/libs/utils/projectintropage.h index ecc3354787d312b4c3063af9f4706a45ff9ad040..9e127ee64658ae5b231940a0032d0db769fdce74 100644 --- a/src/libs/utils/projectintropage.h +++ b/src/libs/utils/projectintropage.h @@ -34,7 +34,6 @@ #include <QtGui/QWizardPage> -namespace Core { namespace Utils { struct ProjectIntroPagePrivate; @@ -101,6 +100,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // PROJECTINTROPAGE_H diff --git a/src/libs/utils/projectintropage.ui b/src/libs/utils/projectintropage.ui index 62efa2d9fecab62b3083c48aae9ed8570afe3e27..b527a25420e083e3346436b790cf030449aada40 100644 --- a/src/libs/utils/projectintropage.ui +++ b/src/libs/utils/projectintropage.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Core::Utils::ProjectIntroPage</class> - <widget class="QWizardPage" name="Core::Utils::ProjectIntroPage"> + <class>Utils::ProjectIntroPage</class> + <widget class="QWizardPage" name="Utils::ProjectIntroPage"> <property name="geometry"> <rect> <x>0</x> @@ -59,7 +59,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="Core::Utils::ProjectNameValidatingLineEdit" name="nameLineEdit"/> + <widget class="Utils::ProjectNameValidatingLineEdit" name="nameLineEdit"/> </item> <item row="1" column="0"> <widget class="QLabel" name="pathLabel"> @@ -69,7 +69,7 @@ </widget> </item> <item row="1" column="1"> - <widget class="Core::Utils::PathChooser" name="pathChooser" native="true"/> + <widget class="Utils::PathChooser" name="pathChooser" native="true"/> </item> </layout> </widget> @@ -97,13 +97,13 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header>pathchooser.h</header> <container>1</container> </customwidget> <customwidget> - <class>Core::Utils::ProjectNameValidatingLineEdit</class> + <class>Utils::ProjectNameValidatingLineEdit</class> <extends>QLineEdit</extends> <header>projectnamevalidatinglineedit.h</header> </customwidget> diff --git a/src/libs/utils/projectnamevalidatinglineedit.cpp b/src/libs/utils/projectnamevalidatinglineedit.cpp index 693bc3e248faf56b40f0ddc3e618f233b191c3f7..f4762a5ed99c4e6f1fb207ab9d155a16e5100e49 100644 --- a/src/libs/utils/projectnamevalidatinglineedit.cpp +++ b/src/libs/utils/projectnamevalidatinglineedit.cpp @@ -30,7 +30,6 @@ #include "projectnamevalidatinglineedit.h" #include "filenamevalidatinglineedit.h" -namespace Core { namespace Utils { ProjectNameValidatingLineEdit::ProjectNameValidatingLineEdit(QWidget *parent) @@ -60,4 +59,3 @@ bool ProjectNameValidatingLineEdit::validate(const QString &value, QString *erro } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/projectnamevalidatinglineedit.h b/src/libs/utils/projectnamevalidatinglineedit.h index 5f1275999d9a04ff5d46755ccedc4df21ddae237..f8596dfad6a6025de67f36aad80ecdbdd3abe756 100644 --- a/src/libs/utils/projectnamevalidatinglineedit.h +++ b/src/libs/utils/projectnamevalidatinglineedit.h @@ -32,7 +32,6 @@ #include "basevalidatinglineedit.h" -namespace Core { namespace Utils { class QTCREATOR_UTILS_EXPORT ProjectNameValidatingLineEdit : public BaseValidatingLineEdit @@ -50,6 +49,5 @@ protected: }; } // namespace Utils -} // namespace Core #endif // PROJECTNAMEVALIDATINGLINEEDIT_H diff --git a/src/libs/utils/qtcolorbutton.cpp b/src/libs/utils/qtcolorbutton.cpp index 0f32e61bc5bd8978f916ecd1acf4f26e4809c362..9ba39b0305258dd3c14e764b39dea7699672aba5 100644 --- a/src/libs/utils/qtcolorbutton.cpp +++ b/src/libs/utils/qtcolorbutton.cpp @@ -35,7 +35,6 @@ #include <QtGui/QDragEnterEvent> #include <QtGui/QPainter> -namespace Core { namespace Utils { class QtColorButtonPrivate @@ -283,6 +282,5 @@ void QtColorButton::dropEvent(QDropEvent *event) #endif } // namespace Utils -} // namespace Core #include "moc_qtcolorbutton.cpp" diff --git a/src/libs/utils/qtcolorbutton.h b/src/libs/utils/qtcolorbutton.h index 67b0148b3f83ccdd6eff3032fa2e5722e7451902..f7c35c87619d5c5b214d5966410f88d45e2de54d 100644 --- a/src/libs/utils/qtcolorbutton.h +++ b/src/libs/utils/qtcolorbutton.h @@ -34,7 +34,6 @@ #include <QtGui/QToolButton> -namespace Core { namespace Utils { class QTCREATOR_UTILS_EXPORT QtColorButton : public QToolButton @@ -76,6 +75,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // QTCOLORBUTTON_H diff --git a/src/libs/utils/reloadpromptutils.cpp b/src/libs/utils/reloadpromptutils.cpp index 7b00845a36fd610e49c04c82b2c803e227532bb5..1d0015a5bf8e05d85e1b76ccf441a3d13e58ecba 100644 --- a/src/libs/utils/reloadpromptutils.cpp +++ b/src/libs/utils/reloadpromptutils.cpp @@ -33,27 +33,26 @@ #include <QtCore/QCoreApplication> #include <QtCore/QDir> -using namespace Core; -using namespace Core::Utils; +using namespace Utils; -QTCREATOR_UTILS_EXPORT Core::Utils::ReloadPromptAnswer - Core::Utils::reloadPrompt(const QString &fileName, bool modified, QWidget *parent) +QTCREATOR_UTILS_EXPORT Utils::ReloadPromptAnswer + Utils::reloadPrompt(const QString &fileName, bool modified, QWidget *parent) { - const QString title = QCoreApplication::translate("Core::Utils::reloadPrompt", "File Changed"); + const QString title = QCoreApplication::translate("Utils::reloadPrompt", "File Changed"); QString msg; if (modified) - msg = QCoreApplication::translate("Core::Utils::reloadPrompt", + msg = QCoreApplication::translate("Utils::reloadPrompt", "The unsaved file %1 has been changed outside Qt Creator. Do you want to reload it and discard your changes?").arg(QDir::toNativeSeparators(fileName)); else - msg = QCoreApplication::translate("Core::Utils::reloadPrompt", + msg = QCoreApplication::translate("Utils::reloadPrompt", "The file %1 has changed outside Qt Creator. Do you want to reload it?").arg(QDir::toNativeSeparators(fileName)); return reloadPrompt(title, msg, parent); } -QTCREATOR_UTILS_EXPORT Core::Utils::ReloadPromptAnswer - Core::Utils::reloadPrompt(const QString &title, const QString &prompt, QWidget *parent) +QTCREATOR_UTILS_EXPORT Utils::ReloadPromptAnswer + Utils::reloadPrompt(const QString &title, const QString &prompt, QWidget *parent) { switch (QMessageBox::question(parent, title, prompt, QMessageBox::Yes|QMessageBox::YesToAll|QMessageBox::No|QMessageBox::NoToAll, diff --git a/src/libs/utils/reloadpromptutils.h b/src/libs/utils/reloadpromptutils.h index a35b55d8f7035ea760e8f9bfc0f90aa3f0fc79c3..04ae1bbb4c7e5353396810d489bbb3628eb8a01a 100644 --- a/src/libs/utils/reloadpromptutils.h +++ b/src/libs/utils/reloadpromptutils.h @@ -37,7 +37,6 @@ class QString; class QWidget; QT_END_NAMESPACE -namespace Core { namespace Utils { enum ReloadPromptAnswer { ReloadCurrent, ReloadAll, ReloadSkipCurrent, ReloadNone }; @@ -46,6 +45,5 @@ QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &fileName, QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const QString &title, const QString &prompt, QWidget *parent); } // namespace Utils -} // namespace Core #endif // RELOADPROMPTUTILS_H diff --git a/src/libs/utils/savedaction.cpp b/src/libs/utils/savedaction.cpp index bf406f0b233fe5ba15d28bff736052c2a382ec22..e3833bebb6e3ae121467a0022a0fa7b5c72042c3 100644 --- a/src/libs/utils/savedaction.cpp +++ b/src/libs/utils/savedaction.cpp @@ -44,7 +44,7 @@ #include <QtGui/QSpinBox> -using namespace Core::Utils; +using namespace Utils; ////////////////////////////////////////////////////////////////////////// @@ -54,7 +54,7 @@ using namespace Core::Utils; ////////////////////////////////////////////////////////////////////////// /*! - \class Core::Utils::SavedAction + \class Utils::SavedAction \brief The SavedAction class is a helper class for actions with persistent state. diff --git a/src/libs/utils/savedaction.h b/src/libs/utils/savedaction.h index 2e0857a7213c7f5b8b5c83e3653f21d8bf484956..4306a800bd9468116e091a8fd0a0cbbd3abb8c51 100644 --- a/src/libs/utils/savedaction.h +++ b/src/libs/utils/savedaction.h @@ -42,8 +42,6 @@ QT_BEGIN_NAMESPACE class QSettings; QT_END_NAMESPACE - -namespace Core { namespace Utils { enum ApplyMode { ImmediateApply, DeferedApply }; @@ -122,6 +120,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // SAVED_ACTION_H diff --git a/src/libs/utils/settingsutils.cpp b/src/libs/utils/settingsutils.cpp index 024c1c09fa2a81dbe2d8bb0c4568d2a65c07d00f..14727b364548f19116d17f6fa6363ad19c8ae56a 100644 --- a/src/libs/utils/settingsutils.cpp +++ b/src/libs/utils/settingsutils.cpp @@ -31,7 +31,6 @@ #include <QtCore/QString> -namespace Core { namespace Utils { QTCREATOR_UTILS_EXPORT QString settingsKey(const QString &category) @@ -48,4 +47,3 @@ QTCREATOR_UTILS_EXPORT QString settingsKey(const QString &category) } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/settingsutils.h b/src/libs/utils/settingsutils.h index bd7d83535841d89ed80d8e04e1c836523d0fd38b..0e1aac3f450b1c79355e9276847a08634e9dcfb2 100644 --- a/src/libs/utils/settingsutils.h +++ b/src/libs/utils/settingsutils.h @@ -32,7 +32,6 @@ #include "utils_global.h" -namespace Core { namespace Utils { // Create a usable settings key from a category, @@ -40,6 +39,5 @@ namespace Utils { QTCREATOR_UTILS_EXPORT QString settingsKey(const QString &category); } // namespace Utils -} // namespace Core #endif // SETTINGSTUTILS_H diff --git a/src/libs/utils/styledbar.cpp b/src/libs/utils/styledbar.cpp index 60eb6392167ef43294030df8dca6019fbe8e1934..12b0b82826e799723a7d9935871ab3238db97c6d 100644 --- a/src/libs/utils/styledbar.cpp +++ b/src/libs/utils/styledbar.cpp @@ -37,7 +37,7 @@ #include <QtGui/QStyle> #include <QtGui/QStyleOption> -using namespace Core::Utils; +using namespace Utils; StyledBar::StyledBar(QWidget *parent) : QWidget(parent) diff --git a/src/libs/utils/styledbar.h b/src/libs/utils/styledbar.h index 9171a3dbaef81114290baca38f3f7f270e9ca65e..b79aa92be04cf91093733b8cbb0f3ba7bc405172 100644 --- a/src/libs/utils/styledbar.h +++ b/src/libs/utils/styledbar.h @@ -34,7 +34,6 @@ #include <QtGui/QWidget> -namespace Core { namespace Utils { class QTCREATOR_UTILS_EXPORT StyledBar : public QWidget @@ -56,6 +55,5 @@ protected: }; } // Utils -} // Core #endif // STYLEDBAR_H diff --git a/src/libs/utils/stylehelper.cpp b/src/libs/utils/stylehelper.cpp index 0544bd2569fcaa678f34013da197bc9f3fd33e7d..3087894c8db231505068ae3fcb3dfcc7357e866e 100644 --- a/src/libs/utils/stylehelper.cpp +++ b/src/libs/utils/stylehelper.cpp @@ -52,6 +52,8 @@ static int range(float x, int min, int max) } */ +namespace Utils { + QColor StyleHelper::mergedColors(const QColor &colorA, const QColor &colorB, int factor) { const int maxFactor = 100; @@ -231,3 +233,5 @@ void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const Q QPixmapCache::insert(key, pixmap); } } + +} // namespace Utils diff --git a/src/libs/utils/stylehelper.h b/src/libs/utils/stylehelper.h index b2be66f748818cb771dfb655335b2fb8b2c7fc05..a314f2e4aeb34daedee1d073fc85118cd7f1313a 100644 --- a/src/libs/utils/stylehelper.h +++ b/src/libs/utils/stylehelper.h @@ -42,6 +42,7 @@ QT_END_NAMESPACE // Helper class holding all custom color values +namespace Utils { class QTCREATOR_UTILS_EXPORT StyleHelper { public: @@ -74,4 +75,5 @@ private: static QColor m_baseColor; }; +} // namespace Utils #endif // STYLEHELPER_H diff --git a/src/libs/utils/submiteditorwidget.cpp b/src/libs/utils/submiteditorwidget.cpp index 1bd1abc110e6bcd8ef067ada30581ea5265ee082..3433329d526bc2b6cd570c7d0109d5154e2dc835 100644 --- a/src/libs/utils/submiteditorwidget.cpp +++ b/src/libs/utils/submiteditorwidget.cpp @@ -44,7 +44,6 @@ enum { debug = 0 }; enum { defaultLineWidth = 72 }; -namespace Core { namespace Utils { // QActionPushButton: A push button tied to an action @@ -505,6 +504,5 @@ void SubmitEditorWidget::editorCustomContextMenuRequested(const QPoint &pos) } } // namespace Utils -} // namespace Core #include "submiteditorwidget.moc" diff --git a/src/libs/utils/submiteditorwidget.h b/src/libs/utils/submiteditorwidget.h index 2559635b799353e98a52b64b4430197867ed7eb7..6ec7da52c037ee9923cd731bbcb9c6ddb3a302d5 100644 --- a/src/libs/utils/submiteditorwidget.h +++ b/src/libs/utils/submiteditorwidget.h @@ -44,7 +44,6 @@ class QModelIndex; class QLineEdit; QT_END_NAMESPACE -namespace Core { namespace Utils { class SubmitFieldWidget; @@ -144,6 +143,5 @@ private: }; } // namespace Utils -} // namespace Core #endif // SUBMITEDITORWIDGET_H diff --git a/src/libs/utils/submiteditorwidget.ui b/src/libs/utils/submiteditorwidget.ui index 7015a2c75b4d6c22ca7b77c094e4a292010d12c2..957210e40a5f7199ba1bd69bd4551479f7e38ff9 100644 --- a/src/libs/utils/submiteditorwidget.ui +++ b/src/libs/utils/submiteditorwidget.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Core::Utils::SubmitEditorWidget</class> - <widget class="QWidget" name="Core::Utils::SubmitEditorWidget"> + <class>Utils::SubmitEditorWidget</class> + <widget class="QWidget" name="Utils::SubmitEditorWidget"> <property name="geometry"> <rect> <x>0</x> diff --git a/src/libs/utils/submitfieldwidget.cpp b/src/libs/utils/submitfieldwidget.cpp index d371595218025d1d4141e4ce6335b81389936747..f1c271bc03b117bad5229d85b004d0e44ce82c56 100644 --- a/src/libs/utils/submitfieldwidget.cpp +++ b/src/libs/utils/submitfieldwidget.cpp @@ -22,8 +22,7 @@ static void inline setComboBlocked(QComboBox *cb, int index) cb->blockSignals(blocked); } -namespace Core { - namespace Utils { +namespace Utils { // Field/Row entry struct FieldEntry { @@ -341,4 +340,3 @@ void SubmitFieldWidget::slotBrowseButtonClicked() } } -} diff --git a/src/libs/utils/submitfieldwidget.h b/src/libs/utils/submitfieldwidget.h index 08e834bfb49feebd9de252f8f7f1b2b1177df0c1..870180790b8eb598abb6a24f2bbd9a9ab1257fe9 100644 --- a/src/libs/utils/submitfieldwidget.h +++ b/src/libs/utils/submitfieldwidget.h @@ -9,8 +9,7 @@ QT_BEGIN_NAMESPACE class QCompleter; QT_END_NAMESPACE -namespace Core { - namespace Utils { +namespace Utils { struct SubmitFieldWidgetPrivate; @@ -65,7 +64,6 @@ private: SubmitFieldWidgetPrivate *m_d; }; -} } #endif // SUBMITFIELDWIDGET_H diff --git a/src/libs/utils/synchronousprocess.cpp b/src/libs/utils/synchronousprocess.cpp index 07fd6df9751e5ea35c729c25ba5a03b7ae68f7c9..9486caa5a0125536b2434c39ae95f766c36f944f 100644 --- a/src/libs/utils/synchronousprocess.cpp +++ b/src/libs/utils/synchronousprocess.cpp @@ -44,7 +44,6 @@ enum { debug = 0 }; enum { defaultMaxHangTimerCount = 10 }; -namespace Core { namespace Utils { // ----------- SynchronousProcessResponse @@ -492,6 +491,4 @@ QChar SynchronousProcess::pathSeparator() return QLatin1Char(':'); } - } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/synchronousprocess.h b/src/libs/utils/synchronousprocess.h index 31562a598aeb842390b511df54408bda334233ca..86f45060cd0a64c663d6c57613502d02e2ac8a6d 100644 --- a/src/libs/utils/synchronousprocess.h +++ b/src/libs/utils/synchronousprocess.h @@ -42,7 +42,6 @@ class QDebug; class QByteArray; QT_END_NAMESPACE -namespace Core { namespace Utils { struct SynchronousProcessPrivate; @@ -146,6 +145,5 @@ private: }; } // namespace Utils -} // namespace Core #endif diff --git a/src/libs/utils/treewidgetcolumnstretcher.cpp b/src/libs/utils/treewidgetcolumnstretcher.cpp index d33c04ac4ea547a09ac35b9fe6c78f258732c4c9..a8e49d3e1df96214f27af31998a830c257ebf226 100644 --- a/src/libs/utils/treewidgetcolumnstretcher.cpp +++ b/src/libs/utils/treewidgetcolumnstretcher.cpp @@ -2,7 +2,7 @@ #include <QtGui/QTreeWidget> #include <QtGui/QHideEvent> #include <QtGui/QHeaderView> -using namespace Core::Utils; +using namespace Utils; TreeWidgetColumnStretcher::TreeWidgetColumnStretcher(QTreeWidget *treeWidget, int columnToStretch) : QObject(treeWidget->header()), m_columnToStretch(columnToStretch) diff --git a/src/libs/utils/treewidgetcolumnstretcher.h b/src/libs/utils/treewidgetcolumnstretcher.h index b40368a46c98cbc070f5126a7f2f975687038fbd..f8f1668ff6145b262a4a3859a22880855c9be135 100644 --- a/src/libs/utils/treewidgetcolumnstretcher.h +++ b/src/libs/utils/treewidgetcolumnstretcher.h @@ -37,7 +37,6 @@ QT_BEGIN_NAMESPACE class QTreeWidget; QT_END_NAMESPACE -namespace Core { namespace Utils { /* @@ -58,6 +57,5 @@ public: }; } // namespace Utils -} // namespace Core #endif // TREEWIDGETCOLUMNSTRETCHER_H diff --git a/src/libs/utils/uncommentselection.cpp b/src/libs/utils/uncommentselection.cpp index 7cac84ce5955f082f5ada9e175b49ca07191e893..f59e56835ecd64ec0e777befdc4c8f45f846bbdd 100644 --- a/src/libs/utils/uncommentselection.cpp +++ b/src/libs/utils/uncommentselection.cpp @@ -33,7 +33,7 @@ #include <QtGui/QTextBlock> #include <QtGui/QTextDocument> -void Core::Utils::unCommentSelection(QPlainTextEdit *edit) +void Utils::unCommentSelection(QPlainTextEdit *edit) { QTextCursor cursor = edit->textCursor(); QTextDocument *doc = cursor.document(); diff --git a/src/libs/utils/uncommentselection.h b/src/libs/utils/uncommentselection.h index aff5a9eedf37919aef3012a5c10192a7e4b4a13f..4d7bb7a1cd04754a43369eed4beb3a215d9b8e13 100644 --- a/src/libs/utils/uncommentselection.h +++ b/src/libs/utils/uncommentselection.h @@ -36,12 +36,10 @@ QT_BEGIN_NAMESPACE class QPlainTextEdit; QT_END_NAMESPACE -namespace Core { namespace Utils { QTCREATOR_UTILS_EXPORT void unCommentSelection(QPlainTextEdit *edit); } // end of namespace Utils -} // end of namespace Core #endif // UNCOMMENTSELECTION_H diff --git a/src/libs/utils/welcomemodetreewidget.cpp b/src/libs/utils/welcomemodetreewidget.cpp index 3002e69202d12ccf24bf937abb1cd5f165128a61..1fd3b52a432741f42c5b59d69249e474473330cd 100644 --- a/src/libs/utils/welcomemodetreewidget.cpp +++ b/src/libs/utils/welcomemodetreewidget.cpp @@ -33,8 +33,7 @@ #include <QtGui/QBoxLayout> #include <QtGui/QHeaderView> -namespace Core { - namespace Utils { +namespace Utils { void WelcomeModeLabel::setStyledText(const QString &text) { @@ -115,4 +114,3 @@ void WelcomeModeTreeWidget::slotItemClicked(QTreeWidgetItem *item) } } -} diff --git a/src/libs/utils/welcomemodetreewidget.h b/src/libs/utils/welcomemodetreewidget.h index 5b35ee651cef89a06fba6731fd19a8dbbe390c06..61ae5b6de8cbe3ae79b0521d22b31e117a60fdbc 100644 --- a/src/libs/utils/welcomemodetreewidget.h +++ b/src/libs/utils/welcomemodetreewidget.h @@ -35,8 +35,7 @@ #include <QtGui/QTreeWidget> #include <QtGui/QLabel> -namespace Core { - namespace Utils { +namespace Utils { struct WelcomeModeTreeWidgetPrivate; struct WelcomeModeLabelPrivate; @@ -76,7 +75,6 @@ private: WelcomeModeTreeWidgetPrivate *m_d; }; -} } #endif // WELCOMEMODETREEWIDGET_H diff --git a/src/libs/utils/winutils.cpp b/src/libs/utils/winutils.cpp index 2048f810d427018df307c7e1c03ab0b589a7849c..7815d553fb9fcb0a44b7c52906ee9b15d16e42d5 100644 --- a/src/libs/utils/winutils.cpp +++ b/src/libs/utils/winutils.cpp @@ -32,7 +32,6 @@ #include <QtCore/QString> -namespace Core { namespace Utils { QTCREATOR_UTILS_EXPORT QString winErrorMessage(unsigned long error) @@ -53,4 +52,3 @@ QTCREATOR_UTILS_EXPORT QString winErrorMessage(unsigned long error) } } // namespace Utils -} // namespace Core diff --git a/src/libs/utils/winutils.h b/src/libs/utils/winutils.h index 770c7afda9553ee77d9bf451402dc5404ecb69a7..19b8986ce1b6192321a73c720b5c812942cdabcd 100644 --- a/src/libs/utils/winutils.h +++ b/src/libs/utils/winutils.h @@ -36,7 +36,6 @@ QT_BEGIN_NAMESPACE class QString; QT_END_NAMESPACE -namespace Core { namespace Utils { // Helper to format a Windows error message, taking the @@ -44,5 +43,4 @@ namespace Utils { QTCREATOR_UTILS_EXPORT QString winErrorMessage(unsigned long error); } // namespace Utils -} // namespace Core #endif // WINUTILS_H diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index 5175f4b6a9511ed014547e083d5f11ea974d0e2a..04bf7642f9d9247c7f5d6150681de73086b68cc4 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -271,17 +271,17 @@ public: break; } - switch (Core::Utils::reloadPrompt(fileName, isModified(), Core::ICore::instance()->mainWindow())) { - case Core::Utils::ReloadCurrent: + switch (Utils::reloadPrompt(fileName, isModified(), Core::ICore::instance()->mainWindow())) { + case Utils::ReloadCurrent: open(fileName); break; - case Core::Utils::ReloadAll: + case Utils::ReloadAll: open(fileName); *behavior = Core::IFile::ReloadAll; break; - case Core::Utils::ReloadSkipCurrent: + case Utils::ReloadSkipCurrent: break; - case Core::Utils::ReloadNone: + case Utils::ReloadNone: *behavior = Core::IFile::ReloadNone; break; } @@ -305,7 +305,7 @@ public: m_file = new BinEditorFile(parent); m_context << uidm->uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR); m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR); - m_cursorPositionLabel = new Core::Utils::LineColumnLabel; + m_cursorPositionLabel = new Utils::LineColumnLabel; QHBoxLayout *l = new QHBoxLayout; QWidget *w = new QWidget; @@ -362,7 +362,7 @@ private: BinEditorFile *m_file; QList<int> m_context; QToolBar *m_toolBar; - Core::Utils::LineColumnLabel *m_cursorPositionLabel; + Utils::LineColumnLabel *m_cursorPositionLabel; }; diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp index 98693ed96dabe8dea952a0934e05ff165dc1626c..0939a1c43f3ef99207f4c2f9df4a08bdaeae616d 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.cpp @@ -236,7 +236,7 @@ ShadowBuildPage::ShadowBuildPage(CMakeOpenProjectWizard *cmakeWizard, bool chang "This ensures that the source directory remains clean and enables multiple builds " "with different settings.")); fl->addWidget(label); - m_pc = new Core::Utils::PathChooser(this); + m_pc = new Utils::PathChooser(this); m_pc->setPath(m_cmakeWizard->buildDirectory()); connect(m_pc, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged())); fl->addRow(tr("Build directory:"), m_pc); @@ -284,8 +284,8 @@ void CMakeRunPage::initWidgets() fl->addRow(new QLabel(text, this)); // Show a field for the user to enter - m_cmakeExecutable = new Core::Utils::PathChooser(this); - m_cmakeExecutable->setExpectedKind(Core::Utils::PathChooser::Command); + m_cmakeExecutable = new Utils::PathChooser(this); + m_cmakeExecutable->setExpectedKind(Utils::PathChooser::Command); fl->addRow("CMake Executable", m_cmakeExecutable); } diff --git a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h index 6a74741b5f4759dbbef54e8154981e91c72d6313..307ac61a677813aa02ec6a30bae63318e2052906 100644 --- a/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h +++ b/src/plugins/cmakeprojectmanager/cmakeopenprojectwizard.h @@ -40,10 +40,8 @@ #include <QtGui/QWizard> #include <QtGui/QPlainTextEdit> -namespace Core { - namespace Utils { - class PathChooser; - } +namespace Utils { + class PathChooser; } namespace CMakeProjectManager { @@ -115,7 +113,7 @@ private slots: void buildDirectoryChanged(); private: CMakeOpenProjectWizard *m_cmakeWizard; - Core::Utils::PathChooser *m_pc; + Utils::PathChooser *m_pc; }; class CMakeRunPage : public QWizardPage @@ -139,7 +137,7 @@ private: QPushButton *m_runCMake; QProcess *m_cmakeProcess; QLineEdit *m_argumentsLineEdit; - Core::Utils::PathChooser *m_cmakeExecutable; + Utils::PathChooser *m_cmakeExecutable; QComboBox *m_generatorComboBox; QLabel *m_descriptionLabel; bool m_complete; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 2b7da6fc0d0e21e20318d91281aee2e3b675d5da..fbab5af5d8f773ef6c4fb89a38b7a8bc4ab927f8 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -262,8 +262,8 @@ QWidget *CMakeSettingsPage::createPage(QWidget *parent) { QWidget *w = new QWidget(parent); QFormLayout *fl = new QFormLayout(w); - m_pathchooser = new Core::Utils::PathChooser(w); - m_pathchooser->setExpectedKind(Core::Utils::PathChooser::Command); + m_pathchooser = new Utils::PathChooser(w); + m_pathchooser->setExpectedKind(Utils::PathChooser::Command); fl->addRow(tr("CMake executable"), m_pathchooser); m_pathchooser->setPath(cmakeExecutable()); return w; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h index 904094b1a17369e12f5cda3f23c1d1ac123c9981..a33055235ab0f88b92099aaab1dcf3055d0af089 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h @@ -107,7 +107,7 @@ private: QString findCmakeExecutable() const; void updateInfo(); - Core::Utils::PathChooser *m_pathchooser; + Utils::PathChooser *m_pathchooser; QString m_cmakeExecutable; enum STATE { VALID, INVALID, RUNNING } m_state; QProcess *m_process; diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp index 8e25314ba88c609325f764a74bc1bee96c9220e6..8a5b337a68aa000df0aa22ea95aed715ab99147e 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp @@ -246,9 +246,9 @@ CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration * this, SLOT(setArguments(QString))); fl->addRow(tr("Arguments:"), argumentsLineEdit); - m_workingDirectoryEdit = new Core::Utils::PathChooser(); + m_workingDirectoryEdit = new Utils::PathChooser(); m_workingDirectoryEdit->setPath(m_cmakeRunConfiguration->workingDirectory()); - m_workingDirectoryEdit->setExpectedKind(Core::Utils::PathChooser::Directory); + m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory); m_workingDirectoryEdit->setPromptDialogTitle(tr("Select the working directory")); QToolButton *resetButton = new QToolButton(); diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h index 197d0b2a8d4750e65755ddd431c87a910ee8ad8b..85b87d1d07653ab8deac51fe2f12d3a1705b1b9f 100644 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h +++ b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h @@ -120,7 +120,7 @@ private: void updateSummary(); bool m_ignoreChange; CMakeRunConfiguration *m_cmakeRunConfiguration; - Core::Utils::PathChooser *m_workingDirectoryEdit; + Utils::PathChooser *m_workingDirectoryEdit; QComboBox *m_baseEnvironmentComboBox; ProjectExplorer::EnvironmentWidget *m_environmentWidget; Utils::DetailsWidget *m_detailsContainer; diff --git a/src/plugins/coreplugin/basefilewizard.cpp b/src/plugins/coreplugin/basefilewizard.cpp index 0148fc74eb8488bc29580e79de392182d053a28f..5c185a546c5b1e4ee8e4bd57aa9b7783d80f1fc4 100644 --- a/src/plugins/coreplugin/basefilewizard.cpp +++ b/src/plugins/coreplugin/basefilewizard.cpp @@ -647,7 +647,7 @@ QWizard *StandardFileWizard::createWizardDialog(QWidget *parent, const QString &defaultPath, const WizardPageList &extensionPages) const { - Core::Utils::FileWizardDialog *standardWizardDialog = new Core::Utils::FileWizardDialog(parent); + Utils::FileWizardDialog *standardWizardDialog = new Utils::FileWizardDialog(parent); standardWizardDialog->setWindowTitle(tr("New %1").arg(name())); setupWizard(standardWizardDialog); standardWizardDialog->setPath(defaultPath); @@ -659,7 +659,7 @@ QWizard *StandardFileWizard::createWizardDialog(QWidget *parent, GeneratedFiles StandardFileWizard::generateFiles(const QWizard *w, QString *errorMessage) const { - const Core::Utils::FileWizardDialog *standardWizardDialog = qobject_cast<const Core::Utils::FileWizardDialog *>(w); + const Utils::FileWizardDialog *standardWizardDialog = qobject_cast<const Utils::FileWizardDialog *>(w); return generateFilesFromPath(standardWizardDialog->path(), standardWizardDialog->name(), errorMessage); diff --git a/src/plugins/coreplugin/basefilewizard.h b/src/plugins/coreplugin/basefilewizard.h index 6ec1c0b9704237aad5556bb30c0000a8ea53cb0d..fb27113792fd49aa5c450150acf267b432bc9a11 100644 --- a/src/plugins/coreplugin/basefilewizard.h +++ b/src/plugins/coreplugin/basefilewizard.h @@ -199,7 +199,7 @@ private: }; // StandardFileWizard convenience class for creating one file. It uses -// Core::Utils::FileWizardDialog and introduces a new virtual to generate the +// Utils::FileWizardDialog and introduces a new virtual to generate the // files from path and name. class CORE_EXPORT StandardFileWizard : public BaseFileWizard @@ -210,7 +210,7 @@ class CORE_EXPORT StandardFileWizard : public BaseFileWizard protected: explicit StandardFileWizard(const BaseFileWizardParameters ¶meters, QObject *parent = 0); - // Implemented to create a Core::Utils::FileWizardDialog + // Implemented to create a Utils::FileWizardDialog virtual QWizard *createWizardDialog(QWidget *parent, const QString &defaultPath, const WizardPageList &extensionPages) const; diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp index 3414a3d77c45b96a4de7edf3ecd84a6c7f279557..4aad9f573bd3bc0361f3d4a13cbd373466f80133 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp @@ -113,7 +113,7 @@ QWidget *ShortcutSettings::createPage(QWidget *parent) this, SLOT(commandChanged(QTreeWidgetItem *))); connect(m_page->shortcutEdit, SIGNAL(textChanged(QString)), this, SLOT(keyChanged())); - new Core::Utils::TreeWidgetColumnStretcher(m_page->commandList, 1); + new Utils::TreeWidgetColumnStretcher(m_page->commandList, 1); commandChanged(0); diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index ea1ed1401590eb698ebcb3a9d2c2f88d6bca23c5..32a786e05008757a03963fed954aa9d5d68d14ac 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -78,7 +78,7 @@ Q_DECLARE_METATYPE(Core::IEditor*) using namespace Core; using namespace Core::Internal; -using namespace Core::Utils; +using namespace Utils; enum { debugEditorManager=0 }; diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 240905a325234be6e875f5a1dea34a7f4e4c7211..5cb4e43ff1b6559bce93e0aecac11fb1a7b617d1 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -137,7 +137,7 @@ EditorView::EditorView(OpenEditorsModel *model, QWidget *parent) : toplayout->addWidget(m_lockButton); toplayout->addWidget(m_closeButton); - Core::Utils::StyledBar *top = new Core::Utils::StyledBar; + Utils::StyledBar *top = new Utils::StyledBar; top->setLayout(toplayout); tl->addWidget(top); diff --git a/src/plugins/coreplugin/fancytabwidget.cpp b/src/plugins/coreplugin/fancytabwidget.cpp index 7abb1f901155b7e615ccf0f4d71c7234cbc20ca4..8cf175651bb6d37144b34175d149571fadec8804 100644 --- a/src/plugins/coreplugin/fancytabwidget.cpp +++ b/src/plugins/coreplugin/fancytabwidget.cpp @@ -76,7 +76,7 @@ FancyTabBar::~FancyTabBar() QSize FancyTabBar::tabSizeHint(bool minimum) const { QFont boldFont(font()); - boldFont.setPointSizeF(StyleHelper::sidebarFontSize()); + boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize()); boldFont.setBold(true); QFontMetrics fm(boldFont); int spacing = 6; @@ -245,13 +245,13 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const QRect tabTextRect(tabRect(tabIndex)); QRect tabIconRect(tabTextRect); QFont boldFont(painter->font()); - boldFont.setPointSizeF(StyleHelper::sidebarFontSize()); + boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize()); boldFont.setBold(true); painter->setFont(boldFont); - painter->setPen(selected ? StyleHelper::panelTextColor() : QColor(30, 30, 30, 80)); + painter->setPen(selected ? Utils::StyleHelper::panelTextColor() : QColor(30, 30, 30, 80)); int textFlags = Qt::AlignCenter | Qt::AlignBottom | Qt::ElideRight | Qt::TextWordWrap; painter->drawText(tabTextRect, textFlags, tabText); - painter->setPen(selected ? QColor(60, 60, 60) : StyleHelper::panelTextColor()); + painter->setPen(selected ? QColor(60, 60, 60) : Utils::StyleHelper::panelTextColor()); int textHeight = painter->fontMetrics().boundingRect(QRect(0, 0, width(), height()), Qt::TextWordWrap, tabText).height(); tabIconRect.adjust(0, 4, 0, -textHeight); int iconSize = qMin(tabIconRect.width(), tabIconRect.height()); @@ -285,7 +285,7 @@ public: void mousePressEvent(QMouseEvent *ev) { if (ev->modifiers() & Qt::ShiftModifier) - StyleHelper::setBaseColor(QColorDialog::getColor(StyleHelper::baseColor(), m_parent)); + Utils::StyleHelper::setBaseColor(QColorDialog::getColor(Utils::StyleHelper::baseColor(), m_parent)); } private: QWidget *m_parent; @@ -305,7 +305,7 @@ FancyTabWidget::FancyTabWidget(QWidget *parent) selectionLayout->setSpacing(0); selectionLayout->setMargin(0); - Core::Utils::StyledBar *bar = new Core::Utils::StyledBar; + Utils::StyledBar *bar = new Utils::StyledBar; QHBoxLayout *layout = new QHBoxLayout(bar); layout->setMargin(0); layout->setSpacing(0); @@ -377,8 +377,8 @@ void FancyTabWidget::paintEvent(QPaintEvent *event) QRect rect = m_selectionWidget->rect().adjusted(0, 0, 1, 0); rect = style()->visualRect(layoutDirection(), geometry(), rect); - StyleHelper::verticalGradient(&p, rect, rect); - p.setPen(StyleHelper::borderColor()); + Utils::StyleHelper::verticalGradient(&p, rect, rect); + p.setPen(Utils::StyleHelper::borderColor()); p.drawLine(rect.topRight(), rect.bottomRight()); } diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 683d9696296eb66d9efb8a5a5a4a3bb1b5a56aba..30ce55f36f4d2fca1c24acb5aa6111fe7a8b0d00 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -38,7 +38,7 @@ #include "ui_generalsettings.h" -using namespace Core::Utils; +using namespace Utils; using namespace Core::Internal; GeneralSettings::GeneralSettings(): diff --git a/src/plugins/coreplugin/generalsettings.ui b/src/plugins/coreplugin/generalsettings.ui index 269d14616572bb2e37ee16efb683c7d17b8bfb62..dd680aa10cfaeff4c858841c100603518d3cbd01 100644 --- a/src/plugins/coreplugin/generalsettings.ui +++ b/src/plugins/coreplugin/generalsettings.ui @@ -46,7 +46,7 @@ </spacer> </item> <item> - <widget class="Core::Utils::QtColorButton" name="colorButton"> + <widget class="Utils::QtColorButton" name="colorButton"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -228,7 +228,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::QtColorButton</class> + <class>Utils::QtColorButton</class> <extends>QToolButton</extends> <header location="global">utils/qtcolorbutton.h</header> </customwidget> diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 0a82ef2369093c33474660230e35a7daec4a3f4c..a8434f6fdfb61c4971544ada34819c9e733e4fda 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -863,7 +863,7 @@ QStringList MainWindow::showNewItemDialog(const QString &title, if (defaultDir.isEmpty() && !m_coreImpl->fileManager()->currentFile().isEmpty()) defaultDir = QFileInfo(m_coreImpl->fileManager()->currentFile()).absolutePath(); if (defaultDir.isEmpty()) - defaultDir = Core::Utils::PathChooser::homePath(); + defaultDir = Utils::PathChooser::homePath(); // Scan for wizards matching the filter and pick one. Don't show // dialog if there is only one. @@ -1101,7 +1101,7 @@ void MainWindow::readSettings() { m_settings->beginGroup(QLatin1String(settingsGroup)); - StyleHelper::setBaseColor(m_settings->value(QLatin1String(colorKey)).value<QColor>()); + Utils::StyleHelper::setBaseColor(m_settings->value(QLatin1String(colorKey)).value<QColor>()); const QVariant geom = m_settings->value(QLatin1String(geometryKey)); if (geom.isValid()) { @@ -1124,7 +1124,7 @@ void MainWindow::writeSettings() { m_settings->beginGroup(QLatin1String(settingsGroup)); - m_settings->setValue(QLatin1String(colorKey), StyleHelper::baseColor()); + m_settings->setValue(QLatin1String(colorKey), Utils::StyleHelper::baseColor()); if (windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) { m_settings->setValue(QLatin1String(maxKey), (bool) (windowState() & Qt::WindowMaximized)); diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 7c2721deeb66224a99c92d1cd5fd007a2a9cff77..a85a51dddabffd61ed5ccb54f7fe01df8df33f42 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -35,11 +35,6 @@ #include "eventfilteringmainwindow.h" #include <QtCore/QMap> -#include <QtCore/QList> -#include <QtCore/QSet> -#include <QtCore/QPointer> -#include <QtGui/QPrinter> -#include <QtGui/QToolButton> QT_BEGIN_NAMESPACE class QSettings; diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 816c6d32d1c99bad79c4fe56a96583783515005e..ffb3959c583a12a4220d96de73711c9838dcaa70 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -287,7 +287,7 @@ void ManhattanStyle::unpolish(QApplication *app) QPalette panelPalette(const QPalette &oldPalette) { - QColor color = StyleHelper::panelTextColor(); + QColor color = Utils::StyleHelper::panelTextColor(); QPalette pal = oldPalette; pal.setBrush(QPalette::All, QPalette::WindowText, color); pal.setBrush(QPalette::All, QPalette::ButtonText, color); @@ -312,20 +312,20 @@ void ManhattanStyle::polish(QWidget *widget) widget->setAttribute(Qt::WA_LayoutUsesWidgetRect, true); if (qobject_cast<QToolButton*>(widget)) { widget->setAttribute(Qt::WA_Hover); - widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2); + widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2); } else if (qobject_cast<QLineEdit*>(widget)) { widget->setAttribute(Qt::WA_Hover); - widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2); + widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2); } else if (qobject_cast<QLabel*>(widget)) widget->setPalette(panelPalette(widget->palette())); else if (qobject_cast<QToolBar*>(widget) || widget->property("panelwidget_singlerow").toBool()) - widget->setFixedHeight(StyleHelper::navigationWidgetHeight()); + widget->setFixedHeight(Utils::StyleHelper::navigationWidgetHeight()); else if (qobject_cast<QStatusBar*>(widget)) - widget->setFixedHeight(StyleHelper::navigationWidgetHeight() + 2); + widget->setFixedHeight(Utils::StyleHelper::navigationWidgetHeight() + 2); else if (qobject_cast<QComboBox*>(widget)) { - widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2); + widget->setMaximumHeight(Utils::StyleHelper::navigationWidgetHeight() - 2); widget->setAttribute(Qt::WA_Hover); } } @@ -486,7 +486,7 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption drawCornerImage(d->lineeditImage_disabled, painter, option->rect, 2, 2, 2, 2); if (option->state & State_HasFocus || option->state & State_MouseOver) { - QColor hover = StyleHelper::baseColor(); + QColor hover = Utils::StyleHelper::baseColor(); if (state & State_HasFocus) hover.setAlpha(100); else @@ -533,15 +533,15 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption { painter->save(); QLinearGradient grad(option->rect.topLeft(), QPoint(rect.center().x(), rect.bottom())); - QColor startColor = StyleHelper::shadowColor().darker(164); - QColor endColor = StyleHelper::baseColor().darker(130); + QColor startColor = Utils::StyleHelper::shadowColor().darker(164); + QColor endColor = Utils::StyleHelper::baseColor().darker(130); grad.setColorAt(0, startColor); grad.setColorAt(1, endColor); painter->fillRect(option->rect, grad); painter->setPen(QColor(255, 255, 255, 60)); painter->drawLine(rect.topLeft() + QPoint(0,1), rect.topRight()+ QPoint(0,1)); - painter->setPen(StyleHelper::borderColor().darker(110)); + painter->setPen(Utils::StyleHelper::borderColor().darker(110)); painter->drawLine(rect.topLeft(), rect.topRight()); painter->restore(); } @@ -549,7 +549,7 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption case PE_IndicatorToolBarSeparator: { - QColor separatorColor = StyleHelper::borderColor(); + QColor separatorColor = Utils::StyleHelper::borderColor(); separatorColor.setAlpha(100); painter->setPen(separatorColor); const int margin = 6; @@ -593,10 +593,10 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption } painter->setPen(Qt::NoPen); - QColor dark = StyleHelper::borderColor(); + QColor dark = Utils::StyleHelper::borderColor(); dark.setAlphaF(0.4); - QColor light = StyleHelper::baseColor(); + QColor light = Utils::StyleHelper::baseColor(); light.setAlphaF(0.4); painter->fillPath(path, light); @@ -709,10 +709,10 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt case CE_MenuBarItem: painter->save(); if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) { - QColor highlightOutline = StyleHelper::borderColor().lighter(120); + QColor highlightOutline = Utils::StyleHelper::borderColor().lighter(120); bool act = mbi->state & State_Selected && mbi->state & State_Sunken; bool dis = !(mbi->state & State_Enabled); - StyleHelper::menuGradient(painter, option->rect, option->rect); + Utils::StyleHelper::menuGradient(painter, option->rect, option->rect); QStyleOptionMenuItem item = *mbi; item.rect = mbi->rect; QPalette pal = mbi->palette; @@ -723,7 +723,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt if (act) { // Fill| - QColor baseColor = StyleHelper::baseColor(); + QColor baseColor = Utils::StyleHelper::baseColor(); QLinearGradient grad(option->rect.topLeft(), option->rect.bottomLeft()); grad.setColorAt(0, baseColor.lighter(120)); grad.setColorAt(1, baseColor.lighter(130)); @@ -786,7 +786,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt drawItemText(painter, editRect.translated(0, 1), visualAlignment(option->direction, Qt::AlignLeft | Qt::AlignVCenter), customPal, cb->state & State_Enabled, text, QPalette::ButtonText); - customPal.setBrush(QPalette::All, QPalette::ButtonText, StyleHelper::panelTextColor()); + customPal.setBrush(QPalette::All, QPalette::ButtonText, Utils::StyleHelper::panelTextColor()); drawItemText(painter, editRect, visualAlignment(option->direction, Qt::AlignLeft | Qt::AlignVCenter), customPal, cb->state & State_Enabled, text, QPalette::ButtonText); @@ -830,9 +830,9 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt break; case CE_MenuBarEmptyArea: { - StyleHelper::menuGradient(painter, option->rect, option->rect); + Utils::StyleHelper::menuGradient(painter, option->rect, option->rect); painter->save(); - painter->setPen(StyleHelper::borderColor()); + painter->setPen(Utils::StyleHelper::borderColor()); painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); painter->restore(); } @@ -841,12 +841,12 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt case CE_ToolBar: { QString key; - key.sprintf("mh_toolbar %d %d %d", option->rect.width(), option->rect.height(), StyleHelper::baseColor().rgb());; + key.sprintf("mh_toolbar %d %d %d", option->rect.width(), option->rect.height(), Utils::StyleHelper::baseColor().rgb());; QPixmap pixmap; QPainter *p = painter; QRect rect = option->rect; - if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { + if (Utils::StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { pixmap = QPixmap(option->rect.size()); p = new QPainter(&pixmap); rect = QRect(0, 0, option->rect.width(), option->rect.height()); @@ -861,11 +861,11 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt gradientSpan = QRect(offset, widget->window()->size()); } if (horizontal) - StyleHelper::horizontalGradient(p, gradientSpan, rect); + Utils::StyleHelper::horizontalGradient(p, gradientSpan, rect); else - StyleHelper::verticalGradient(p, gradientSpan, rect); + Utils::StyleHelper::verticalGradient(p, gradientSpan, rect); - painter->setPen(StyleHelper::borderColor()); + painter->setPen(Utils::StyleHelper::borderColor()); if (horizontal) { // Note: This is a hack to determine if the @@ -886,7 +886,7 @@ void ManhattanStyle::drawControl(ControlElement element, const QStyleOption *opt p->drawLine(rect.topRight(), rect.bottomRight()); } - if (StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { + if (Utils::StyleHelper::usePixmapCache() && !QPixmapCache::find(key, pixmap)) { painter->drawPixmap(rect.topLeft(), pixmap); p->end(); delete p; @@ -946,7 +946,7 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti fr.rect.adjust(0, 0, -pixelMetric(QStyle::PM_MenuButtonIndicator, toolbutton, widget), 0); QPen oldPen = painter->pen(); - QColor focusColor = StyleHelper::panelTextColor(); + QColor focusColor = Utils::StyleHelper::panelTextColor(); focusColor.setAlpha(120); QPen outline(focusColor, 1); outline.setStyle(Qt::DotLine); diff --git a/src/plugins/coreplugin/minisplitter.cpp b/src/plugins/coreplugin/minisplitter.cpp index b391e6cb68bf580d91045023d8cedeaf7e13a078..25b00d4f7b6a3963406ebaa7c71bb2b6b5783359 100644 --- a/src/plugins/coreplugin/minisplitter.cpp +++ b/src/plugins/coreplugin/minisplitter.cpp @@ -71,7 +71,7 @@ void MiniSplitterHandle::resizeEvent(QResizeEvent *event) void MiniSplitterHandle::paintEvent(QPaintEvent *event) { QPainter painter(this); - painter.fillRect(event->rect(), StyleHelper::borderColor()); + painter.fillRect(event->rect(), Utils::StyleHelper::borderColor()); } QSplitterHandle *MiniSplitter::createHandle() diff --git a/src/plugins/coreplugin/navigationwidget.cpp b/src/plugins/coreplugin/navigationwidget.cpp index 78750c49d1f2aa9fb27313df83c1bac37d6950f2..5b8bbc6fa4cd060b98c007006bf2b0cf91d0d2d2 100644 --- a/src/plugins/coreplugin/navigationwidget.cpp +++ b/src/plugins/coreplugin/navigationwidget.cpp @@ -369,7 +369,7 @@ NavigationSubWidget::NavigationSubWidget(NavigationWidget *parentWidget) m_navigationComboBox->setMinimumContentsLength(0); m_navigationWidget = 0; - m_toolBar = new Core::Utils::StyledBar(this); + m_toolBar = new Utils::StyledBar(this); QHBoxLayout *toolBarLayout = new QHBoxLayout; toolBarLayout->setMargin(0); toolBarLayout->setSpacing(0); diff --git a/src/plugins/coreplugin/navigationwidget.h b/src/plugins/coreplugin/navigationwidget.h index a4a6753ab3a0c0842172966262a521e1ffff4c21..61dbc3dacbe486760b7e87bfcca790768e99e4b2 100644 --- a/src/plugins/coreplugin/navigationwidget.h +++ b/src/plugins/coreplugin/navigationwidget.h @@ -40,10 +40,11 @@ class QShortcut; class QToolButton; QT_END_NAMESPACE -namespace Core { namespace Utils { class StyledBar; } + +namespace Core { class INavigationWidgetFactory; class IMode; class Command; @@ -147,7 +148,7 @@ private: NavigationWidget *m_parentWidget; QComboBox *m_navigationComboBox; QWidget *m_navigationWidget; - Core::Utils::StyledBar *m_toolBar; + Utils::StyledBar *m_toolBar; QList<QToolButton *> m_additionalToolBarWidgets; }; diff --git a/src/plugins/coreplugin/outputpane.cpp b/src/plugins/coreplugin/outputpane.cpp index 0b565451560c2b52a931617e4fe9c91b5dd4e59a..7b46cbd23a8029a93179a81f9a7c7ba3d62e4ac8 100644 --- a/src/plugins/coreplugin/outputpane.cpp +++ b/src/plugins/coreplugin/outputpane.cpp @@ -193,7 +193,7 @@ OutputPaneManager::OutputPaneManager(QWidget *parent) : QVBoxLayout *mainlayout = new QVBoxLayout; mainlayout->setSpacing(0); mainlayout->setMargin(0); - m_toolBar = new Core::Utils::StyledBar; + m_toolBar = new Utils::StyledBar; QHBoxLayout *toolLayout = new QHBoxLayout(m_toolBar); toolLayout->setMargin(0); toolLayout->setSpacing(0); diff --git a/src/plugins/coreplugin/progressmanager/progresspie.cpp b/src/plugins/coreplugin/progressmanager/progresspie.cpp index da9b16a8714d16db7bcf1c9d324676dd8085bf34..59929d437fe47e0bcc464047c7810549582a07f0 100644 --- a/src/plugins/coreplugin/progressmanager/progresspie.cpp +++ b/src/plugins/coreplugin/progressmanager/progresspie.cpp @@ -125,8 +125,8 @@ void ProgressBar::mouseMoveEvent(QMouseEvent *) void ProgressBar::paintEvent(QPaintEvent *) { - // TODO move font into stylehelper - // TODO use stylehelper white + // TODO move font into Utils::StyleHelper + // TODO use Utils::StyleHelper white double range = maximum() - minimum(); double percent = 0.50; @@ -139,7 +139,7 @@ void ProgressBar::paintEvent(QPaintEvent *) QPainter p(this); QFont boldFont(p.font()); - boldFont.setPointSizeF(StyleHelper::sidebarFontSize()); + boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize()); boldFont.setBold(true); p.setFont(boldFont); QFontMetrics fm(boldFont); @@ -158,7 +158,7 @@ void ProgressBar::paintEvent(QPaintEvent *) p.setPen(QColor(30, 30, 30, 80)); p.drawText(textRect, Qt::AlignHCenter | Qt::AlignBottom, m_title); p.translate(0, -1); - p.setPen(StyleHelper::panelTextColor()); + p.setPen(Utils::StyleHelper::panelTextColor()); p.drawText(textRect, Qt::AlignHCenter | Qt::AlignBottom, m_title); p.translate(0, 1); @@ -166,11 +166,11 @@ void ProgressBar::paintEvent(QPaintEvent *) m_progressHeight += ((m_progressHeight % 2) + 1) % 2; // make odd // draw outer rect QRect rect(INDENT - 1, h+6, size().width()-2*INDENT, m_progressHeight-1); - p.setPen(StyleHelper::panelTextColor()); + p.setPen(Utils::StyleHelper::panelTextColor()); p.drawRect(rect); // draw inner rect - QColor c = StyleHelper::panelTextColor(); + QColor c = Utils::StyleHelper::panelTextColor(); c.setAlpha(180); p.setPen(Qt::NoPen); @@ -196,7 +196,7 @@ void ProgressBar::paintEvent(QPaintEvent *) p.drawRect(inner); if (value() < maximum() && !m_error) { - QColor cancelOutline = StyleHelper::panelTextColor(); + QColor cancelOutline = Utils::StyleHelper::panelTextColor(); p.setPen(cancelOutline); QRect cancelRect(rect.right() - m_progressHeight + 2, rect.top(), m_progressHeight-1, rect.height()); if (cancelRect.contains(mapFromGlobal(QCursor::pos()))) @@ -210,7 +210,7 @@ void ProgressBar::paintEvent(QPaintEvent *) p.drawLine(cancelRect.center()+QPoint(-1,-1), cancelRect.center()+QPoint(+3,+3)); p.drawLine(cancelRect.center()+QPoint(+3,-1), cancelRect.center()+QPoint(-1,+3)); - p.setPen(StyleHelper::panelTextColor()); + p.setPen(Utils::StyleHelper::panelTextColor()); p.drawLine(cancelRect.center()+QPoint(-1,-1), cancelRect.center()+QPoint(+3,+3)); p.drawLine(cancelRect.center()+QPoint(+3,-1), cancelRect.center()+QPoint(-1,+3)); } diff --git a/src/plugins/coreplugin/sidebar.cpp b/src/plugins/coreplugin/sidebar.cpp index 4705dc9be8d7be31541b4074baefcef049d8ecf4..a89720c240238a60437b11a0291f83ea4d77f070 100644 --- a/src/plugins/coreplugin/sidebar.cpp +++ b/src/plugins/coreplugin/sidebar.cpp @@ -288,9 +288,9 @@ void SideBarWidget::setCurrentItem(const QString &title) int idx = m_comboBox->findText(title); if (idx < 0) idx = 0; - m_comboBox->blockSignals(true); + bool blocked = m_comboBox->blockSignals(true); m_comboBox->setCurrentIndex(idx); - m_comboBox->blockSignals(false); + m_comboBox->blockSignals(blocked); } SideBarItem *item = m_sideBar->item(title); @@ -307,7 +307,7 @@ void SideBarWidget::setCurrentItem(const QString &title) void SideBarWidget::updateAvailableItems() { - m_comboBox->blockSignals(true); + bool blocked = m_comboBox->blockSignals(true); QString current = m_comboBox->currentText(); m_comboBox->clear(); QStringList itms = m_sideBar->availableItems(); @@ -320,7 +320,7 @@ void SideBarWidget::updateAvailableItems() idx = 0; m_comboBox->setCurrentIndex(idx); m_splitButton->setEnabled(itms.count() > 1); - m_comboBox->blockSignals(false); + m_comboBox->blockSignals(blocked); } void SideBarWidget::removeCurrentItem() diff --git a/src/plugins/cppeditor/cppclasswizard.cpp b/src/plugins/cppeditor/cppclasswizard.cpp index b5c8393b8d7a4bc75b608e465d3458febb62c5b5..1c994c6ebcb9a58a17a5d2097a6ee25079ddeeb8 100644 --- a/src/plugins/cppeditor/cppclasswizard.cpp +++ b/src/plugins/cppeditor/cppclasswizard.cpp @@ -63,7 +63,7 @@ ClassNamePage::ClassNamePage(QWidget *parent) : setTitle(tr("Enter class name")); setSubTitle(tr("The header and source file names will be derived from the class name")); - m_newClassWidget = new Core::Utils::NewClassWidget; + m_newClassWidget = new Utils::NewClassWidget; // Order, set extensions first before suggested name is derived m_newClassWidget->setBaseClassInputVisible(true); m_newClassWidget->setBaseClassChoices(QStringList() << QString() @@ -148,7 +148,7 @@ void CppClassWizardDialog::setPath(const QString &path) CppClassWizardParameters CppClassWizardDialog::parameters() const { CppClassWizardParameters rc; - const Core::Utils::NewClassWidget *ncw = m_classNamePage->newClassWidget(); + const Utils::NewClassWidget *ncw = m_classNamePage->newClassWidget(); rc.className = ncw->className(); rc.headerFile = ncw->headerFileName(); rc.sourceFile = ncw->sourceFileName(); @@ -216,7 +216,7 @@ bool CppClassWizard::generateHeaderAndSource(const CppClassWizardParameters &par { // TODO: // Quite a bit of this code has been copied from FormClassWizardParameters::generateCpp. - // Maybe more of it could be merged into Core::Utils. + // Maybe more of it could be merged into Utils. const QString indent = QString(4, QLatin1Char(' ')); @@ -228,7 +228,7 @@ bool CppClassWizard::generateHeaderAndSource(const CppClassWizardParameters &par const QString license = CppTools::AbstractEditorSupport::licenseTemplate(); const QString unqualifiedClassName = namespaceList.takeLast(); - const QString guard = Core::Utils::headerGuard(params.headerFile); + const QString guard = Utils::headerGuard(params.headerFile); // == Header file == QTextStream headerStr(header); @@ -240,10 +240,10 @@ bool CppClassWizard::generateHeaderAndSource(const CppClassWizardParameters &par const bool superIsQtClass = qtClassExpr.exactMatch(params.baseClass); if (superIsQtClass) { headerStr << '\n'; - Core::Utils::writeIncludeFileDirective(params.baseClass, true, headerStr); + Utils::writeIncludeFileDirective(params.baseClass, true, headerStr); } - const QString namespaceIndent = Core::Utils::writeOpeningNameSpaces(namespaceList, QString(), headerStr); + const QString namespaceIndent = Utils::writeOpeningNameSpaces(namespaceList, QString(), headerStr); // Class declaration headerStr << '\n'; @@ -257,7 +257,7 @@ bool CppClassWizard::generateHeaderAndSource(const CppClassWizardParameters &par << namespaceIndent << indent << unqualifiedClassName << "();\n"; headerStr << namespaceIndent << "};\n"; - Core::Utils::writeClosingNameSpaces(namespaceList, QString(), headerStr); + Utils::writeClosingNameSpaces(namespaceList, QString(), headerStr); headerStr << '\n'; headerStr << "#endif // "<< guard << '\n'; @@ -266,13 +266,13 @@ bool CppClassWizard::generateHeaderAndSource(const CppClassWizardParameters &par // == Source file == QTextStream sourceStr(source); sourceStr << license; - Core::Utils::writeIncludeFileDirective(params.headerFile, false, sourceStr); - Core::Utils::writeOpeningNameSpaces(namespaceList, QString(), sourceStr); + Utils::writeIncludeFileDirective(params.headerFile, false, sourceStr); + Utils::writeOpeningNameSpaces(namespaceList, QString(), sourceStr); // Constructor sourceStr << '\n' << namespaceIndent << unqualifiedClassName << "::" << unqualifiedClassName << "()\n"; sourceStr << namespaceIndent << "{\n" << namespaceIndent << "}\n"; - Core::Utils::writeClosingNameSpaces(namespaceList, QString(), sourceStr); + Utils::writeClosingNameSpaces(namespaceList, QString(), sourceStr); return true; } diff --git a/src/plugins/cppeditor/cppclasswizard.h b/src/plugins/cppeditor/cppclasswizard.h index 6b80bbac9ea1cec1622d415fef5e1c72327e32b3..1bc26d1b56f942a8ab08d7a871294c2257c89bfa 100644 --- a/src/plugins/cppeditor/cppclasswizard.h +++ b/src/plugins/cppeditor/cppclasswizard.h @@ -36,13 +36,11 @@ #include <QtGui/QWizardPage> #include <QtGui/QWizard> -namespace Core { namespace Utils { class NewClassWidget; } // namespace Utils -} // namespace Core namespace CppEditor { namespace Internal { @@ -55,7 +53,7 @@ public: explicit ClassNamePage(QWidget *parent = 0); bool isComplete() const { return m_isValid; } - Core::Utils::NewClassWidget *newClassWidget() const { return m_newClassWidget; } + Utils::NewClassWidget *newClassWidget() const { return m_newClassWidget; } private slots: void slotValidChanged(); @@ -64,7 +62,7 @@ private slots: private: void initParameters(); - Core::Utils::NewClassWidget *m_newClassWidget; + Utils::NewClassWidget *m_newClassWidget; bool m_isValid; }; diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index f1f277e8eabff64f057bf22e8f557bd92163bc77..b03e4ca34619ce1fa4a6c780cc2310e73af4ac28 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -862,7 +862,21 @@ CPlusPlus::Symbol *CPPEditor::findCanonicalSymbol(const QTextCursor &cursor, return canonicalSymbol; } -void CPPEditor::findReferences() + +void CPPEditor::findUsages() +{ + updateSemanticInfo(m_semanticHighlighter->semanticInfo(currentSource())); + + SemanticInfo info = m_lastSemanticInfo; + + if (! info.doc) + return; + + if (Symbol *canonicalSymbol = findCanonicalSymbol(textCursor(), info.doc, info.snapshot)) + m_modelManager->findUsages(canonicalSymbol); +} + +void CPPEditor::renameUsages() { m_currentRenameSelection = -1; @@ -896,7 +910,7 @@ void CPPEditor::findReferences() setExtraSelections(CodeSemanticsSelection, selections); - m_modelManager->findReferences(canonicalSymbol); + m_modelManager->renameUsages(canonicalSymbol); } } } @@ -908,7 +922,6 @@ void CPPEditor::renameSymbolUnderCursor() QTextCursor c = textCursor(); m_currentRenameSelection = -1; - m_renameSelections = extraSelections(CodeSemanticsSelection); for (int i = 0; i < m_renameSelections.size(); ++i) { QTextEdit::ExtraSelection s = m_renameSelections.at(i); if (c.position() >= s.cursor.anchor() @@ -921,7 +934,7 @@ void CPPEditor::renameSymbolUnderCursor() } if (m_renameSelections.isEmpty()) - findReferences(); + renameUsages(); } void CPPEditor::onContentsChanged(int position, int charsRemoved, int charsAdded) @@ -980,10 +993,9 @@ void CPPEditor::highlightUses(const QList<SemanticInfo::Use> &uses, QList<QTextEdit::ExtraSelection> *selections) { bool isUnused = false; - if (uses.size() == 1) { + + if (uses.size() == 1) isUnused = true; - return; // ### - } foreach (const SemanticInfo::Use &use, uses) { QTextEdit::ExtraSelection sel; @@ -1882,13 +1894,12 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs) // only set the background, we do not want to modify foreground properties set by the syntax highlighter or the link m_occurrencesFormat.clearForeground(); - m_occurrencesUnusedFormat.clearForeground(); m_occurrenceRenameFormat.clearForeground(); } void CPPEditor::unCommentSelection() { - Core::Utils::unCommentSelection(this); + Utils::unCommentSelection(this); } CPPEditor::Link CPPEditor::linkToSymbol(CPlusPlus::Symbol *symbol) @@ -1944,7 +1955,9 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo) int line = 0, column = 0; convertPosition(position(), &line, &column); - QList<QTextEdit::ExtraSelection> selections; + QList<QTextEdit::ExtraSelection> allSelections; + + m_renameSelections.clear(); SemanticInfo::LocalUseIterator it(semanticInfo.localUses); while (it.hasNext()) { @@ -1961,11 +1974,18 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo) } } - if (uses.size() == 1 || good) + if (uses.size() == 1) { + // it's an unused declaration + highlightUses(uses, &allSelections); + } else if (good) { + QList<QTextEdit::ExtraSelection> selections; highlightUses(uses, &selections); + m_renameSelections += selections; + allSelections += selections; + } } - setExtraSelections(CodeSemanticsSelection, selections); + setExtraSelections(CodeSemanticsSelection, allSelections); } SemanticHighlighter::Source CPPEditor::currentSource() diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h index 5f544cfbbdfa43261fec6e0f91883ada6e5f8154..6c853672bfefb00c666a6dce690c3dd11f6098ae 100644 --- a/src/plugins/cppeditor/cppeditor.h +++ b/src/plugins/cppeditor/cppeditor.h @@ -197,7 +197,8 @@ public Q_SLOTS: void switchDeclarationDefinition(); void jumpToDefinition(); void renameSymbolUnderCursor(); - void findReferences(); + void renameUsages(); + void findUsages(); void moveToPreviousToken(); void moveToNextToken(); diff --git a/src/plugins/cppeditor/cppeditorconstants.h b/src/plugins/cppeditor/cppeditorconstants.h index 24d1504caf7689d40eca77e00e81b7234a9a2584..356f711ba9ed63eb2890961ccd4a797d06dde3e4 100644 --- a/src/plugins/cppeditor/cppeditorconstants.h +++ b/src/plugins/cppeditor/cppeditorconstants.h @@ -39,6 +39,7 @@ const char * const C_CPPEDITOR = "C++ Editor"; const char * const CPPEDITOR_KIND = QT_TRANSLATE_NOOP("OpenWith::Editors", "C++ Editor"); const char * const SWITCH_DECLARATION_DEFINITION = "CppEditor.SwitchDeclarationDefinition"; const char * const RENAME_SYMBOL_UNDER_CURSOR = "CppEditor.RenameSymbolUnderCursor"; +const char * const FIND_USAGES = "CppEditor.FindUsages"; const char * const SEPARATOR = "CppEditor.Separator"; const char * const FIND_REFERENCES = "CppEditor.FindReferences"; const char * const JUMP_TO_DEFINITION = "CppEditor.JumpToDefinition"; diff --git a/src/plugins/cppeditor/cppfilewizard.cpp b/src/plugins/cppeditor/cppfilewizard.cpp index 190b16b72f4d656207b031b5d7e9f6cc59fb677d..3f86ea88a5601870d95874a449db3d7225b18fc3 100644 --- a/src/plugins/cppeditor/cppfilewizard.cpp +++ b/src/plugins/cppeditor/cppfilewizard.cpp @@ -74,7 +74,7 @@ QString CppFileWizard::fileContents(FileType type, const QString &fileName) cons str << CppTools::AbstractEditorSupport::licenseTemplate(); switch (type) { case Header: { - const QString guard = Core::Utils::headerGuard(fileName); + const QString guard = Utils::headerGuard(fileName); str << QLatin1String("#ifndef ") << guard << QLatin1String("\n#define ") << guard << QLatin1String("\n\n#endif // ") << guard << QLatin1String("\n"); diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index d1c8d89b00197496e54938514fce01b062124c74..bd65c32666c677987c223dcb20f48b78697f16fb 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -212,6 +212,12 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess contextMenu->addAction(cmd); am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); + QAction *findUsagesAction = new QAction(tr("Find Usages"), this); + cmd = am->registerAction(findUsagesAction, Constants::FIND_USAGES, context); + connect(findUsagesAction, SIGNAL(triggered()), this, SLOT(findUsages())); + contextMenu->addAction(cmd); + am->actionContainer(CppTools::Constants::M_TOOLS_CPP)->addAction(cmd); + QAction *renameSymbolUnderCursorAction = new QAction(tr("Rename Symbol under Cursor"), this); cmd = am->registerAction(renameSymbolUnderCursorAction, Constants::RENAME_SYMBOL_UNDER_CURSOR, context); @@ -286,4 +292,12 @@ void CppPlugin::renameSymbolUnderCursor() editor->renameSymbolUnderCursor(); } +void CppPlugin::findUsages() +{ + Core::EditorManager *em = Core::EditorManager::instance(); + CPPEditor *editor = qobject_cast<CPPEditor*>(em->currentEditor()->widget()); + if (editor) + editor->findUsages(); +} + Q_EXPORT_PLUGIN(CppPlugin) diff --git a/src/plugins/cppeditor/cppplugin.h b/src/plugins/cppeditor/cppplugin.h index 9d46a981f1b2a3b8da9a49269030803ed361dc5e..6437f6e2410e9007f36409006c258ada55820c31 100644 --- a/src/plugins/cppeditor/cppplugin.h +++ b/src/plugins/cppeditor/cppplugin.h @@ -74,6 +74,7 @@ private slots: void switchDeclarationDefinition(); void jumpToDefinition(); void renameSymbolUnderCursor(); + void findUsages(); private: Core::IEditor *createEditor(QWidget *parent); diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index cd0c8f705ed0c204675f699a9ac427b7270dd96e..aa071b73593ee7a59f50dd4a0c201cc9eeaf38a8 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -161,7 +161,7 @@ public: Symbol *previousSymbol = switchSymbol(symbol); accept(symbol->identity()); if (_item) - _item.m_data = QVariant::fromValue(symbol); + _item.data = QVariant::fromValue(symbol); (void) switchSymbol(previousSymbol); return switchCompletionItem(previousItem); } @@ -184,8 +184,8 @@ protected: TextEditor::CompletionItem newCompletionItem(Name *name) { TextEditor::CompletionItem item(_collector); - item.m_text = overview.prettyName(name); - item.m_icon = _collector->iconForSymbol(_symbol); + item.text = overview.prettyName(name); + item.icon = _collector->iconForSymbol(_symbol); return item; } @@ -195,7 +195,7 @@ protected: virtual void visit(TemplateNameId *name) { _item = newCompletionItem(name); - _item.m_text = QLatin1String(name->identifier()->chars()); + _item.text = QLatin1String(name->identifier()->chars()); } virtual void visit(DestructorNameId *name) @@ -474,8 +474,8 @@ int CppQuickFixCollector::startCompletion(TextEditor::ITextEditable *editor) int i = 0; foreach (QuickFixOperationPtr op, quickFixes) { TextEditor::CompletionItem item(this); - item.m_text = op->description(); - item.m_data = QVariant::fromValue(i); + item.text = op->description(); + item.data = QVariant::fromValue(i); _completions.append(item); ++i; } @@ -494,7 +494,7 @@ void CppQuickFixCollector::complete(const TextEditor::CompletionItem &item) { CppEditorSupport *extra = _modelManager->editorSupport(_editor); const QList<QuickFixOperationPtr> quickFixes = extra->quickFixes(); - QuickFixOperationPtr quickFix = quickFixes.at(item.m_data.toInt()); + QuickFixOperationPtr quickFix = quickFixes.at(item.data.toInt()); TextEditor::BaseTextEditor *ed = qobject_cast<TextEditor::BaseTextEditor *>(_editor->widget()); quickFix->apply(ed->textCursor()); } @@ -757,8 +757,8 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) if (m_completionOperator == T_DOXY_COMMENT) { for (int i = 1; i < T_DOXY_LAST_TAG; ++i) { TextEditor::CompletionItem item(this); - item.m_text.append(QString::fromLatin1(doxygenTagSpell(i))); - item.m_icon = m_icons.keywordIcon(); + item.text.append(QString::fromLatin1(doxygenTagSpell(i))); + item.icon = m_icons.keywordIcon(); m_completions.append(item); } @@ -1148,8 +1148,8 @@ void CppCodeCompletion::addKeywords() // keyword completion items. for (int i = T_FIRST_KEYWORD; i < T_FIRST_OBJC_AT_KEYWORD; ++i) { TextEditor::CompletionItem item(this); - item.m_text = QLatin1String(Token::name(i)); - item.m_icon = m_icons.keywordIcon(); + item.text = QLatin1String(Token::name(i)); + item.icon = m_icons.keywordIcon(); m_completions.append(item); } } @@ -1164,8 +1164,8 @@ void CppCodeCompletion::addMacros(const LookupContext &context) foreach (const QString ¯oName, definedMacros) { TextEditor::CompletionItem item(this); - item.m_text = macroName; - item.m_icon = m_icons.macroIcon(); + item.text = macroName; + item.icon = m_icons.macroIcon(); m_completions.append(item); } } @@ -1235,9 +1235,9 @@ bool CppCodeCompletion::completeInclude(const QTextCursor &cursor) } foreach (const QString &itemText, m_manager->includesInPath(realPath)) { TextEditor::CompletionItem item(this); - item.m_text += itemText; + item.text += itemText; // TODO: Icon for include files - item.m_icon = m_icons.keywordIcon(); + item.icon = m_icons.keywordIcon(); m_completions.append(item); } } @@ -1252,9 +1252,9 @@ bool CppCodeCompletion::completeInclude(const QTextCursor &cursor) } foreach (const QString &itemText, m_manager->includesInPath(realPath)) { TextEditor::CompletionItem item(this); - item.m_text += itemText; + item.text += itemText; // TODO: Icon for include files - item.m_icon = m_icons.keywordIcon(); + item.icon = m_icons.keywordIcon(); m_completions.append(item); } } @@ -1389,7 +1389,7 @@ bool CppCodeCompletion::completeQtMethod(const QList<TypeOfExpression::Result> & if (! signatures.contains(signature)) { signatures.insert(signature); - ci.m_text = signature; // fix the completion item. + ci.text = signature; // fix the completion item. m_completions.append(ci); } @@ -1446,9 +1446,9 @@ void CppCodeCompletion::completions(QList<TextEditor::CompletionItem> *completio const QRegExp regExp(keyRegExp, m_caseSensitivity); foreach (TextEditor::CompletionItem item, m_completions) { - if (regExp.indexIn(item.m_text) == 0) { - item.m_relevance = (key.length() > 0 && - item.m_text.startsWith(key, Qt::CaseInsensitive)) ? 1 : 0; + if (regExp.indexIn(item.text) == 0) { + item.relevance = (key.length() > 0 && + item.text.startsWith(key, Qt::CaseInsensitive)) ? 1 : 0; (*completions) << item; } } @@ -1456,7 +1456,7 @@ void CppCodeCompletion::completions(QList<TextEditor::CompletionItem> *completio m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) { foreach (TextEditor::CompletionItem item, m_completions) { - if (item.m_text.startsWith(key, Qt::CaseInsensitive)) { + if (item.text.startsWith(key, Qt::CaseInsensitive)) { (*completions) << item; } } @@ -1468,8 +1468,8 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) { Symbol *symbol = 0; - if (item.m_data.isValid()) - symbol = item.m_data.value<Symbol *>(); + if (item.data.isValid()) + symbol = item.data.value<Symbol *>(); QString toInsert; QString extraChars; @@ -1479,14 +1479,14 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) bool autoParenthesesEnabled = true; if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) { - toInsert = item.m_text; + toInsert = item.text; extraChars += QLatin1Char(')'); } else if (m_completionOperator == T_STRING_LITERAL || m_completionOperator == T_ANGLE_STRING_LITERAL) { - toInsert = item.m_text; + toInsert = item.text; if (!toInsert.endsWith(QLatin1Char('/'))) extraChars += QLatin1Char((m_completionOperator == T_ANGLE_STRING_LITERAL) ? '>' : '"'); } else { - toInsert = item.m_text; + toInsert = item.text; //qDebug() << "current symbol:" << overview.prettyName(symbol->name()) //<< overview.prettyType(symbol->type()); @@ -1511,7 +1511,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item) bool endWithSemicolon = function->returnType()->isVoidType() && m_completionOperator != T_COLON_COLON; // If the function takes no arguments, automatically place the closing parenthesis - if (item.m_duplicateCount == 0 && ! function->hasArguments()) { + if (item.duplicateCount == 0 && ! function->hasArguments()) { extraChars += QLatin1Char(')'); if (endWithSemicolon) extraChars += QLatin1Char(';'); @@ -1560,8 +1560,8 @@ bool CppCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem return true; } else if (m_partialCompletionEnabled && m_completionOperator != T_LPAREN) { // Compute common prefix - QString firstKey = completionItems.first().m_text; - QString lastKey = completionItems.last().m_text; + QString firstKey = completionItems.first().text; + QString lastKey = completionItems.last().text; const int length = qMin(firstKey.length(), lastKey.length()); firstKey.truncate(length); lastKey.truncate(length); diff --git a/src/plugins/cpptools/cppfilesettingspage.cpp b/src/plugins/cpptools/cppfilesettingspage.cpp index c69711fa1286c4d19b720b34991f7ebdda7e5e6e..a8320a87ccbb9485f29c3ea008829a35f7c2eedb 100644 --- a/src/plugins/cpptools/cppfilesettingspage.cpp +++ b/src/plugins/cpptools/cppfilesettingspage.cpp @@ -208,7 +208,7 @@ CppFileSettingsWidget::CppFileSettingsWidget(QWidget *parent) : if (const Core::MimeType headerMt = mdb->findByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE))) foreach (const QString &suffix, headerMt.suffixes()) m_ui->headerSuffixComboBox->addItem(suffix); - m_ui->licenseTemplatePathChooser->setExpectedKind(Core::Utils::PathChooser::File); + m_ui->licenseTemplatePathChooser->setExpectedKind(Utils::PathChooser::File); m_ui->licenseTemplatePathChooser->addButton(tr("Edit..."), this, SLOT(slotEdit())); } diff --git a/src/plugins/cpptools/cppfilesettingspage.ui b/src/plugins/cpptools/cppfilesettingspage.ui index ea074c2ff871d020bca8bce6042d69129d7db4a8..e981bd7ef9d2525b322cefa31f4c45571bd8e491 100644 --- a/src/plugins/cpptools/cppfilesettingspage.ui +++ b/src/plugins/cpptools/cppfilesettingspage.ui @@ -61,7 +61,7 @@ </widget> </item> <item row="3" column="1"> - <widget class="Core::Utils::PathChooser" name="licenseTemplatePathChooser" native="true"/> + <widget class="Utils::PathChooser" name="licenseTemplatePathChooser" native="true"/> </item> </layout> </widget> @@ -83,7 +83,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index 743cfae0ece6b12b2a59afa6641367501d49124f..95e1b8273dfd78eb60681fde5a5a6539786a8256 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -69,7 +69,7 @@ struct Process: protected ASTVisitor { public: Process(Document::Ptr doc, const Snapshot &snapshot, - QFutureInterface<Core::Utils::FileSearchResult> *future) + QFutureInterface<Utils::FileSearchResult> *future) : ASTVisitor(doc->control()), _future(future), _doc(doc), @@ -115,6 +115,14 @@ protected: } + void reportResult(unsigned tokenIndex, const QList<Symbol *> &candidates) + { + const bool isStrongResult = checkCandidates(candidates); + + if (isStrongResult) + reportResult(tokenIndex); + } + void reportResult(unsigned tokenIndex) { const Token &tk = tokenAt(tokenIndex); @@ -129,8 +137,8 @@ protected: const int len = tk.f.length; if (_future) - _future->reportResult(Core::Utils::FileSearchResult(QDir::toNativeSeparators(_doc->fileName()), - line, lineText, col, len)); + _future->reportResult(Utils::FileSearchResult(QDir::toNativeSeparators(_doc->fileName()), + line, lineText, col, len)); _references.append(tokenIndex); } @@ -197,8 +205,7 @@ protected: if (identifier(simple->identifier_token) == _id) { LookupContext context = currentContext(ast); const QList<Symbol *> candidates = context.resolve(simple->name); - if (checkCandidates(candidates)) - reportResult(simple->identifier_token); + reportResult(simple->identifier_token, candidates); } } accept(ast->expression); @@ -262,8 +269,7 @@ protected: candidates.append(lastVisibleSymbol); } - if (checkCandidates(candidates)) - reportResult(endToken); + reportResult(endToken, candidates); } virtual bool visit(QualifiedNameAST *ast) @@ -331,8 +337,7 @@ protected: if (id == _id) { LookupContext context = currentContext(ast); const QList<Symbol *> candidates = context.resolve(ast->name); - if (checkCandidates(candidates)) - reportResult(ast->identifier_token); + reportResult(ast->identifier_token, candidates); } return false; @@ -344,8 +349,7 @@ protected: if (id == _id) { LookupContext context = currentContext(ast); const QList<Symbol *> candidates = context.resolve(ast->name); - if (checkCandidates(candidates)) - reportResult(ast->identifier_token); + reportResult(ast->identifier_token, candidates); } return false; @@ -353,19 +357,50 @@ protected: virtual bool visit(TemplateIdAST *ast) { - Identifier *id = identifier(ast->identifier_token); - if (id == _id) { + if (_id == identifier(ast->identifier_token)) { LookupContext context = currentContext(ast); const QList<Symbol *> candidates = context.resolve(ast->name); - if (checkCandidates(candidates)) - reportResult(ast->identifier_token); + reportResult(ast->identifier_token, candidates); + } + + for (TemplateArgumentListAST *template_arguments = ast->template_arguments; + template_arguments; template_arguments = template_arguments->next) { + accept(template_arguments->template_argument); + } + + return false; + } + + virtual bool visit(ParameterDeclarationAST *ast) + { + for (SpecifierAST *spec = ast->type_specifier; spec; spec = spec->next) + accept(spec); + + if (DeclaratorAST *declarator = ast->declarator) { + for (SpecifierAST *attr = declarator->attributes; attr; attr = attr->next) + accept(attr); + + for (PtrOperatorAST *ptr_op = declarator->ptr_operators; ptr_op; ptr_op = ptr_op->next) + accept(ptr_op); + + // ### TODO: well, not exactly. We need to look at qualified-name-ids and nested-declarators. + // accept(declarator->core_declarator); + + for (PostfixDeclaratorAST *fx_op = declarator->postfix_declarators; fx_op; fx_op = fx_op->next) + accept(fx_op); + + for (SpecifierAST *spec = declarator->post_attributes; spec; spec = spec->next) + accept(spec); + + accept(declarator->initializer); } + accept(ast->expression); return false; } private: - QFutureInterface<Core::Utils::FileSearchResult> *_future; + QFutureInterface<Utils::FileSearchResult> *_future; Identifier *_id; // ### remove me Symbol *_declSymbol; Document::Ptr _doc; @@ -415,7 +450,7 @@ QList<int> CppFindReferences::references(Symbol *symbol, return references; } -static void find_helper(QFutureInterface<Core::Utils::FileSearchResult> &future, +static void find_helper(QFutureInterface<Utils::FileSearchResult> &future, const QMap<QString, QString> wl, Snapshot snapshot, Symbol *symbol) @@ -435,6 +470,12 @@ static void find_helper(QFutureInterface<Core::Utils::FileSearchResult> &future, future.setProgressRange(0, files.size()); for (int i = 0; i < files.size(); ++i) { + if (future.isPaused()) + future.waitForResume(); + + if (future.isCanceled()) + break; + const QString &fileName = files.at(i); future.setProgressValueAndText(i, QFileInfo(fileName).fileName()); @@ -491,10 +532,31 @@ static void find_helper(QFutureInterface<Core::Utils::FileSearchResult> &future, future.setProgressValue(files.size()); } -void CppFindReferences::findAll(Symbol *symbol) +void CppFindReferences::findUsages(Symbol *symbol) +{ + Find::SearchResult *search = _resultWindow->startNewSearch(Find::SearchResultWindow::SearchOnly); + + connect(search, SIGNAL(activated(Find::SearchResultItem)), + this, SLOT(openEditor(Find::SearchResultItem))); + + findAll_helper(symbol); +} + +void CppFindReferences::renameUsages(Symbol *symbol) +{ + Find::SearchResult *search = _resultWindow->startNewSearch(Find::SearchResultWindow::SearchAndReplace); + + connect(search, SIGNAL(activated(Find::SearchResultItem)), + this, SLOT(openEditor(Find::SearchResultItem))); + + connect(search, SIGNAL(replaceButtonClicked(QString,QList<Find::SearchResultItem>)), + SLOT(onReplaceButtonClicked(QString,QList<Find::SearchResultItem>))); + + findAll_helper(symbol); +} + +void CppFindReferences::findAll_helper(Symbol *symbol) { - _resultWindow->clearContents(); - _resultWindow->setShowReplaceUI(true); _resultWindow->popup(true); const Snapshot snapshot = _modelManager->snapshot(); @@ -502,7 +564,7 @@ void CppFindReferences::findAll(Symbol *symbol) Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); - QFuture<Core::Utils::FileSearchResult> result = QtConcurrent::run(&find_helper, wl, snapshot, symbol); + QFuture<Utils::FileSearchResult> result = QtConcurrent::run(&find_helper, wl, snapshot, symbol); m_watcher.setFuture(result); Core::FutureProgress *progress = progressManager->addTask(result, tr("Searching..."), @@ -512,17 +574,68 @@ void CppFindReferences::findAll(Symbol *symbol) connect(progress, SIGNAL(clicked()), _resultWindow, SLOT(popup())); } +void CppFindReferences::onReplaceButtonClicked(const QString &text, + const QList<Find::SearchResultItem> &items) +{ + if (text.isEmpty()) + return; + + QHash<QString, QList<Find::SearchResultItem> > changes; + + foreach (const Find::SearchResultItem &item, items) + changes[item.fileName].append(item); + + QHashIterator<QString, QList<Find::SearchResultItem> > it(changes); + while (it.hasNext()) { + it.next(); + + const QString fileName = it.key(); + QFile file(fileName); + + if (file.open(QFile::ReadOnly)) { + QTextStream stream(&file); + // ### set the encoding + const QString plainText = stream.readAll(); + file.close(); + + QTextDocument doc; + doc.setPlainText(plainText); + + QList<QTextCursor> cursors; + const QList<Find::SearchResultItem> items = it.value(); + foreach (const Find::SearchResultItem &item, items) { + const int blockNumber = item.lineNumber - 1; + QTextCursor tc(doc.findBlockByNumber(blockNumber)); + tc.setPosition(tc.position() + item.searchTermStart); + tc.setPosition(tc.position() + item.searchTermLength, + QTextCursor::KeepAnchor); + cursors.append(tc); + } + + foreach (QTextCursor tc, cursors) + tc.insertText(text); + + QFile newFile(fileName); + if (newFile.open(QFile::WriteOnly)) { + QTextStream stream(&newFile); + // ### set the encoding + stream << doc.toPlainText(); + } + } + } + + const QStringList fileNames = changes.keys(); + _modelManager->updateSourceFiles(fileNames); +} + void CppFindReferences::displayResult(int index) { - Core::Utils::FileSearchResult result = m_watcher.future().resultAt(index); - Find::ResultWindowItem *item = _resultWindow->addResult(result.fileName, - result.lineNumber, - result.matchingLine, - result.matchStart, - result.matchLength); - if (item) - connect(item, SIGNAL(activated(const QString&,int,int)), - this, SLOT(openEditor(const QString&,int,int))); + Utils::FileSearchResult result = m_watcher.future().resultAt(index); + _resultWindow->addResult(result.fileName, + result.lineNumber, + result.matchingLine, + result.matchStart, + result.matchLength); } void CppFindReferences::searchFinished() @@ -530,8 +643,8 @@ void CppFindReferences::searchFinished() emit changed(); } -void CppFindReferences::openEditor(const QString &fileName, int line, int column) +void CppFindReferences::openEditor(const Find::SearchResultItem &item) { - TextEditor::BaseTextEditor::openEditorAt(fileName, line, column); + TextEditor::BaseTextEditor::openEditorAt(item.fileName, item.lineNumber, item.searchTermStart); } diff --git a/src/plugins/cpptools/cppfindreferences.h b/src/plugins/cpptools/cppfindreferences.h index 3de964f4bd43911ceb78cd31c6c982113ad77009..4b4a5a9b04b86db4987c94edfb02c0f0f624219f 100644 --- a/src/plugins/cpptools/cppfindreferences.h +++ b/src/plugins/cpptools/cppfindreferences.h @@ -39,6 +39,7 @@ namespace Find { class SearchResultWindow; + struct SearchResultItem; } // end of namespace Find namespace CppTools { @@ -62,17 +63,22 @@ Q_SIGNALS: void changed(); public: - void findAll(CPlusPlus::Symbol *symbol); + void findUsages(CPlusPlus::Symbol *symbol); + void renameUsages(CPlusPlus::Symbol *symbol); private Q_SLOTS: void displayResult(int); void searchFinished(); - void openEditor(const QString&, int, int); + void openEditor(const Find::SearchResultItem &item); + void onReplaceButtonClicked(const QString &text, const QList<Find::SearchResultItem> &items); + +private: + void findAll_helper(CPlusPlus::Symbol *symbol); private: QPointer<CppModelManager> _modelManager; Find::SearchResultWindow *_resultWindow; - QFutureWatcher<Core::Utils::FileSearchResult> m_watcher; + QFutureWatcher<Utils::FileSearchResult> m_watcher; }; } // end of namespace Internal diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 8aa6bdf767254cbae5a8387f25739bb8415f653e..56e7b1d48f5d23fb09a69c64731bdb0c505d4f8d 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -56,6 +56,8 @@ #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/progressmanager/progressmanager.h> +#include <extensionsystem/pluginmanager.h> + #include <utils/qtcassert.h> #include <TranslationUnit.h> @@ -588,6 +590,13 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc) } +CppTools::CppModelManagerInterface *CppTools::CppModelManagerInterface::instance() +{ + ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance(); + return pluginManager->getObject<CppTools::CppModelManagerInterface>(); + +} + /*! \class CppTools::CppModelManager @@ -746,10 +755,16 @@ QList<int> CppModelManager::references(CPlusPlus::Symbol *symbol, return m_findReferences->references(LookupContext::canonicalSymbol(symbol), doc, snapshot); } -void CppModelManager::findReferences(CPlusPlus::Symbol *symbol) +void CppModelManager::findUsages(CPlusPlus::Symbol *symbol) +{ + if (symbol->identifier()) + m_findReferences->findUsages(symbol); +} + +void CppModelManager::renameUsages(CPlusPlus::Symbol *symbol) { if (symbol->identifier()) - m_findReferences->findAll(symbol); + m_findReferences->renameUsages(symbol); } QMap<QString, QString> CppModelManager::buildWorkingCopyList() diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index 0f6911f97fe9c6dc168b1c85c45bc6534005324f..9aa3a800b2cd9c6c2913424f677efd4c25eb36a3 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -106,7 +106,8 @@ public: CPlusPlus::Document::Ptr doc, const CPlusPlus::Snapshot &snapshot); - virtual void findReferences(CPlusPlus::Symbol *symbol); + virtual void findUsages(CPlusPlus::Symbol *symbol); + virtual void renameUsages(CPlusPlus::Symbol *symbol); void setHeaderSuffixes(const QStringList &suffixes) { m_headerSuffixes = suffixes; } diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h index 0a2ba32e3808361550b774cbc8acd42cea339bc1..58b04d4bf57b38d814dbf5513225bc0b4cf28b57 100644 --- a/src/plugins/cpptools/cppmodelmanagerinterface.h +++ b/src/plugins/cpptools/cppmodelmanagerinterface.h @@ -81,6 +81,8 @@ public: CppModelManagerInterface(QObject *parent = 0) : QObject(parent) {} virtual ~CppModelManagerInterface() {} + static CppModelManagerInterface *instance(); + virtual void GC() = 0; virtual void updateSourceFiles(const QStringList &sourceFiles) = 0; @@ -99,7 +101,8 @@ public: CPlusPlus::Document::Ptr doc, const CPlusPlus::Snapshot &snapshot) = 0; - virtual void findReferences(CPlusPlus::Symbol *symbol) = 0; + virtual void renameUsages(CPlusPlus::Symbol *symbol) = 0; + virtual void findUsages(CPlusPlus::Symbol *symbol) = 0; }; class CPPTOOLS_EXPORT AbstractEditorSupport diff --git a/src/plugins/cpptools/cppsemanticsearch.cpp b/src/plugins/cpptools/cppsemanticsearch.cpp index 554290e478589a417edb7b7af8ac6ad2603480fb..bc8510625bbe0c834a5dc61d802896a890ff441e 100644 --- a/src/plugins/cpptools/cppsemanticsearch.cpp +++ b/src/plugins/cpptools/cppsemanticsearch.cpp @@ -51,7 +51,7 @@ class SearchClass: public SemanticSearch QTextDocument::FindFlags _findFlags; public: - SearchClass(QFutureInterface<Core::Utils::FileSearchResult> &future, + SearchClass(QFutureInterface<Utils::FileSearchResult> &future, Document::Ptr doc, Snapshot snapshot) : SemanticSearch(future, doc, snapshot) { } @@ -118,7 +118,7 @@ class SearchFunctionCall: public SemanticSearch QTextDocument::FindFlags _findFlags; public: - SearchFunctionCall(QFutureInterface<Core::Utils::FileSearchResult> &future, + SearchFunctionCall(QFutureInterface<Utils::FileSearchResult> &future, Document::Ptr doc, Snapshot snapshot) : SemanticSearch(future, doc, snapshot) { } @@ -184,7 +184,7 @@ protected: } // end of anonymous namespace -SemanticSearch::SemanticSearch(QFutureInterface<Core::Utils::FileSearchResult> &future, +SemanticSearch::SemanticSearch(QFutureInterface<Utils::FileSearchResult> &future, Document::Ptr doc, Snapshot snapshot) : ASTVisitor(doc->control()), @@ -236,11 +236,11 @@ void SemanticSearch::reportResult(unsigned tokenIndex, int offset, int len) if (col) --col; // adjust the column position. - _future.reportResult(Core::Utils::FileSearchResult(QDir::toNativeSeparators(_doc->fileName()), + _future.reportResult(Utils::FileSearchResult(QDir::toNativeSeparators(_doc->fileName()), line, lineText, col + offset, len)); } -SemanticSearch *SearchClassDeclarationsFactory::create(QFutureInterface<Core::Utils::FileSearchResult> &future, +SemanticSearch *SearchClassDeclarationsFactory::create(QFutureInterface<Utils::FileSearchResult> &future, Document::Ptr doc, Snapshot snapshot) { @@ -250,7 +250,7 @@ SemanticSearch *SearchClassDeclarationsFactory::create(QFutureInterface<Core::Ut return search; } -SemanticSearch *SearchFunctionCallFactory::create(QFutureInterface<Core::Utils::FileSearchResult> &future, +SemanticSearch *SearchFunctionCallFactory::create(QFutureInterface<Utils::FileSearchResult> &future, Document::Ptr doc, Snapshot snapshot) { @@ -260,7 +260,7 @@ SemanticSearch *SearchFunctionCallFactory::create(QFutureInterface<Core::Utils:: return search; } -static void semanticSearch_helper(QFutureInterface<Core::Utils::FileSearchResult> &future, +static void semanticSearch_helper(QFutureInterface<Utils::FileSearchResult> &future, QPointer<CppModelManager> modelManager, QMap<QString, QString> wl, SemanticSearchFactory::Ptr factory) @@ -272,6 +272,12 @@ static void semanticSearch_helper(QFutureInterface<Core::Utils::FileSearchResult int progress = 0; foreach (Document::Ptr doc, snapshot) { + if (future.isPaused()) + future.waitForResume(); + + if (future.isCanceled()) + break; + const QString fileName = doc->fileName(); QByteArray source; @@ -300,7 +306,7 @@ static void semanticSearch_helper(QFutureInterface<Core::Utils::FileSearchResult } } -QFuture<Core::Utils::FileSearchResult> CppTools::Internal::semanticSearch(QPointer<CppModelManager> modelManager, +QFuture<Utils::FileSearchResult> CppTools::Internal::semanticSearch(QPointer<CppModelManager> modelManager, SemanticSearchFactory::Ptr factory) { return QtConcurrent::run(&semanticSearch_helper, modelManager, diff --git a/src/plugins/cpptools/cppsemanticsearch.h b/src/plugins/cpptools/cppsemanticsearch.h index c6191108322b2c84817794f4ca6d26bd4ff44982..b0ff968b4d841796134d04c689a664dd43724aa7 100644 --- a/src/plugins/cpptools/cppsemanticsearch.h +++ b/src/plugins/cpptools/cppsemanticsearch.h @@ -48,14 +48,14 @@ class SemanticSearchFactory; class SemanticSearch: protected CPlusPlus::ASTVisitor { - QFutureInterface<Core::Utils::FileSearchResult> &_future; + QFutureInterface<Utils::FileSearchResult> &_future; CPlusPlus::Document::Ptr _doc; CPlusPlus::Snapshot _snapshot; CPlusPlus::Document::Ptr _thisDocument; QByteArray _source; public: - SemanticSearch(QFutureInterface<Core::Utils::FileSearchResult> &future, + SemanticSearch(QFutureInterface<Utils::FileSearchResult> &future, CPlusPlus::Document::Ptr doc, CPlusPlus::Snapshot snapshot); @@ -81,7 +81,7 @@ public: SemanticSearchFactory() {} virtual ~SemanticSearchFactory() {} - virtual SemanticSearch *create(QFutureInterface<Core::Utils::FileSearchResult> &future, + virtual SemanticSearch *create(QFutureInterface<Utils::FileSearchResult> &future, CPlusPlus::Document::Ptr doc, CPlusPlus::Snapshot snapshot) = 0; }; @@ -96,7 +96,7 @@ public: : _text(text), _findFlags(findFlags) { } - virtual SemanticSearch *create(QFutureInterface<Core::Utils::FileSearchResult> &future, + virtual SemanticSearch *create(QFutureInterface<Utils::FileSearchResult> &future, CPlusPlus::Document::Ptr doc, CPlusPlus::Snapshot snapshot); }; @@ -111,12 +111,12 @@ public: : _text(text), _findFlags(findFlags) { } - virtual SemanticSearch *create(QFutureInterface<Core::Utils::FileSearchResult> &future, + virtual SemanticSearch *create(QFutureInterface<Utils::FileSearchResult> &future, CPlusPlus::Document::Ptr doc, CPlusPlus::Snapshot snapshot); }; -QFuture<Core::Utils::FileSearchResult> semanticSearch(QPointer<CppModelManager> modelManager, +QFuture<Utils::FileSearchResult> semanticSearch(QPointer<CppModelManager> modelManager, SemanticSearchFactory::Ptr factory); diff --git a/src/plugins/cpptools/cpptoolsplugin.cpp b/src/plugins/cpptools/cpptoolsplugin.cpp index 294530112828a42a242ce8dacd1961befba9a992..c3f09a98f1b5351dbf2a6120e95a358521ebc3db 100644 --- a/src/plugins/cpptools/cpptoolsplugin.cpp +++ b/src/plugins/cpptools/cpptoolsplugin.cpp @@ -86,14 +86,17 @@ FindClassDeclarations::FindClassDeclarations(CppModelManager *modelManager) void FindClassDeclarations::findAll(const QString &text, QTextDocument::FindFlags findFlags) { - _resultWindow->clearContents(); + Find::SearchResult *search = _resultWindow->startNewSearch(); + connect(search, SIGNAL(activated(Find::SearchResultItem)), + this, SLOT(openEditor(Find::SearchResultItem))); + _resultWindow->popup(true); Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); SemanticSearchFactory::Ptr factory(new SearchClassDeclarationsFactory(text, findFlags)); - QFuture<Core::Utils::FileSearchResult> result = semanticSearch(_modelManager, factory); + QFuture<Utils::FileSearchResult> result = semanticSearch(_modelManager, factory); m_watcher.setFuture(result); @@ -106,15 +109,12 @@ void FindClassDeclarations::findAll(const QString &text, QTextDocument::FindFlag void FindClassDeclarations::displayResult(int index) { - Core::Utils::FileSearchResult result = m_watcher.future().resultAt(index); - Find::ResultWindowItem *item = _resultWindow->addResult(result.fileName, - result.lineNumber, - result.matchingLine, - result.matchStart, - result.matchLength); - if (item) - connect(item, SIGNAL(activated(const QString&,int,int)), - this, SLOT(openEditor(const QString&,int,int))); + Utils::FileSearchResult result = m_watcher.future().resultAt(index); + _resultWindow->addResult(result.fileName, + result.lineNumber, + result.matchingLine, + result.matchStart, + result.matchLength); } void FindClassDeclarations::searchFinished() @@ -122,9 +122,9 @@ void FindClassDeclarations::searchFinished() emit changed(); } -void FindClassDeclarations::openEditor(const QString &fileName, int line, int column) +void FindClassDeclarations::openEditor(const Find::SearchResultItem &item) { - TextEditor::BaseTextEditor::openEditorAt(fileName, line, column); + TextEditor::BaseTextEditor::openEditorAt(item.fileName, item.lineNumber, item.searchTermStart); } ////// @@ -139,14 +139,17 @@ FindFunctionCalls::FindFunctionCalls(CppModelManager *modelManager) void FindFunctionCalls::findAll(const QString &text, QTextDocument::FindFlags findFlags) { - _resultWindow->clearContents(); + Find::SearchResult *search = _resultWindow->startNewSearch(); + connect(search, SIGNAL(activated(Find::SearchResultItem)), + this, SLOT(openEditor(Find::SearchResultItem))); + _resultWindow->popup(true); Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); SemanticSearchFactory::Ptr factory(new SearchFunctionCallFactory(text, findFlags)); - QFuture<Core::Utils::FileSearchResult> result = semanticSearch(_modelManager, factory); + QFuture<Utils::FileSearchResult> result = semanticSearch(_modelManager, factory); m_watcher.setFuture(result); @@ -159,15 +162,12 @@ void FindFunctionCalls::findAll(const QString &text, QTextDocument::FindFlags fi void FindFunctionCalls::displayResult(int index) { - Core::Utils::FileSearchResult result = m_watcher.future().resultAt(index); - Find::ResultWindowItem *item = _resultWindow->addResult(result.fileName, - result.lineNumber, - result.matchingLine, - result.matchStart, - result.matchLength); - if (item) - connect(item, SIGNAL(activated(const QString&,int,int)), - this, SLOT(openEditor(const QString&,int,int))); + Utils::FileSearchResult result = m_watcher.future().resultAt(index); + _resultWindow->addResult(result.fileName, + result.lineNumber, + result.matchingLine, + result.matchStart, + result.matchLength); } void FindFunctionCalls::searchFinished() @@ -175,9 +175,9 @@ void FindFunctionCalls::searchFinished() emit changed(); } -void FindFunctionCalls::openEditor(const QString &fileName, int line, int column) +void FindFunctionCalls::openEditor(const Find::SearchResultItem &item) { - TextEditor::BaseTextEditor::openEditorAt(fileName, line, column); + TextEditor::BaseTextEditor::openEditorAt(item.fileName, item.lineNumber, item.searchTermStart); } diff --git a/src/plugins/cpptools/cpptoolsplugin.h b/src/plugins/cpptools/cpptoolsplugin.h index 3a86d8eb6133a69af2bec33d35716fa185f46f03..a78bf260c0ebf8c2957f34600a3e2f4b33e7ed02 100644 --- a/src/plugins/cpptools/cpptoolsplugin.h +++ b/src/plugins/cpptools/cpptoolsplugin.h @@ -53,6 +53,7 @@ class Snapshot; namespace Find { class SearchResultWindow; +struct SearchResultItem; } namespace CppTools { @@ -79,12 +80,12 @@ public: protected Q_SLOTS: void displayResult(int); void searchFinished(); - void openEditor(const QString&, int, int); + void openEditor(const Find::SearchResultItem &item); private: QPointer<CppModelManager> _modelManager; Find::SearchResultWindow *_resultWindow; - QFutureWatcher<Core::Utils::FileSearchResult> m_watcher; + QFutureWatcher<Utils::FileSearchResult> m_watcher; }; class FindFunctionCalls: public Find::IFindFilter // ### share code with FindClassDeclarations @@ -104,12 +105,12 @@ public: protected Q_SLOTS: void displayResult(int); void searchFinished(); - void openEditor(const QString&, int, int); + void openEditor(const Find::SearchResultItem &item); private: QPointer<CppModelManager> _modelManager; Find::SearchResultWindow *_resultWindow; - QFutureWatcher<Core::Utils::FileSearchResult> m_watcher; + QFutureWatcher<Utils::FileSearchResult> m_watcher; }; class CppToolsPlugin : public ExtensionSystem::IPlugin diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp index 922f6229f3f594fa958ec70a94aa038676cce444..38b2ed74d016e85c85a2a9c277ebe24ef43084c5 100644 --- a/src/plugins/cvs/cvsplugin.cpp +++ b/src/plugins/cvs/cvsplugin.cpp @@ -260,7 +260,7 @@ bool CVSPlugin::initialize(const QStringList &arguments, QString *errorMessage) globalcontext << core->uniqueIDManager()->uniqueIdentifier(C_GLOBAL); Core::Command *command; - m_addAction = new Core::Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_addAction, CMD_ID_ADD, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -270,14 +270,14 @@ bool CVSPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile())); cvsMenu->addAction(command); - m_deleteAction = new Core::Utils::ParameterAction(tr("Delete"), tr("Delete \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_deleteAction = new Utils::ParameterAction(tr("Delete"), tr("Delete \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_deleteAction, CMD_ID_DELETE_FILE, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(deleteCurrentFile())); cvsMenu->addAction(command); - m_revertAction = new Core::Utils::ParameterAction(tr("Revert"), tr("Revert \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_revertAction = new Utils::ParameterAction(tr("Revert"), tr("Revert \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_revertAction, CMD_ID_REVERT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -292,7 +292,7 @@ bool CVSPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject())); cvsMenu->addAction(command); - m_diffCurrentAction = new Core::Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_diffCurrentAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_diffCurrentAction, CMD_ID_DIFF_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -310,7 +310,7 @@ bool CVSPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll())); cvsMenu->addAction(command); - m_commitCurrentAction = new Core::Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_commitCurrentAction = new Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_commitCurrentAction, CMD_ID_COMMIT_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -322,7 +322,7 @@ bool CVSPlugin::initialize(const QStringList &arguments, QString *errorMessage) cvsMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR2, globalcontext)); - m_filelogCurrentAction = new Core::Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -330,7 +330,7 @@ bool CVSPlugin::initialize(const QStringList &arguments, QString *errorMessage) SLOT(filelogCurrentFile())); cvsMenu->addAction(command); - m_annotateCurrentAction = new Core::Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -1081,7 +1081,7 @@ CVSResponse CVSPlugin::runCVS(const QString &workingDirectory, qDebug() << "runCVS" << timeOut << outputText; // Run, connect stderr to the output window - Core::Utils::SynchronousProcess process; + Utils::SynchronousProcess process; if (!response.workingDirectory.isEmpty()) process.setWorkingDirectory(response.workingDirectory); @@ -1101,25 +1101,25 @@ CVSResponse CVSPlugin::runCVS(const QString &workingDirectory, connect(&process, SIGNAL(stdOutBuffered(QString,bool)), outputWindow, SLOT(append(QString))); } - const Core::Utils::SynchronousProcessResponse sp_resp = process.run(executable, allArgs); + const Utils::SynchronousProcessResponse sp_resp = process.run(executable, allArgs); response.result = CVSResponse::OtherError; response.stdErr = sp_resp.stdErr; response.stdOut = sp_resp.stdOut; switch (sp_resp.result) { - case Core::Utils::SynchronousProcessResponse::Finished: + case Utils::SynchronousProcessResponse::Finished: response.result = CVSResponse::Ok; break; - case Core::Utils::SynchronousProcessResponse::FinishedError: + case Utils::SynchronousProcessResponse::FinishedError: response.result = CVSResponse::NonNullExitCode; response.message = tr("The process terminated with exit code %1.").arg(sp_resp.exitCode); break; - case Core::Utils::SynchronousProcessResponse::TerminatedAbnormally: + case Utils::SynchronousProcessResponse::TerminatedAbnormally: response.message = tr("The process terminated abnormally."); break; - case Core::Utils::SynchronousProcessResponse::StartFailed: + case Utils::SynchronousProcessResponse::StartFailed: response.message = tr("Could not start cvs '%1'. Please check your settings in the preferences.").arg(executable); break; - case Core::Utils::SynchronousProcessResponse::Hang: + case Utils::SynchronousProcessResponse::Hang: response.message = tr("CVS did not respond within timeout limit (%1 ms).").arg(timeOut); break; } diff --git a/src/plugins/cvs/cvsplugin.h b/src/plugins/cvs/cvsplugin.h index bac3815d861e451d9295a37c9fcf28d5f6544390..c0f63473b2b202d95871a7b3d5f73f4900b8fdc8 100644 --- a/src/plugins/cvs/cvsplugin.h +++ b/src/plugins/cvs/cvsplugin.h @@ -45,9 +45,10 @@ QT_END_NAMESPACE namespace Core { class IEditorFactory; class IVersionControl; - namespace Utils { - class ParameterAction; - } +} + +namespace Utils { + class ParameterAction; } namespace ProjectExplorer { @@ -157,15 +158,15 @@ private: ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; - Core::Utils::ParameterAction *m_addAction; - Core::Utils::ParameterAction *m_deleteAction; - Core::Utils::ParameterAction *m_revertAction; + Utils::ParameterAction *m_addAction; + Utils::ParameterAction *m_deleteAction; + Utils::ParameterAction *m_revertAction; QAction *m_diffProjectAction; - Core::Utils::ParameterAction *m_diffCurrentAction; + Utils::ParameterAction *m_diffCurrentAction; QAction *m_commitAllAction; - Core::Utils::ParameterAction *m_commitCurrentAction; - Core::Utils::ParameterAction *m_filelogCurrentAction; - Core::Utils::ParameterAction *m_annotateCurrentAction; + Utils::ParameterAction *m_commitCurrentAction; + Utils::ParameterAction *m_filelogCurrentAction; + Utils::ParameterAction *m_annotateCurrentAction; QAction *m_statusAction; QAction *m_updateProjectAction; diff --git a/src/plugins/cvs/cvssubmiteditor.cpp b/src/plugins/cvs/cvssubmiteditor.cpp index 35310e98f595ad1d069729be31921a9e7bded2b8..b19aeb7dde0d6f4f5bbc69bb49240ad559aebf90 100644 --- a/src/plugins/cvs/cvssubmiteditor.cpp +++ b/src/plugins/cvs/cvssubmiteditor.cpp @@ -37,7 +37,7 @@ using namespace CVS::Internal; CVSSubmitEditor::CVSSubmitEditor(const VCSBase::VCSBaseSubmitEditorParameters *parameters, QWidget *parentWidget) : - VCSBase::VCSBaseSubmitEditor(parameters, new Core::Utils::SubmitEditorWidget(parentWidget)), + VCSBase::VCSBaseSubmitEditor(parameters, new Utils::SubmitEditorWidget(parentWidget)), m_msgAdded(tr("Added")), m_msgRemoved(tr("Removed")), m_msgModified(tr("Modified")) diff --git a/src/plugins/cvs/settingspage.cpp b/src/plugins/cvs/settingspage.cpp index 327f63a36a658c8ff7f4cece427b548c18e25011..72e17ee5d44640e1ec9d0df084e7e58805bacd97 100644 --- a/src/plugins/cvs/settingspage.cpp +++ b/src/plugins/cvs/settingspage.cpp @@ -40,7 +40,7 @@ #include <QtGui/QFileDialog> using namespace CVS::Internal; -using namespace Core::Utils; +using namespace Utils; SettingsPageWidget::SettingsPageWidget(QWidget *parent) : QWidget(parent) diff --git a/src/plugins/cvs/settingspage.ui b/src/plugins/cvs/settingspage.ui index efff37aadd889b0fb7b478797b2a5636f2d301b3..2eaf4c935df4017276471c8dba7a01872208f503 100644 --- a/src/plugins/cvs/settingspage.ui +++ b/src/plugins/cvs/settingspage.ui @@ -63,7 +63,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="Core::Utils::PathChooser" name="commandPathChooser"/> + <widget class="Utils::PathChooser" name="commandPathChooser"/> </item> <item row="1" column="0"> <widget class="QLabel" name="rootLabel"> @@ -119,7 +119,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/debugger/attachcoredialog.ui b/src/plugins/debugger/attachcoredialog.ui index 271cfb2051e836c2c9427434443a9b1c0efd8ef4..513b12eeab09e52fadd812adb797e282e989646f 100644 --- a/src/plugins/debugger/attachcoredialog.ui +++ b/src/plugins/debugger/attachcoredialog.ui @@ -43,10 +43,10 @@ </widget> </item> <item row="0" column="1"> - <widget class="Core::Utils::PathChooser" name="execFileName" native="true"/> + <widget class="Utils::PathChooser" name="execFileName" native="true"/> </item> <item row="1" column="1"> - <widget class="Core::Utils::PathChooser" name="coreFileName" native="true"/> + <widget class="Utils::PathChooser" name="coreFileName" native="true"/> </item> </layout> </item> @@ -84,7 +84,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/debugger/attachtcfdialog.ui b/src/plugins/debugger/attachtcfdialog.ui index a7ccaf03b4d012ba41385c5c16b7f1b955696700..c890f11ff95362ba151e96813c4de28b86ef38c3 100644 --- a/src/plugins/debugger/attachtcfdialog.ui +++ b/src/plugins/debugger/attachtcfdialog.ui @@ -60,7 +60,7 @@ </widget> </item> <item row="3" column="1"> - <widget class="Core::Utils::PathChooser" name="serverStartScript" native="true"/> + <widget class="Utils::PathChooser" name="serverStartScript" native="true"/> </item> <item row="3" column="0"> <widget class="QLabel" name="serverStartScriptLabel"> @@ -85,7 +85,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> </customwidget> diff --git a/src/plugins/debugger/cdb/cdbdebugengine.cpp b/src/plugins/debugger/cdb/cdbdebugengine.cpp index 462a71cf8755482a992def56ca2c3233924c408e..11f37d15f1928cf6f919f03e4aecfb5dc8f01bf6 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine.cpp +++ b/src/plugins/debugger/cdb/cdbdebugengine.cpp @@ -107,7 +107,7 @@ QString msgDebugEngineComResult(HRESULT hr) return QLatin1String("ERROR_ACCESS_DENIED");; if (hr == HRESULT_FROM_NT(STATUS_CONTROL_C_EXIT)) return QLatin1String("STATUS_CONTROL_C_EXIT"); - return QLatin1String("E_FAIL ") + Core::Utils::winErrorMessage(HRESULT_CODE(hr)); + return QLatin1String("E_FAIL ") + Utils::winErrorMessage(HRESULT_CODE(hr)); } static QString msgStackIndexOutOfRange(int idx, int size) @@ -462,7 +462,7 @@ CdbDebugEngine::CdbDebugEngine(DebuggerManager *manager, const QSharedPointer<Cd IDebuggerEngine(manager), m_d(new CdbDebugEnginePrivate(manager, options, this)) { - m_d->m_consoleStubProc.setMode(Core::Utils::ConsoleProcess::Suspend); + m_d->m_consoleStubProc.setMode(Utils::ConsoleProcess::Suspend); connect(&m_d->m_consoleStubProc, SIGNAL(processError(QString)), this, SLOT(slotConsoleStubError(QString))); connect(&m_d->m_consoleStubProc, SIGNAL(processStarted()), @@ -710,13 +710,13 @@ bool CdbDebugEngine::startDebuggerWithExecutable(DebuggerStartMode sm, QString * symbolOptions |= SYMOPT_DEBUG; m_d->m_cif.debugSymbols->SetSymbolOptions(symbolOptions); - const QString cmd = Core::Utils::AbstractProcess::createWinCommandline(filename, sp->processArgs); + const QString cmd = Utils::AbstractProcess::createWinCommandline(filename, sp->processArgs); if (debugCDB) qDebug() << "Starting " << cmd; PCWSTR env = 0; QByteArray envData; if (!sp->environment.empty()) { - envData = Core::Utils::AbstractProcess::createWinEnvironment(Core::Utils::AbstractProcess::fixWinEnvironment(sp->environment)); + envData = Utils::AbstractProcess::createWinEnvironment(Utils::AbstractProcess::fixWinEnvironment(sp->environment)); env = reinterpret_cast<PCWSTR>(envData.data()); } // The working directory cannot be empty. @@ -1170,7 +1170,7 @@ bool CdbDebugEnginePrivate::interruptInterferiorProcess(QString *errorMessage) } if (!DebugBreakProcess(m_hDebuggeeProcess)) { - *errorMessage = QString::fromLatin1("DebugBreakProcess failed: %1").arg(Core::Utils::winErrorMessage(GetLastError())); + *errorMessage = QString::fromLatin1("DebugBreakProcess failed: %1").arg(Utils::winErrorMessage(GetLastError())); return false; } #if 0 @@ -1701,36 +1701,12 @@ ULONG CdbDebugEnginePrivate::updateThreadList() if (debugCDB) qDebug() << Q_FUNC_INFO << m_hDebuggeeProcess; - ThreadsHandler* th = manager()->threadsHandler(); QList<ThreadData> threads; - bool success = false; + ULONG currentThreadId; QString errorMessage; - ULONG currentThreadId = 0; - do { - ULONG threadCount; - HRESULT hr= m_cif.debugSystemObjects->GetNumberThreads(&threadCount); - if (FAILED(hr)) { - errorMessage= msgComFailed("GetNumberThreads", hr); - break; - } - // Get ids and index of current - if (threadCount) { - m_cif.debugSystemObjects->GetCurrentThreadId(¤tThreadId); - QVector<ULONG> threadIds(threadCount); - hr = m_cif.debugSystemObjects->GetThreadIdsByIndex(0, threadCount, &(*threadIds.begin()), 0); - if (FAILED(hr)) { - errorMessage= msgComFailed("GetThreadIdsByIndex", hr); - break; - } - for (ULONG i = 0; i < threadCount; i++) - threads.push_back(ThreadData(threadIds.at(i))); - } - - th->setThreads(threads); - success = true; - } while (false); - if (!success) - m_engine->warning(msgFunctionFailed(Q_FUNC_INFO, errorMessage)); + if (!CdbStackTraceContext::getThreads(m_cif, true, &threads, ¤tThreadId, &errorMessage)) + m_engine->warning(errorMessage); + manager()->threadsHandler()->setThreads(threads); return currentThreadId; } diff --git a/src/plugins/debugger/cdb/cdbdebugengine_p.h b/src/plugins/debugger/cdb/cdbdebugengine_p.h index f302713872537735514f8b33d66754e4cca9f08d..72a154906ccaa127ebb9bb3076e339646ac63b2f 100644 --- a/src/plugins/debugger/cdb/cdbdebugengine_p.h +++ b/src/plugins/debugger/cdb/cdbdebugengine_p.h @@ -175,7 +175,7 @@ struct CdbDebugEnginePrivate bool m_firstActivatedFrame; DebuggerStartMode m_mode; - Core::Utils::ConsoleProcess m_consoleStubProc; + Utils::ConsoleProcess m_consoleStubProc; }; // helper functions diff --git a/src/plugins/debugger/cdb/cdboptionspage.cpp b/src/plugins/debugger/cdb/cdboptionspage.cpp index 04ce314804c2c6648565dce9739013d77eb03bbd..f8cdc051682a592c2487a00c9001c0833fd2e203 100644 --- a/src/plugins/debugger/cdb/cdboptionspage.cpp +++ b/src/plugins/debugger/cdb/cdboptionspage.cpp @@ -72,7 +72,7 @@ CdbOptionsPageWidget::CdbOptionsPageWidget(QWidget *parent) : m_ui.noteLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); connect(m_ui.noteLabel, SIGNAL(linkActivated(QString)), this, SLOT(downLoadLinkActivated(QString))); - m_ui.pathChooser->setExpectedKind(Core::Utils::PathChooser::Directory); + m_ui.pathChooser->setExpectedKind(Utils::PathChooser::Directory); m_ui.pathChooser->addButton(tr("Autodetect"), this, SLOT(autoDetect())); m_ui.failureLabel->setVisible(false); } diff --git a/src/plugins/debugger/cdb/cdboptionspagewidget.ui b/src/plugins/debugger/cdb/cdboptionspagewidget.ui index b998e7c6f3c05408deae5d381423cdab85afdc55..5ff8605d080879ef2f5e5049a739725d4e754346 100644 --- a/src/plugins/debugger/cdb/cdboptionspagewidget.ui +++ b/src/plugins/debugger/cdb/cdboptionspagewidget.ui @@ -33,7 +33,7 @@ </widget> </item> <item row="1" column="1"> - <widget class="Core::Utils::PathChooser" name="pathChooser" native="true"/> + <widget class="Utils::PathChooser" name="pathChooser" native="true"/> </item> <item row="0" column="0" colspan="2"> <widget class="QLabel" name="noteLabel"> @@ -74,7 +74,7 @@ </widget> </item> <item row="1" column="1"> - <widget class="Core::Utils::PathListEditor" name="sourcePathListEditor" native="true"/> + <widget class="Utils::PathListEditor" name="sourcePathListEditor" native="true"/> </item> </layout> </widget> @@ -122,13 +122,13 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> </customwidget> <customwidget> - <class>Core::Utils::PathListEditor</class> + <class>Utils::PathListEditor</class> <extends>QWidget</extends> <header location="global">utils/pathlisteditor.h</header> <container>1</container> diff --git a/src/plugins/debugger/cdb/cdbstacktracecontext.cpp b/src/plugins/debugger/cdb/cdbstacktracecontext.cpp index 40cd9776bcb94a3880a19241ab44683d36438d0b..8cf72461fe4b7a33895274e4ab9a9fb2e8a6d39e 100644 --- a/src/plugins/debugger/cdb/cdbstacktracecontext.cpp +++ b/src/plugins/debugger/cdb/cdbstacktracecontext.cpp @@ -219,5 +219,115 @@ void CdbStackTraceContext::format(QTextStream &str) const } } +// Thread state helper + +static inline QString msgGetThreadStateFailed(unsigned long threadId, const QString &why) +{ + return QString::fromLatin1("Unable to determine the state of thread %1: %2").arg(threadId).arg(why); +} + +// Determine information about thread. This changes the +// current thread to thread->id. +static inline bool getStoppedThreadState(const CdbComInterfaces &cif, + ThreadData *t, + QString *errorMessage) +{ + ULONG currentThread; + HRESULT hr = cif.debugSystemObjects->GetCurrentThreadId(¤tThread); + if (FAILED(hr)) { + *errorMessage = msgGetThreadStateFailed(t->id, msgComFailed("GetCurrentThreadId", hr)); + return false; + } + if (currentThread != t->id) { + hr = cif.debugSystemObjects->SetCurrentThreadId(t->id); + if (FAILED(hr)) { + *errorMessage = msgGetThreadStateFailed(t->id, msgComFailed("SetCurrentThreadId", hr)); + return false; + } + } + ULONG frameCount; + DEBUG_STACK_FRAME topFrame[1]; + hr = cif.debugControl->GetStackTrace(0, 0, 0, topFrame, 1, &frameCount); + if (FAILED(hr)) { + *errorMessage = msgGetThreadStateFailed(t->id, msgComFailed("GetStackTrace", hr)); + return false; + } + + t->address = topFrame[0].InstructionOffset; + WCHAR wszBuf[MAX_PATH]; + + cif.debugSymbols->GetNameByOffsetWide(topFrame[0].InstructionOffset, wszBuf, MAX_PATH, 0, 0); + t->function = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)); + ULONG ulLine; + hr = cif.debugSymbols->GetLineByOffsetWide(topFrame[0].InstructionOffset, &ulLine, wszBuf, MAX_PATH, 0, 0); + if (SUCCEEDED(hr)) { + t->line = ulLine; + // Just display base name + t->file = QString::fromUtf16(reinterpret_cast<const ushort *>(wszBuf)); + if (!t->file.isEmpty()) { + const int slashPos = t->file.lastIndexOf(QLatin1Char('\\')); + if (slashPos != -1) + t->file.remove(0, slashPos + 1); + } + } + return true; +} + +static inline QString msgGetThreadsFailed(const QString &why) +{ + return QString::fromLatin1("Unable to determine the thread information: %1").arg(why); +} + +bool CdbStackTraceContext::getThreads(const CdbComInterfaces &cif, + bool isStopped, + QList<ThreadData> *threads, + ULONG *currentThreadId, + QString *errorMessage) +{ + threads->clear(); + ULONG threadCount; + *currentThreadId = 0; + HRESULT hr= cif.debugSystemObjects->GetNumberThreads(&threadCount); + if (FAILED(hr)) { + *errorMessage= msgGetThreadsFailed(msgComFailed("GetNumberThreads", hr)); + return false; + } + // Get ids and index of current + if (!threadCount) + return true; + hr = cif.debugSystemObjects->GetCurrentThreadId(currentThreadId); + if (FAILED(hr)) { + *errorMessage= msgGetThreadsFailed(msgComFailed("GetCurrentThreadId", hr)); + return false; + } + + QVector<ULONG> threadIds(threadCount); + hr = cif.debugSystemObjects->GetThreadIdsByIndex(0, threadCount, &(*threadIds.begin()), 0); + if (FAILED(hr)) { + *errorMessage= msgGetThreadsFailed(msgComFailed("GetThreadIdsByIndex", hr)); + return false; + } + for (ULONG i = 0; i < threadCount; i++) { + ThreadData threadData(threadIds.at(i)); + if (isStopped) { + if (!getStoppedThreadState(cif, &threadData, errorMessage)) { + qWarning("%s\n", qPrintable(*errorMessage)); + errorMessage->clear(); + } + } + threads->push_back(threadData); + } + // Restore thread id + if (isStopped && threads->back().id != *currentThreadId) { + hr = cif.debugSystemObjects->SetCurrentThreadId(*currentThreadId); + if (FAILED(hr)) { + *errorMessage= msgGetThreadsFailed(msgComFailed("SetCurrentThreadId", hr)); + return false; + } + } + return true; +} + + } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/cdb/cdbstacktracecontext.h b/src/plugins/debugger/cdb/cdbstacktracecontext.h index d0d05bea1e8de609120f7aaab61710e94072ebda..ff8c62d5b19dcfda20f91100474229942e0e09cb 100644 --- a/src/plugins/debugger/cdb/cdbstacktracecontext.h +++ b/src/plugins/debugger/cdb/cdbstacktracecontext.h @@ -49,6 +49,7 @@ struct CdbComInterfaces; class CdbSymbolGroupContext; class CdbStackFrameContext; class CdbDumperHelper; +struct ThreadData; /* Context representing a break point stack consisting of several frames. * Maintains an on-demand constructed list of CdbStackFrameContext @@ -81,6 +82,14 @@ public: void format(QTextStream &str) const; QString toString() const; + // Retrieve information about threads. When stopped, add + // current stack frame. + static bool getThreads(const CdbComInterfaces &cif, + bool isStopped, + QList<ThreadData> *threads, + ULONG *currentThreadId, + QString *errorMessage); + private: bool init(unsigned long frameCount, QString *errorMessage); CIDebugSymbolGroup *createSymbolGroup(int index, QString *errorMessage); diff --git a/src/plugins/debugger/cdb/cdbsymbolpathlisteditor.cpp b/src/plugins/debugger/cdb/cdbsymbolpathlisteditor.cpp index 6af1b4648f95b466eeacb5e570131f0563ee6caa..3b8181a95e3a35dc75f3591d67e6734557d1512a 100644 --- a/src/plugins/debugger/cdb/cdbsymbolpathlisteditor.cpp +++ b/src/plugins/debugger/cdb/cdbsymbolpathlisteditor.cpp @@ -36,7 +36,7 @@ namespace Debugger { namespace Internal { CdbSymbolPathListEditor::CdbSymbolPathListEditor(QWidget *parent) : - Core::Utils::PathListEditor(parent) + Utils::PathListEditor(parent) { //! Add Microsoft Symbol server connection QAction *action = insertAction(lastAddActionIndex() + 1, tr("Symbol Server..."), this, SLOT(addSymbolServer())); diff --git a/src/plugins/debugger/cdb/cdbsymbolpathlisteditor.h b/src/plugins/debugger/cdb/cdbsymbolpathlisteditor.h index d95d89f8cfffae69b31f3b58fe36eed934806406..08f052531c32fab19998f2900952cc5fd35f6e57 100644 --- a/src/plugins/debugger/cdb/cdbsymbolpathlisteditor.h +++ b/src/plugins/debugger/cdb/cdbsymbolpathlisteditor.h @@ -35,7 +35,7 @@ namespace Debugger { namespace Internal { -class CdbSymbolPathListEditor : public Core::Utils::PathListEditor +class CdbSymbolPathListEditor : public Utils::PathListEditor { Q_OBJECT public: diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 6ef805bd96d9c27ced211a175d96561da1b88197..a2c1da01721b361222cfad6383486374127f8f96 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -41,7 +41,7 @@ #include <QtGui/QCheckBox> #include <QtGui/QLineEdit> -using namespace Core::Utils; +using namespace Utils; namespace Debugger { namespace Internal { @@ -84,7 +84,7 @@ void DebuggerSettings::writeSettings(QSettings *settings) const SavedAction *DebuggerSettings::item(int code) const { - QTC_ASSERT(m_items.value(code, 0), return 0); + QTC_ASSERT(m_items.value(code, 0), qDebug() << "CODE: " << code; return 0); return m_items.value(code, 0); } @@ -162,6 +162,16 @@ DebuggerSettings *DebuggerSettings::instance() "disassembled instructions.")); instance->insertItem(OperateByInstruction, item); + item = new SavedAction(instance); + item->setText(tr("Dereference pointers automatically")); + item->setCheckable(true); + item->setDefaultValue(true); + item->setToolTip(tr("This switches the Locals&Watchers view to " + "automatically derefence pointers. This saves a level in the " + "tree view, but also loses data for the now-missing intermediate " + "level.")); + instance->insertItem(AutoDerefPointers, item); + // // Locals & Watchers // diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index d8c1966abdefa66b4dcb30879f045cd2e3f744e6..ffc334b268fce0ca9e1045caeea03ebd8ac1d567 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -48,8 +48,8 @@ public: DebuggerSettings(QObject *parent = 0); ~DebuggerSettings(); - void insertItem(int code, Core::Utils::SavedAction *item); - Core::Utils::SavedAction *item(int code) const; + void insertItem(int code, Utils::SavedAction *item); + Utils::SavedAction *item(int code) const; QString dump() const; @@ -60,7 +60,7 @@ public slots: void writeSettings(QSettings *settings) const; private: - QHash<int, Core::Utils::SavedAction *> m_items; + QHash<int, Utils::SavedAction *> m_items; }; @@ -78,6 +78,7 @@ enum DebuggerActionCode LockView, LogTimeStamps, OperateByInstruction, + AutoDerefPointers, RecheckDebuggingHelpers, UseDebuggingHelpers, @@ -126,7 +127,7 @@ enum DebuggerActionCode }; // singleton access -Core::Utils::SavedAction *theDebuggerAction(int code); +Utils::SavedAction *theDebuggerAction(int code); // convenience bool theDebuggerBoolSetting(int code); diff --git a/src/plugins/debugger/debuggeragents.cpp b/src/plugins/debugger/debuggeragents.cpp index de8a553180d16af53956049df03d40bc1ab5e1e9..6f108cc9b9420c018c84ec885a49821a5aca4686 100644 --- a/src/plugins/debugger/debuggeragents.cpp +++ b/src/plugins/debugger/debuggeragents.cpp @@ -183,7 +183,7 @@ private: */ DisassemblerViewAgent::DisassemblerViewAgent(DebuggerManager *manager) - : QObject(0), d(new DisassemblerViewAgentPrivate), m_manager(manager) + : QObject(0), d(new DisassemblerViewAgentPrivate) { d->editor = 0; d->locationMark = new LocationMark2(); @@ -226,7 +226,7 @@ void DisassemblerViewAgent::setFrame(const StackFrame &frame) if (it != d->cache.end()) { QString msg = _("Use cache dissassembler for '%1' in '%2'") .arg(frame.function).arg(frame.file); - m_manager->showDebuggerOutput(msg); + d->manager->showDebuggerOutput(msg); setContents(*it); return; } diff --git a/src/plugins/debugger/debuggeragents.h b/src/plugins/debugger/debuggeragents.h index ed3daef9a49bf65b4cef713183922f99c4e4547c..ff7e4879aa6c52fcee8ecc9d4969a7542c3ac796 100644 --- a/src/plugins/debugger/debuggeragents.h +++ b/src/plugins/debugger/debuggeragents.h @@ -91,7 +91,6 @@ public: private: DisassemblerViewAgentPrivate *d; - DebuggerManager *m_manager; }; diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 4796a9b0f19b77b42d2cbbd856472e6861205c38..199a6f52180bf86e27a220de63aab38115d20ced 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -130,10 +130,10 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent) { m_ui->setupUi(this); - m_ui->execFileName->setExpectedKind(Core::Utils::PathChooser::File); + m_ui->execFileName->setExpectedKind(Utils::PathChooser::File); m_ui->execFileName->setPromptDialogTitle(tr("Select Executable")); - m_ui->coreFileName->setExpectedKind(Core::Utils::PathChooser::File); + m_ui->coreFileName->setExpectedKind(Utils::PathChooser::File); m_ui->coreFileName->setPromptDialogTitle(tr("Select Core File")); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); @@ -259,7 +259,7 @@ AttachExternalDialog::AttachExternalDialog(QWidget *parent) connect(m_ui->filterClearToolButton, SIGNAL(clicked()), m_ui->filterLineEdit, SLOT(clear())); connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)), - m_model, SLOT(setFilterFixedString(QString))); + this, SLOT(setFilterString(QString))); rebuildProcessList(); } @@ -269,6 +269,17 @@ AttachExternalDialog::~AttachExternalDialog() delete m_ui; } +void AttachExternalDialog::setFilterString(const QString &filter) +{ + m_model->setFilterFixedString(filter); + // Activate the line edit if there's a unique filtered process. + QString processId; + if (m_model->rowCount(QModelIndex()) == 1) + processId = m_model->processIdAt(m_model->index(0, 0, QModelIndex())); + m_ui->pidLineEdit->setText(processId); + pidChanged(processId); +} + QPushButton *AttachExternalDialog::okButton() const { return m_ui->buttonBox->button(QDialogButtonBox::Ok); @@ -284,9 +295,9 @@ void AttachExternalDialog::rebuildProcessList() void AttachExternalDialog::procSelected(const QModelIndex &proxyIndex) { - const QString proccessId = m_model->processIdAt(proxyIndex); - if (!proccessId.isEmpty()) { - m_ui->pidLineEdit->setText(proccessId); + const QString processId = m_model->processIdAt(proxyIndex); + if (!processId.isEmpty()) { + m_ui->pidLineEdit->setText(processId); if (okButton()->isEnabled()) okButton()->animateClick(); } @@ -316,7 +327,7 @@ AttachTcfDialog::AttachTcfDialog(QWidget *parent) { m_ui->setupUi(this); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); - m_ui->serverStartScript->setExpectedKind(Core::Utils::PathChooser::File); + m_ui->serverStartScript->setExpectedKind(Utils::PathChooser::File); m_ui->serverStartScript->setPromptDialogTitle(tr("Select Executable")); connect(m_ui->useServerStartScriptCheckBox, SIGNAL(toggled(bool)), @@ -403,7 +414,7 @@ StartExternalDialog::StartExternalDialog(QWidget *parent) : QDialog(parent), m_ui(new Ui::StartExternalDialog) { m_ui->setupUi(this); - m_ui->execFile->setExpectedKind(Core::Utils::PathChooser::File); + m_ui->execFile->setExpectedKind(Utils::PathChooser::File); m_ui->execFile->setPromptDialogTitle(tr("Select Executable")); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); @@ -462,7 +473,7 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent) { m_ui->setupUi(this); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); - m_ui->serverStartScript->setExpectedKind(Core::Utils::PathChooser::File); + m_ui->serverStartScript->setExpectedKind(Utils::PathChooser::File); m_ui->serverStartScript->setPromptDialogTitle(tr("Select Executable")); connect(m_ui->useServerStartScriptCheckBox, SIGNAL(toggled(bool)), diff --git a/src/plugins/debugger/debuggerdialogs.h b/src/plugins/debugger/debuggerdialogs.h index 2b63fa3e9e80f05bb83f35abcee218a78d9b6304..d20f7e7c249cfe23cdc5a3ce8cb8bceef69a98dd 100644 --- a/src/plugins/debugger/debuggerdialogs.h +++ b/src/plugins/debugger/debuggerdialogs.h @@ -95,6 +95,7 @@ private slots: void rebuildProcessList(); void procSelected(const QModelIndex &); void pidChanged(const QString &); + void setFilterString(const QString &filter); private: inline QPushButton *okButton() const; diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index 7250cdded28babd1951b5337eea97c775d533c42..a90d143f9dd88a198f0820412ee101a74e47df70 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -275,7 +275,7 @@ struct DebuggerManagerPrivate DebuggerStartParametersPtr m_startParameters; qint64 m_inferiorPid; /// Views - Core::Utils::FancyMainWindow *m_mainWindow; + Utils::FancyMainWindow *m_mainWindow; QLabel *m_statusLabel; QDockWidget *m_breakDock; QDockWidget *m_modulesDock; @@ -369,7 +369,7 @@ void DebuggerManager::init() d->m_watchersWindow = new WatchWindow(WatchWindow::WatchersType, this); d->m_statusTimer = new QTimer(this); - d->m_mainWindow = new Core::Utils::FancyMainWindow; + d->m_mainWindow = new Utils::FancyMainWindow; d->m_mainWindow->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); d->m_mainWindow->setDocumentMode(true); @@ -454,6 +454,7 @@ void DebuggerManager::init() //QTreeView *tooltipView = qobject_cast<QTreeView *>(d->m_tooltipWindow); //tooltipView->setModel(d->m_watchHandler->model(TooltipsWatch)); qRegisterMetaType<WatchData>("WatchData"); + qRegisterMetaType<StackCookie>("StackCookie"); d->m_actions.continueAction = new QAction(tr("Continue"), this); d->m_actions.continueAction->setIcon(QIcon(":/debugger/images/debugger_continue_small.png")); @@ -586,7 +587,7 @@ DebuggerManagerActions DebuggerManager::debuggerManagerActions() const return d->m_actions; } -Core::Utils::FancyMainWindow *DebuggerManager::mainWindow() const +Utils::FancyMainWindow *DebuggerManager::mainWindow() const { return d->m_mainWindow; } @@ -707,7 +708,6 @@ void DebuggerManager::showStatusMessage(const QString &msg, int timeout) void DebuggerManager::notifyInferiorStopped() { - resetLocation(); setState(InferiorStopped); showStatusMessage(tr("Stopped."), 5000); } @@ -1349,7 +1349,7 @@ void DebuggerManager::gotoLocation(const Debugger::Internal::StackFrame &frame, { if (theDebuggerBoolSetting(OperateByInstruction) || !frame.isUsable()) { if (setMarker) - resetLocation(); + emit resetLocationRequested(); d->m_disassemblerViewAgent.setFrame(frame); } else { // Connected to the plugin. @@ -1654,6 +1654,8 @@ void DebuggerManager::setState(DebuggerState state) || state == InferiorUnrunnable; const bool running = state == InferiorRunning; + if (running) + threadsHandler()->notifyRunning(); const bool stopped = state == InferiorStopped; if (stopped) diff --git a/src/plugins/debugger/debuggermanager.h b/src/plugins/debugger/debuggermanager.h index 0cd0ca2aeb0398bf5ea9a22a5154931981b07ba0..7579ebd722771b39b70f8f4c472802264a863d37 100644 --- a/src/plugins/debugger/debuggermanager.h +++ b/src/plugins/debugger/debuggermanager.h @@ -50,10 +50,10 @@ QT_END_NAMESPACE namespace Core { class IOptionsPage; +} namespace Utils { class FancyMainWindow; } -} // namespace Core namespace TextEditor { class ITextEditor; @@ -166,7 +166,7 @@ public: DebuggerState state() const; QList<Core::IOptionsPage*> initializeEngines(unsigned enabledTypeFlags); - Core::Utils::FancyMainWindow *mainWindow() const; + Utils::FancyMainWindow *mainWindow() const; QLabel *statusLabel() const; Internal::IDebuggerEngine *currentEngine() const; @@ -231,7 +231,7 @@ public slots: public slots: // FIXME void showDebuggerOutput(const QString &msg) { showDebuggerOutput(LogDebug, msg); } -private slots: +//private slots: // FIXME void showDebuggerOutput(int channel, const QString &msg); void showDebuggerInput(int channel, const QString &msg); void showApplicationOutput(const QString &data); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 38202e0899e897f0876c08dfc2bda16d29f1eb9f..3af293e3e6f1527aa5948f0d605e6ae3dcdc18f2 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -276,7 +276,7 @@ public: private: Ui::CommonOptionsPage m_ui; - Core::Utils::SavedActionSet m_group; + Utils::SavedActionSet m_group; }; QWidget *CommonOptionsPage::createPage(QWidget *parent) @@ -295,6 +295,7 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent) m_ui.checkBoxSkipKnownFrames); m_group.insert(theDebuggerAction(UseToolTipsInMainEditor), m_ui.checkBoxUseToolTipsInMainEditor); + m_group.insert(theDebuggerAction(AutoDerefPointers), 0); m_group.insert(theDebuggerAction(UseToolTipsInLocalsView), 0); m_group.insert(theDebuggerAction(UseToolTipsInBreakpointsView), 0); m_group.insert(theDebuggerAction(UseAddressInBreakpointsView), 0); @@ -347,7 +348,7 @@ private: friend class DebuggerPlugin; Ui::DebuggingHelperOptionPage m_ui; - Core::Utils::SavedActionSet m_group; + Utils::SavedActionSet m_group; }; QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent) @@ -355,7 +356,7 @@ QWidget *DebuggingHelperOptionPage::createPage(QWidget *parent) QWidget *w = new QWidget(parent); m_ui.setupUi(w); - m_ui.dumperLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command); + m_ui.dumperLocationChooser->setExpectedKind(Utils::PathChooser::Command); m_ui.dumperLocationChooser->setPromptDialogTitle(tr("Choose DebuggingHelper Location")); m_ui.dumperLocationChooser->setInitialBrowsePathBackup( Core::ICore::instance()->resourcePath() + "../../lib"); @@ -820,7 +821,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess m_debugMode->setWidget(splitter2); - Core::Utils::StyledBar *debugToolBar = new Core::Utils::StyledBar; + Utils::StyledBar *debugToolBar = new Utils::StyledBar; debugToolBar->setProperty("topBorder", true); QHBoxLayout *debugToolBarLayout = new QHBoxLayout(debugToolBar); debugToolBarLayout->setMargin(0); @@ -832,10 +833,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess debugToolBarLayout->addWidget(toolButton(am->command(Constants::STEPOUT)->action())); debugToolBarLayout->addWidget(toolButton(am->command(Constants::OPERATE_BY_INSTRUCTION)->action())); #ifdef USE_REVERSE_DEBUGGING - debugToolBarLayout->addWidget(new Core::Utils::StyledSeparator); + debugToolBarLayout->addWidget(new Utils::StyledSeparator); debugToolBarLayout->addWidget(toolButton(am->command(Constants::REVERSE)->action())); #endif - debugToolBarLayout->addWidget(new Core::Utils::StyledSeparator); + debugToolBarLayout->addWidget(new Utils::StyledSeparator); debugToolBarLayout->addWidget(new QLabel(tr("Threads:"))); QComboBox *threadBox = new QComboBox; diff --git a/src/plugins/debugger/dumperoptionpage.ui b/src/plugins/debugger/dumperoptionpage.ui index ddba465b5fa8a1c805d6cc9fe350737f6a70979a..1b6bb8ed5054b28fd3e58ada4c78c885a403c0d2 100644 --- a/src/plugins/debugger/dumperoptionpage.ui +++ b/src/plugins/debugger/dumperoptionpage.ui @@ -83,7 +83,7 @@ </widget> </item> <item> - <widget class="Core::Utils::PathChooser" name="dumperLocationChooser" native="true"/> + <widget class="Utils::PathChooser" name="dumperLocationChooser" native="true"/> </item> </layout> </item> @@ -117,7 +117,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/debugger/gdb/coregdbadapter.cpp b/src/plugins/debugger/gdb/coregdbadapter.cpp index 9c4585791cac3ff6c0dcefdcd8b9d4f2ba0ec7c9..5fa80055c5e98ad4787aa98ffde27fc217e558db 100644 --- a/src/plugins/debugger/gdb/coregdbadapter.cpp +++ b/src/plugins/debugger/gdb/coregdbadapter.cpp @@ -119,32 +119,62 @@ void CoreGdbAdapter::prepareInferior() void CoreGdbAdapter::startInferior() { QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); - QFileInfo fi2(startParameters().coreFile); - // quoting core name below fails in gdb 6.8-debian - m_executable.clear(); - QString coreName = fi2.absoluteFilePath(); - m_engine->postCommand(_("target core ") + coreName, CB(handleTargetCore)); + QFileInfo fi(startParameters().coreFile); + m_executable = startParameters().executable; + if (m_executable.isEmpty()) { + // Extra round trip to get executable name from core file. + // This is sometimes not the full name, so it can't be used + // as the generic solution. + // Quoting core name below fails in gdb 6.8-debian. + QString coreName = fi.absoluteFilePath(); + m_engine->postCommand(_("target core ") + coreName, CB(handleTargetCore1)); + } else { + // Directly load symbols. + QFileInfo fi(m_executable); + m_engine->postCommand(_("-file-exec-and-symbols \"%1\"") + .arg(fi.absoluteFilePath()), CB(handleFileExecAndSymbols)); + } } -void CoreGdbAdapter::handleTargetCore(const GdbResponse &response) +void CoreGdbAdapter::handleTargetCore1(const GdbResponse &response) { QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); if (response.resultClass == GdbResultDone) { - showStatusMessage(tr("Attached to core.")); - m_executable = startParameters().executable; - if (m_executable.isEmpty()) { - GdbMi console = response.data.findChild("consolestreamoutput"); - int pos1 = console.data().indexOf('`'); - int pos2 = console.data().indexOf('\''); - if (pos1 != -1 && pos2 != -1) - m_executable = console.data().mid(pos1 + 1, pos2 - pos1 - 1); + showStatusMessage(tr("Attached to core temporarily.")); + GdbMi console = response.data.findChild("consolestreamoutput"); + int pos1 = console.data().indexOf('`'); + int pos2 = console.data().indexOf('\''); + if (pos1 == -1 || pos2 == -1) { + setState(InferiorStartFailed); + emit inferiorStartFailed(tr("No binary found.")); + } else { + m_executable = console.data().mid(pos1 + 1, pos2 - pos1 - 1); + // Strip off command line arguments. FIXME: make robust. + if (m_executable.contains(' ')) + m_executable = m_executable.section(' ', 0, 0); + QTC_ASSERT(!m_executable.isEmpty(), /**/); + // Finish extra round. + m_engine->postCommand(_("detach"), CB(handleDetach1)); } + } else { + QTC_ASSERT(response.resultClass == GdbResultError, /**/); + const QByteArray msg = response.data.findChild("msg").data(); + setState(InferiorStartFailed); + emit inferiorStartFailed(msg); + } +} + +void CoreGdbAdapter::handleDetach1(const GdbResponse &response) +{ + QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); + if (response.resultClass == GdbResultDone) { + // Load symbols. QFileInfo fi(m_executable); m_engine->postCommand(_("-file-exec-and-symbols \"%1\"") .arg(fi.absoluteFilePath()), CB(handleFileExecAndSymbols)); } else { QTC_ASSERT(response.resultClass == GdbResultError, /**/); - const QByteArray &msg = response.data.findChild("msg").data(); + const QByteArray msg = response.data.findChild("msg").data(); setState(InferiorStartFailed); emit inferiorStartFailed(msg); } @@ -155,8 +185,10 @@ void CoreGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response) QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); if (response.resultClass == GdbResultDone) { showStatusMessage(tr("Symbols found.")); - setState(InferiorUnrunnable); - m_engine->updateAll(); + // Quoting core name below fails in gdb 6.8-debian. + QFileInfo fi(startParameters().coreFile); + QString coreName = fi.absoluteFilePath(); + m_engine->postCommand(_("target core ") + coreName, CB(handleTargetCore2)); } else if (response.resultClass == GdbResultError) { QString msg = tr("Symbols not found in \"%1\" failed:\n%2") .arg(__(response.data.findChild("msg").data())); @@ -167,6 +199,22 @@ void CoreGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response) } } +void CoreGdbAdapter::handleTargetCore2(const GdbResponse &response) +{ + QTC_ASSERT(state() == InferiorStarting, qDebug() << state()); + if (response.resultClass == GdbResultDone) { + showStatusMessage(tr("Attached to core.")); + setState(InferiorUnrunnable); + m_engine->updateAll(); + } else if (response.resultClass == GdbResultError) { + QString msg = tr("Attach to core \"%1\" failed:\n%2") + .arg(__(response.data.findChild("msg").data())); + setState(InferiorUnrunnable); + m_engine->updateAll(); + //setState(InferiorStartFailed); + // emit inferiorStartFailed(msg); + } +} void CoreGdbAdapter::interruptInferior() { // A core should never 'run' diff --git a/src/plugins/debugger/gdb/coregdbadapter.h b/src/plugins/debugger/gdb/coregdbadapter.h index 8cb74db99dfe2ce654c05ec11449be653ed5f279..273891d1337c77350d026d209e39cfd66e1c4a3e 100644 --- a/src/plugins/debugger/gdb/coregdbadapter.h +++ b/src/plugins/debugger/gdb/coregdbadapter.h @@ -67,8 +67,10 @@ private: void interruptInferior(); void shutdown(); + void handleTargetCore1(const GdbResponse &response); + void handleDetach1(const GdbResponse &response); void handleFileExecAndSymbols(const GdbResponse &response); - void handleTargetCore(const GdbResponse &response); + void handleTargetCore2(const GdbResponse &response); void handleExit(const GdbResponse &response); Q_SLOT void handleGdbStarted(); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 74c9b61ef68e5da783cd0aeb38cbd96c37f2d062..dfd9e954104cab9d559db95bcf51cdde0b1b86a4 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -203,6 +203,9 @@ GdbEngine::GdbEngine(DebuggerManager *manager) : connect(this, SIGNAL(applicationOutputAvailable(QString)), m_manager, SLOT(showApplicationOutput(QString)), Qt::QueuedConnection); + + connect(theDebuggerAction(AutoDerefPointers), SIGNAL(valueChanged(QVariant)), + this, SLOT(setAutoDerefPointers(QVariant))); } void GdbEngine::connectDebuggingHelperActions() @@ -793,24 +796,38 @@ void GdbEngine::handleResultRecord(const GdbResponse &response) return; if (!m_cookieForToken.contains(token)) { - // In theory this should not happen, in practice it does. + // In theory this should not happen (rather the error should be + // reported in the "first" response to the command) in practice it + // does. We try to handle a few situations we are aware of gracefully. + // Ideally, this code should not be present at all. debugMessage(_("COOKIE FOR TOKEN %1 ALREADY EATEN. " "TWO RESPONSES FOR ONE COMMAND?").arg(token)); if (response.resultClass == GdbResultError) { QByteArray msg = response.data.findChild("msg").data(); - showMessageBox(QMessageBox::Critical, - tr("Executable failed"), QString::fromLocal8Bit(msg)); - showStatusMessage(tr("Process failed to start.")); - // Handle a case known to occur on Linux/gdb 6.8 when debugging moc - // with helpers enabled. In this case we get a second response with - // msg="Cannot find new threads: generic error" - if (msg == "Cannot find new threads: generic error") + if (msg == "Cannot find new threads: generic error") { + // Handle a case known to occur on Linux/gdb 6.8 when debugging moc + // with helpers enabled. In this case we get a second response with + // msg="Cannot find new threads: generic error" + showMessageBox(QMessageBox::Critical, + tr("Executable failed"), QString::fromLocal8Bit(msg)); + showStatusMessage(tr("Process failed to start.")); shutdown(); - // Handle a case known to appear on gdb 6.4 symbianelf when - // the stack is cut due to access to protected memory. - if (msg == "\"finish\" not meaningful in the outermost frame.") { + } else if (msg == "\"finish\" not meaningful in the outermost frame.") { + // Handle a case known to appear on gdb 6.4 symbianelf when + // the stack is cut due to access to protected memory. + setState(InferiorStopping); + setState(InferiorStopped); + } else if (msg.startsWith("Cannot find bounds of current function")) { + // Happens when running "-exec-next" in a function for which + // there is no debug information. Divert to "-exec-next-step" setState(InferiorStopping); setState(InferiorStopped); + nextIExec(); + } else { + showMessageBox(QMessageBox::Critical, + tr("Executable failed"), QString::fromLocal8Bit(msg)); + showStatusMessage(tr("Executable failed: %1") + .arg(QString::fromLocal8Bit(msg))); } } return; @@ -880,18 +897,13 @@ void GdbEngine::updateAll() { QTC_ASSERT(state() == InferiorUnrunnable || state() == InferiorStopped, /**/); tryLoadDebuggingHelpers(); - updateLocals(); - postCommand(_("-stack-list-frames"), WatchUpdate, CB(handleStackListFrames1), false); + postCommand(_("-stack-list-frames"), WatchUpdate, CB(handleStackListFrames), + QVariant::fromValue<StackCookie>(StackCookie(false, true))); manager()->stackHandler()->setCurrentIndex(0); if (supportsThreads()) postCommand(_("-thread-list-ids"), WatchUpdate, CB(handleStackListThreads), 0); manager()->reloadRegisters(); -} - -void GdbEngine::handleStackListFrames1(const GdbResponse &response) -{ - handleStackListFrames(response); - manager()->gotoLocation(manager()->stackHandler()->currentFrame(), true); + updateLocals(); } void GdbEngine::handleQuerySources(const GdbResponse &response) @@ -1168,29 +1180,6 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) #endif } -void GdbEngine::reloadFullStack() -{ - QString cmd = _("-stack-list-frames"); - postCommand(cmd, WatchUpdate, CB(handleStackListFrames), true); -} - -void GdbEngine::reloadStack() -{ - QString cmd = _("-stack-list-frames"); - int stackDepth = theDebuggerAction(MaximalStackDepth)->value().toInt(); - if (stackDepth && !m_gdbAdapter->isTrkAdapter()) - cmd += _(" 0 ") + QString::number(stackDepth); - postCommand(cmd, WatchUpdate, CB(handleStackListFrames), false); - // FIXME: gdb 6.4 symbianelf likes to be asked twice. The first time it - // returns with "^error,msg="Previous frame identical to this frame - // (corrupt stack?)". Might be related to the fact that we can't - // access the memory belonging to the lower frames. But as we know - // this sometimes happens, ask the second time immediately instead - // of waiting for the first request to fail. - if (m_gdbAdapter->isTrkAdapter()) - postCommand(cmd, WatchUpdate, CB(handleStackListFrames), false); -} - void GdbEngine::handleStop1(const GdbResponse &response) { GdbMi data = response.cookie.value<GdbMi>(); @@ -1293,7 +1282,7 @@ void GdbEngine::handleStop2(const GdbMi &data) manager()->stackHandler()->setCurrentIndex(0); updateLocals(); // Quick shot - reloadStack(); + reloadStack(false); if (supportsThreads()) { int currentId = data.findChild("thread-id").data().toInt(); @@ -1367,8 +1356,8 @@ void GdbEngine::handleExecContinue(const GdbResponse &response) QTC_ASSERT(state() == InferiorRunning, /**/); } else if (response.resultClass == GdbResultError) { QTC_ASSERT(state() == InferiorRunningRequested, /**/); - const QByteArray &msg = response.data.findChild("msg").data(); - if (msg == "Cannot find bounds of current function") { + QByteArray msg = response.data.findChild("msg").data(); + if (msg.startsWith("Cannot find bounds of current function")) { setState(InferiorStopped); showStatusMessage(tr("Stopped."), 5000); //showStatusMessage(tr("No debug information available. " @@ -2221,13 +2210,52 @@ void GdbEngine::reloadSourceFiles() // ////////////////////////////////////////////////////////////////////// +void GdbEngine::selectThread(int index) +{ + ThreadsHandler *threadsHandler = manager()->threadsHandler(); + threadsHandler->setCurrentThread(index); + + QList<ThreadData> threads = threadsHandler->threads(); + QTC_ASSERT(index < threads.size(), return); + int id = threads.at(index).id; + showStatusMessage(tr("Retrieving data for stack view..."), 10000); + postCommand(_("-thread-select %1").arg(id), CB(handleStackSelectThread)); +} + void GdbEngine::handleStackSelectThread(const GdbResponse &) { + QTC_ASSERT(state() == InferiorUnrunnable || state() == InferiorStopped, /**/); //qDebug("FIXME: StackHandler::handleOutput: SelectThread"); showStatusMessage(tr("Retrieving data for stack view..."), 3000); - reloadStack(); + manager()->reloadRegisters(); + reloadStack(true); + updateLocals(); +} + +void GdbEngine::reloadFullStack() +{ + QString cmd = _("-stack-list-frames"); + postCommand(cmd, WatchUpdate, CB(handleStackListFrames), + QVariant::fromValue<StackCookie>(StackCookie(true, true))); } +void GdbEngine::reloadStack(bool forceGotoLocation) +{ + QString cmd = _("-stack-list-frames"); + int stackDepth = theDebuggerAction(MaximalStackDepth)->value().toInt(); + if (stackDepth && !m_gdbAdapter->isTrkAdapter()) + cmd += _(" 0 ") + QString::number(stackDepth); + // FIXME: gdb 6.4 symbianelf likes to be asked twice. The first time it + // returns with "^error,msg="Previous frame identical to this frame + // (corrupt stack?)". Might be related to the fact that we can't + // access the memory belonging to the lower frames. But as we know + // this sometimes happens, ask the second time immediately instead + // of waiting for the first request to fail. + if (m_gdbAdapter->isTrkAdapter()) + postCommand(cmd, WatchUpdate); + postCommand(cmd, WatchUpdate, CB(handleStackListFrames), + QVariant::fromValue<StackCookie>(StackCookie(false, forceGotoLocation))); +} StackFrame GdbEngine::parseStackFrame(const GdbMi &frameMi, int level) { @@ -2252,95 +2280,95 @@ void GdbEngine::handleStackListFrames(const GdbResponse &response) #else bool handleIt = response.resultClass == GdbResultDone; #endif - if (handleIt) { - bool isFull = response.cookie.toBool(); - QList<StackFrame> stackFrames; - - GdbMi stack = response.data.findChild("stack"); - if (!stack.isValid()) { - qDebug() << "FIXME: stack:" << stack.toString(); - return; - } + if (!handleIt) { + // That always happens on symbian gdb with + // ^error,data={msg="Previous frame identical to this frame (corrupt stack?)" + // logstreamoutput="Previous frame identical to this frame (corrupt stack?)\n" + //qDebug() << "LISTING STACK FAILED: " << response.toString(); + return; + } - int topFrame = -1; + StackCookie cookie = response.cookie.value<StackCookie>(); + QList<StackFrame> stackFrames; - int n = stack.childCount(); - for (int i = 0; i != n; ++i) { - stackFrames.append(parseStackFrame(stack.childAt(i), i)); - const StackFrame &frame = stackFrames.back(); + GdbMi stack = response.data.findChild("stack"); + if (!stack.isValid()) { + qDebug() << "FIXME: stack:" << stack.toString(); + return; + } - #if defined(Q_OS_WIN) - const bool isBogus = - // Assume this is wrong and points to some strange stl_algobase - // implementation. Happens on Karsten's XP system with Gdb 5.50 - (frame.file.endsWith(__("/bits/stl_algobase.h")) && frame.line == 150) - // Also wrong. Happens on Vista with Gdb 5.50 - || (frame.function == __("operator new") && frame.line == 151); + int targetFrame = -1; - // Immediately leave bogus frames. - if (topFrame == -1 && isBogus) { - postCommand(_("-exec-finish")); - return; - } - #endif + int n = stack.childCount(); + for (int i = 0; i != n; ++i) { + stackFrames.append(parseStackFrame(stack.childAt(i), i)); + const StackFrame &frame = stackFrames.back(); - // Initialize top frame to the first valid frame. - // FIXME: Check for QFile(frame.fullname).isReadable()? - const bool isValid = !frame.file.isEmpty() && !frame.function.isEmpty(); - if (isValid && topFrame == -1) - topFrame = i; + #if defined(Q_OS_WIN) + const bool isBogus = + // Assume this is wrong and points to some strange stl_algobase + // implementation. Happens on Karsten's XP system with Gdb 5.50 + (frame.file.endsWith(__("/bits/stl_algobase.h")) && frame.line == 150) + // Also wrong. Happens on Vista with Gdb 5.50 + || (frame.function == __("operator new") && frame.line == 151); + + // Immediately leave bogus frames. + if (targetFrame == -1 && isBogus) { + postCommand(_("-exec-finish")); + return; } - - bool canExpand = !isFull - && (n >= theDebuggerAction(MaximalStackDepth)->value().toInt()); - theDebuggerAction(ExpandStack)->setEnabled(canExpand); - manager()->stackHandler()->setFrames(stackFrames, canExpand); - - #ifdef Q_OS_MAC - // Mac gdb does not add the location to the "stopped" message, - // so the early gotoLocation() was not triggered. Force it here. - bool jump = topFrame != -1 - && !theDebuggerBoolSetting(OperateByInstruction); - #else - // For topFrame == -1 there is no frame at all, for topFrame == 0 - // we already issued a 'gotoLocation' when reading the *stopped - // message. Also, when OperateByInstruction we always want to - // use frame #0. - bool jump = topFrame != -1 && topFrame != 0 - && !theDebuggerBoolSetting(OperateByInstruction); #endif - - if (jump) { - const StackFrame &frame = manager()->stackHandler()->currentFrame(); - qDebug() << "GOTO, 2nd try" << frame.toString() << topFrame; - gotoLocation(frame, true); - } - } else { - // That always happens on symbian gdb with - // ^error,data={msg="Previous frame identical to this frame (corrupt stack?)" - // logstreamoutput="Previous frame identical to this frame (corrupt stack?)\n" - //qDebug() << "LISTING STACK FAILED: " << response.toString(); + + // Initialize top frame to the first valid frame. + // FIXME: Check for QFile(frame.fullname).isReadable()? + const bool isValid = !frame.file.isEmpty() && !frame.function.isEmpty(); + if (isValid && targetFrame == -1) + targetFrame = i; } -} -void GdbEngine::selectThread(int index) -{ - //reset location arrow - m_manager->resetLocation(); + bool canExpand = !cookie.isFull + && (n >= theDebuggerAction(MaximalStackDepth)->value().toInt()); + theDebuggerAction(ExpandStack)->setEnabled(canExpand); + manager()->stackHandler()->setFrames(stackFrames, canExpand); - ThreadsHandler *threadsHandler = manager()->threadsHandler(); - threadsHandler->setCurrentThread(index); + // We can't jump to any file if we don't have any frames. + if (stackFrames.isEmpty()) + return; - QList<ThreadData> threads = threadsHandler->threads(); - QTC_ASSERT(index < threads.size(), return); - int id = threads.at(index).id; - showStatusMessage(tr("Retrieving data for stack view..."), 10000); - postCommand(_("-thread-select %1").arg(id), CB(handleStackSelectThread)); + // targetFrame contains the top most frame for which we have source + // information. That's typically the frame we'd like to jump to, with + // a few exceptions: + + // Always jump to frame #0 when stepping by instruction. + if (theDebuggerBoolSetting(OperateByInstruction)) + targetFrame = 0; + + // If there is no frame with source, jump to frame #0. + if (targetFrame == -1) + targetFrame = 0; + + #ifdef Q_OS_MAC + // Mac gdb does not add the location to the "stopped" message, + // so the early gotoLocation() was not triggered. Force it here. + bool jump = true; + #else + // For targetFrame == 0 we already issued a 'gotoLocation' + // when reading the *stopped message. + bool jump = targetFrame != 0; + #endif + + manager()->stackHandler()->setCurrentIndex(targetFrame); + if (jump || cookie.gotoLocation) { + const StackFrame &frame = manager()->stackHandler()->currentFrame(); + //qDebug() << "GOTO, 2ND ATTEMPT: " << frame.toString() << targetFrame; + gotoLocation(frame, true); + } } void GdbEngine::activateFrame(int frameIndex) { - if (state() != InferiorStopped) + m_manager->resetLocation(); + if (state() != InferiorStopped && state() != InferiorUnrunnable) return; StackHandler *stackHandler = manager()->stackHandler(); @@ -2363,6 +2391,7 @@ void GdbEngine::activateFrame(int frameIndex) stackHandler->setCurrentIndex(frameIndex); updateLocals(); + reloadRegisters(); } gotoLocation(stackHandler->currentFrame(), true); @@ -2380,7 +2409,8 @@ void GdbEngine::handleStackListThreads(const GdbResponse &response) thread.id = items.at(index).data().toInt(); threads.append(thread); if (thread.id == id) { - //qDebug() << "SETTING INDEX TO:" << index << " ID:" << id << " RECOD:" << response.toString(); + //qDebug() << "SETTING INDEX TO:" << index << " ID:" + // << id << " RECOD:" << response.toString(); currentIndex = index; } } @@ -2676,6 +2706,13 @@ void GdbEngine::setUseDebuggingHelpers(const QVariant &on) updateLocals(); } +void GdbEngine::setAutoDerefPointers(const QVariant &on) +{ + Q_UNUSED(on) + setTokenBarrier(); + updateLocals(); +} + bool GdbEngine::hasDebuggingHelperForType(const QString &type) const { if (!theDebuggerBoolSetting(UseDebuggingHelpers)) @@ -2837,22 +2874,23 @@ void GdbEngine::updateSubItem(const WatchData &data0) #if DEBUG_SUBITEM qDebug() << "IT'S A POINTER"; #endif -#if 1 - data.setChildrenUnneeded(); - insertData(data); - WatchData data1; - data1.iname = data.iname + QLatin1String(".*"); - data1.name = QLatin1Char('*') + data.name; - data1.exp = QLatin1String("(*(") + data.exp + QLatin1String("))"); - data1.type = stripPointerType(data.type); - data1.setValueNeeded(); - insertData(data1); -#else - // Try automatic dereferentiation - data.exp = _("*(") + data.exp + _(")"); - data.type = data.type + _("."); // FIXME: fragile HACK to avoid recursion - insertData(data); -#endif + + if (theDebuggerBoolSetting(AutoDerefPointers)) { + // Try automatic dereferentiation + data.exp = _("(*(") + data.exp + _("))"); + data.type = data.type + _("."); // FIXME: fragile HACK to avoid recursion + insertData(data); + } else { + data.setChildrenUnneeded(); + insertData(data); + WatchData data1; + data1.iname = data.iname + QLatin1String(".*"); + data1.name = QLatin1Char('*') + data.name; + data1.exp = QLatin1String("(*(") + data.exp + QLatin1String("))"); + data1.type = stripPointerType(data.type); + data1.setValueNeeded(); + insertData(data1); + } return; } @@ -3072,7 +3110,7 @@ void GdbEngine::sendWatchParameters(const QByteArray ¶ms0) void GdbEngine::handleVarAssign(const GdbResponse &) { - // everything might have changed, force re-evaluation + // Everything might have changed, force re-evaluation. // FIXME: Speed this up by re-using variables and only // marking values as 'unknown' setTokenBarrier(); @@ -3407,7 +3445,8 @@ void GdbEngine::handleStackListArguments(const GdbResponse &response) const GdbMi args = frame.findChild("args"); m_currentFunctionArgs = args.children(); } else if (response.resultClass == GdbResultError) { - qDebug() << "FIXME: GdbEngine::handleStackListArguments: should not happen"; + qDebug() << "FIXME: GdbEngine::handleStackListArguments: should not happen" + << response.toString(); } } @@ -3825,7 +3864,8 @@ void GdbEngine::handleFetchMemory(const GdbResponse &response) GdbMi data = memory0.findChild("data"); foreach (const GdbMi &child, data.children()) { bool ok = true; - unsigned char c = child.data().toUInt(&ok, 0); + unsigned char c = '?'; + c = child.data().toUInt(&ok, 0); QTC_ASSERT(ok, return); ba.append(c); } @@ -3862,8 +3902,7 @@ void GdbEngine::fetchDisassemblerByAddress(DisassemblerViewAgent *agent, QTC_ASSERT(agent, return); bool ok = true; quint64 address = agent->address().toULongLong(&ok, 0); - //qDebug() << "ADDRESS: " << agent->address() << address; - QTC_ASSERT(ok, return); + QTC_ASSERT(ok, qDebug() << "ADDRESS: " << agent->address() << address; return); QString start = QString::number(address - 20, 16); QString end = QString::number(address + 100, 16); // -data-disassemble [ -s start-addr -e end-addr ] @@ -4055,7 +4094,11 @@ void GdbEngine::handleInferiorPrepared() //postCommand(_("set print pretty on")); //postCommand(_("set confirm off")); //postCommand(_("set pagination off")); - postCommand(_("set print inferior-events 1")); + + // The following does not work with 6.3.50-20050815 (Apple version gdb-1344) + // (Mac OS 10.6), but does so for gdb-966 (10.5): + //postCommand(_("set print inferior-events 1")); + postCommand(_("set breakpoint pending on")); postCommand(_("set print elements 10000")); postCommand(_("-data-list-register-names"), CB(handleRegisterListNames)); diff --git a/src/plugins/debugger/gdb/gdbengine.h b/src/plugins/debugger/gdb/gdbengine.h index 58352b4ab34e961be32ca81571ceb738689c6279..a3135449f524e886060fa56f02fd39a986a6a337 100644 --- a/src/plugins/debugger/gdb/gdbengine.h +++ b/src/plugins/debugger/gdb/gdbengine.h @@ -147,6 +147,8 @@ private: Q_SLOT void setDebugDebuggingHelpers(const QVariant &on); Q_SLOT void setUseDebuggingHelpers(const QVariant &on); + Q_SLOT void setAutoDerefPointers(const QVariant &on); + virtual bool isGdbEngine() const { return true; } // // Own stuff @@ -339,10 +341,9 @@ private: // Stack specific stuff // void handleStackListFrames(const GdbResponse &response); - void handleStackListFrames1(const GdbResponse &response); void handleStackSelectThread(const GdbResponse &response); void handleStackListThreads(const GdbResponse &response); - Q_SLOT void reloadStack(); + Q_SLOT void reloadStack(bool forceGotoLocation); Q_SLOT void reloadFullStack(); diff --git a/src/plugins/debugger/gdb/gdboptionspage.cpp b/src/plugins/debugger/gdb/gdboptionspage.cpp index b3a428109268b55bf82ae87a84954c3c1dbeeddc..226bfb7283a0ce1ab3c6c45b0e7a144e86da0ecc 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.cpp +++ b/src/plugins/debugger/gdb/gdboptionspage.cpp @@ -38,9 +38,9 @@ QWidget *GdbOptionsPage::createPage(QWidget *parent) { QWidget *w = new QWidget(parent); m_ui.setupUi(w); - m_ui.gdbLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command); + m_ui.gdbLocationChooser->setExpectedKind(Utils::PathChooser::Command); m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location")); - m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File); + m_ui.scriptFileChooser->setExpectedKind(Utils::PathChooser::File); m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File")); m_group.clear(); diff --git a/src/plugins/debugger/gdb/gdboptionspage.h b/src/plugins/debugger/gdb/gdboptionspage.h index bd70ed68ec6aa4203862ec0f438ad885190473fb..2a86e9501407b93faa0e0ff97743b3b10e781998 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.h +++ b/src/plugins/debugger/gdb/gdboptionspage.h @@ -28,7 +28,7 @@ public: private: Ui::GdbOptionsPage m_ui; - Core::Utils::SavedActionSet m_group; + Utils::SavedActionSet m_group; }; } // namespace Internal diff --git a/src/plugins/debugger/gdb/gdboptionspage.ui b/src/plugins/debugger/gdb/gdboptionspage.ui index 922ed4d4c3afc90ad7de368c4037ac7ce6f86d78..01900e9763248b411234360f70c5349d63c65628 100644 --- a/src/plugins/debugger/gdb/gdboptionspage.ui +++ b/src/plugins/debugger/gdb/gdboptionspage.ui @@ -57,10 +57,10 @@ </widget> </item> <item row="2" column="1"> - <widget class="Core::Utils::PathChooser" name="scriptFileChooser" native="true"/> + <widget class="Utils::PathChooser" name="scriptFileChooser" native="true"/> </item> <item row="0" column="1"> - <widget class="Core::Utils::PathChooser" name="gdbLocationChooser" native="true"/> + <widget class="Utils::PathChooser" name="gdbLocationChooser" native="true"/> </item> </layout> </widget> @@ -145,7 +145,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/debugger/gdb/plaingdbadapter.cpp b/src/plugins/debugger/gdb/plaingdbadapter.cpp index 5d5e051c83b3b3d8362486242760e2b19c30f65d..a65381920b6b1ed4735371aab4d039e79843e7ef 100644 --- a/src/plugins/debugger/gdb/plaingdbadapter.cpp +++ b/src/plugins/debugger/gdb/plaingdbadapter.cpp @@ -72,7 +72,7 @@ PlainGdbAdapter::PlainGdbAdapter(GdbEngine *engine, QObject *parent) connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(handleGdbFinished(int, QProcess::ExitStatus))); - m_stubProc.setMode(Core::Utils::ConsoleProcess::Debug); + m_stubProc.setMode(Utils::ConsoleProcess::Debug); #ifdef Q_OS_UNIX m_stubProc.setSettings(Core::ICore::instance()->settings()); #endif @@ -337,9 +337,9 @@ void PlainGdbAdapter::emitAdapterStartFailed(const QString &msg) { // QMessageBox::critical(mainWindow(), tr("Debugger Startup Failure"), // tr("Cannot start debugger: %1").arg(m_gdbAdapter->errorString())); - m_stubProc.blockSignals(true); + bool blocked = m_stubProc.blockSignals(true); m_stubProc.stop(); - m_stubProc.blockSignals(false); + m_stubProc.blockSignals(blocked); emit adapterStartFailed(msg); } diff --git a/src/plugins/debugger/gdb/plaingdbadapter.h b/src/plugins/debugger/gdb/plaingdbadapter.h index aade81183975574d79c704a320db88ec4b16f7f1..73a3c8760d704e9453654e869807a08a3f886986 100644 --- a/src/plugins/debugger/gdb/plaingdbadapter.h +++ b/src/plugins/debugger/gdb/plaingdbadapter.h @@ -84,7 +84,7 @@ private: Q_SLOT void stubError(const QString &msg); QProcess m_gdbProc; - Core::Utils::ConsoleProcess m_stubProc; + Utils::ConsoleProcess m_stubProc; }; } // namespace Internal diff --git a/src/plugins/debugger/gdb/trkgdbadapter.cpp b/src/plugins/debugger/gdb/trkgdbadapter.cpp index bba434b618448a4139a0648590fd35583397b3fd..85c6419c762bcc14058c8ec4e668cace33952eab 100644 --- a/src/plugins/debugger/gdb/trkgdbadapter.cpp +++ b/src/plugins/debugger/gdb/trkgdbadapter.cpp @@ -53,9 +53,19 @@ #define TrkCB(s) TrkCallback(this, &TrkGdbAdapter::s) +//#define DEBUG_MEMORY 1 +#if DEBUG_MEMORY +# define MEMORY_DEBUG(s) qDebug() << s +#else +# define MEMORY_DEBUG(s) +#endif +#define MEMORY_DEBUGX(s) qDebug() << s using namespace trk; +namespace Debugger { +namespace Internal { + enum { KnownRegisters = RegisterPSGdb + 1}; static const char *registerNames[KnownRegisters] = @@ -83,8 +93,99 @@ static QByteArray dumpRegister(int n, uint value) return ba; } -namespace Debugger { -namespace Internal { +QDebug operator<<(QDebug d, MemoryRange range) +{ + return d << QString("[%1,%2] (size %3) ") + .arg(range.from, 0, 16).arg(range.to, 0, 16).arg(range.size()); +} + +/////////////////////////////////////////////////////////////////////////// +// +// MemoryRange +// +/////////////////////////////////////////////////////////////////////////// + +bool MemoryRange::intersects(const MemoryRange &other) const +{ + Q_UNUSED(other); + return false; // FIXME +} + +void MemoryRange::operator-=(const MemoryRange &other) +{ + if (from == 0 && to == 0) + return; + MEMORY_DEBUG(" SUB: " << *this << " - " << other); + if (other.from <= from && to <= other.to) { + from = to = 0; + return; + } + if (other.from <= from && other.to <= to) { + from = qMax(from, other.to); + return; + } + if (from <= other.from && to <= other.to) { + to = qMin(other.from, to); + return; + } + // This would split the range. + QTC_ASSERT(false, qDebug() << "Memory::operator-() not handled for: " + << *this << " - " << other); +} + +/////////////////////////////////////////////////////////////////////////// +// +// Snapshot +// +/////////////////////////////////////////////////////////////////////////// + +void Snapshot::reset() +{ + memory.clear(); + for (int i = 0; i < RegisterCount; ++i) + registers[i] = 0; + wantedMemory = MemoryRange(); +} + +void Snapshot::insertMemory(const MemoryRange &range, const QByteArray &ba) +{ + QTC_ASSERT(range.size() == ba.size(), + qDebug() << "RANGE: " << range << " BA SIZE: " << ba.size(); return); + + MEMORY_DEBUG("INSERT: " << range); + // Try to combine with existing chunk. + Snapshot::Memory::iterator it = memory.begin(); + Snapshot::Memory::iterator et = memory.end(); + for ( ; it != et; ++it) { + if (range.from == it.key().to) { + MEMORY_DEBUG("COMBINING " << it.key() << " AND " << range); + QByteArray data = *it; + data.append(ba); + memory.remove(it.key()); + memory.insert(MemoryRange(it.key().from, range.to), data); + MEMORY_DEBUG(" TO " << MemoryRange(it.key().from, range.to)); + return; + } + if (it.key().from == range.to) { + MEMORY_DEBUG("COMBINING " << range << " AND " << it.key()); + QByteArray data = ba; + data.append(*it); + memory.remove(it.key()); + memory.insert(MemoryRange(range.from, it.key().to), data); + MEMORY_DEBUG(" TO " << MemoryRange(range.from, it.key().to)); + return; + } + } + + // Not combinable, add chunk. + memory.insert(range, ba); +} + +/////////////////////////////////////////////////////////////////////////// +// +// TrkGdbAdapter +// +/////////////////////////////////////////////////////////////////////////// TrkGdbAdapter::TrkGdbAdapter(GdbEngine *engine, const TrkOptionsPtr &options) : AbstractGdbAdapter(engine), @@ -143,7 +244,7 @@ TrkGdbAdapter::TrkGdbAdapter(GdbEngine *engine, const TrkOptionsPtr &options) : TrkGdbAdapter::~TrkGdbAdapter() { - delete m_gdbServer; + cleanup(); logMessage("Shutting down.\n"); } @@ -223,23 +324,42 @@ QByteArray TrkGdbAdapter::trkWriteRegisterMessage(byte reg, uint value) return ba; } -QByteArray TrkGdbAdapter::trkReadMemoryMessage(uint addr, uint len) +QByteArray TrkGdbAdapter::trkReadMemoryMessage(uint from, uint len) { QByteArray ba; ba.reserve(11); appendByte(&ba, 0x08); // Options, FIXME: why? appendShort(&ba, len); + appendInt(&ba, from); + appendInt(&ba, m_session.pid); + appendInt(&ba, m_session.tid); + return ba; +} + +QByteArray TrkGdbAdapter::trkReadMemoryMessage(const MemoryRange &range) +{ + return trkReadMemoryMessage(range.from, range.size()); +} + +QByteArray TrkGdbAdapter::trkWriteMemoryMessage(uint addr, const QByteArray &data) +{ + QByteArray ba; + ba.reserve(11 + data.size()); + appendByte(&ba, 0x08); // Options, FIXME: why? + appendShort(&ba, data.size()); appendInt(&ba, addr); appendInt(&ba, m_session.pid); appendInt(&ba, m_session.tid); + ba.append(data); return ba; } QByteArray TrkGdbAdapter::trkStepRangeMessage(byte option) { QByteArray ba; - ba.reserve(13); + ba.reserve(17); appendByte(&ba, option); + qDebug() << "STEP ON " << hexxNumber(m_snapshot.registers[RegisterPC]); appendInt(&ba, m_snapshot.registers[RegisterPC]); // Start address appendInt(&ba, m_snapshot.registers[RegisterPC]); // End address appendInt(&ba, m_session.pid); @@ -269,6 +389,17 @@ QByteArray TrkGdbAdapter::trkInterruptMessage() return ba; } +void TrkGdbAdapter::emitDelayedAdapterStartFailed(const QString &msg) +{ + m_adapterFailMessage = msg; + QTimer::singleShot(0, this, SLOT(slotEmitDelayedAdapterStartFailed())); +} + +void TrkGdbAdapter::slotEmitDelayedAdapterStartFailed() +{ + emit adapterStartFailed(m_adapterFailMessage); +} + void TrkGdbAdapter::startInferiorEarly() { QTC_ASSERT(state() == AdapterStarting, qDebug() << state()); @@ -280,7 +411,7 @@ void TrkGdbAdapter::startInferiorEarly() static int direction = 0; direction = (direction + 1) % 4; showStatusMessage(_("Please start TRK on your device! %1") - .arg(QChar("/|\\-"[direction]))); + .arg(QChar("/-\\|"[direction]))); } // Do not loop forever if (m_waitCount++ < (m_options->mode == TrkOptions::BlueTooth ? 60 : 5)) { @@ -608,7 +739,7 @@ void TrkGdbAdapter::handleGdbServerCommand(const QByteArray &cmd) break; } while (false); if (len) { - readMemory(addr, len); + readMemory(addr, len, m_bufferedMemoryRead); } else { sendGdbServerMessage("E20", "Error " + cmd); } @@ -1049,8 +1180,9 @@ void TrkGdbAdapter::handleCreateProcess(const TrkResult &result) logMessage("ERROR: " + result.errorString()); QString msg = _("Cannot start executable \"%1\" on the device:\n%2") .arg(m_remoteExecutable).arg(result.errorString()); - //m_trkDevice.close(); - emit adapterStartFailed(msg); + // Delay cleanup as not to close a trk device from its read handler, + // which blocks. + emitDelayedAdapterStartFailed(msg); return; } const char *data = result.data.data(); @@ -1158,27 +1290,14 @@ static QString msgMemoryReadError(int code, uint addr, uint len = 0) .arg(code).arg(addr, 0 ,16).arg(lenS); } -void TrkGdbAdapter::handleReadMemoryBuffered(const TrkResult &result) -{ - if (extractShort(result.data.data() + 1) + 3 != result.data.size()) - logMessage("\n BAD MEMORY RESULT: " + result.data.toHex() + "\n"); - const uint blockaddr = result.cookie.toUInt(); - if (const int errorCode = result.errorCode()) { - logMessage(msgMemoryReadError(errorCode, blockaddr)); - return; - } - const QByteArray ba = result.data.mid(3); - m_snapshot.memory.insert(blockaddr, ba); -} - // Format log message for memory access with some smartness about registers -QByteArray TrkGdbAdapter::memoryReadLogMessage(uint addr, uint len, const QByteArray &ba) const +QByteArray TrkGdbAdapter::memoryReadLogMessage(uint addr, const QByteArray &ba) const { QByteArray logMsg = "memory contents"; if (m_verbose > 1) { logMsg += " addr: " + hexxNumber(addr); // indicate dereferencing of registers - if (len == 4) { + if (ba.size() == 4) { if (addr == m_snapshot.registers[RegisterPC]) { logMsg += "[PC]"; } else if (addr == m_snapshot.registers[RegisterPSTrk]) { @@ -1195,27 +1314,112 @@ QByteArray TrkGdbAdapter::memoryReadLogMessage(uint addr, uint len, const QByteA } } logMsg += " length "; - logMsg += QByteArray::number(len); + logMsg += QByteArray::number(ba.size()); logMsg += " :"; logMsg += stringFromArray(ba, 16).toAscii(); } return logMsg; } -void TrkGdbAdapter::reportReadMemoryBuffered(const TrkResult &result) +void TrkGdbAdapter::handleReadMemoryBuffered(const TrkResult &result) { - const qulonglong cookie = result.cookie.toULongLong(); - const uint addr = cookie >> 32; - const uint len = uint(cookie); - reportReadMemoryBuffered(addr, len); + if (extractShort(result.data.data() + 1) + 3 != result.data.size()) + logMessage("\n BAD MEMORY RESULT: " + result.data.toHex() + "\n"); + const MemoryRange range = result.cookie.value<MemoryRange>(); + if (const int errorCode = result.errorCode()) { + logMessage(_("TEMPORARY: ") + msgMemoryReadError(errorCode, range.from)); + logMessage(_("RETRYING UNBUFFERED")); + // FIXME: This does not handle large requests properly. + sendTrkMessage(0x10, TrkCB(handleReadMemoryUnbuffered), + trkReadMemoryMessage(range), QVariant::fromValue(range)); + return; + } + const QByteArray ba = result.data.mid(3); + m_snapshot.insertMemory(range, ba); + tryAnswerGdbMemoryRequest(true); +} + +void TrkGdbAdapter::handleReadMemoryUnbuffered(const TrkResult &result) +{ + if (extractShort(result.data.data() + 1) + 3 != result.data.size()) + logMessage("\n BAD MEMORY RESULT: " + result.data.toHex() + "\n"); + const MemoryRange range = result.cookie.value<MemoryRange>(); + if (const int errorCode = result.errorCode()) { + logMessage(_("TEMPORARY: ") + msgMemoryReadError(errorCode, range.from)); + logMessage(_("RETRYING UNBUFFERED")); + const QByteArray ba = "E20"; + sendGdbServerMessage(ba, msgMemoryReadError(32, range.from).toLatin1()); + return; + } + const QByteArray ba = result.data.mid(3); + m_snapshot.insertMemory(range, ba); + tryAnswerGdbMemoryRequest(false); +} + +void TrkGdbAdapter::tryAnswerGdbMemoryRequest(bool buffered) +{ + //logMessage("UNBUFFERED MEMORY READ: " + stringFromArray(result.data)); + + MemoryRange wanted = m_snapshot.wantedMemory; + MemoryRange needed = m_snapshot.wantedMemory; + MEMORY_DEBUG("WANTED: " << wanted); + Snapshot::Memory::const_iterator it = m_snapshot.memory.begin(); + Snapshot::Memory::const_iterator et = m_snapshot.memory.end(); + for ( ; it != et; ++it) { + MEMORY_DEBUG(" NEEDED: " << needed); + needed -= it.key(); + } + MEMORY_DEBUG("NEEDED: " << needed); + + if (needed.to == 0) { + // FIXME: need to combine chunks first. + + // All fine. Send package to gdb. + it = m_snapshot.memory.begin(); + et = m_snapshot.memory.end(); + for ( ; it != et; ++it) { + if (it.key().from <= wanted.from && wanted.to <= it.key().to) { + int offset = wanted.from - it.key().from; + int len = wanted.to - wanted.from; + QByteArray ba = it.value().mid(offset, len); + sendGdbServerMessage(ba.toHex(), memoryReadLogMessage(wanted.from, ba)); + return; + } + } + // Happens when chunks are not comnbined + QTC_ASSERT(false, /**/); + return; + } + + MEMORY_DEBUG("NEEDED AND UNSATISFIED: " << needed); + if (buffered) { + uint blockaddr = (needed.from / MemoryChunkSize) * MemoryChunkSize; + logMessage(_("Requesting buffered memory %1 bytes from 0x%2") + .arg(MemoryChunkSize).arg(blockaddr, 0, 16)); + MemoryRange range(blockaddr, blockaddr + MemoryChunkSize); + MEMORY_DEBUGX(" FETCH MEMORY : " << range); + sendTrkMessage(0x10, TrkCB(handleReadMemoryBuffered), + trkReadMemoryMessage(range), + QVariant::fromValue(range)); + } else { // Unbuffered, direct requests + int len = needed.to - needed.from; + logMessage(_("Requesting unbuffered memory %1 bytes from 0x%2") + .arg(len).arg(needed.from, 0, 16)); + sendTrkMessage(0x10, TrkCB(handleReadMemoryUnbuffered), + trkReadMemoryMessage(needed), + QVariant::fromValue(needed)); + MEMORY_DEBUGX(" FETCH MEMORY : " << needed); + } } -void TrkGdbAdapter::reportReadMemoryBuffered(uint addr, uint len) +/* +void TrkGdbAdapter::reportReadMemoryBuffered(const TrkResult &result) { + const MemoryRange range = result.cookie.value<MemoryRange>(); // Gdb accepts less memory according to documentation. // Send E on complete failure. QByteArray ba; - uint blockaddr = (addr / MemoryChunkSize) * MemoryChunkSize; + uint blockaddr = (range.from / MemoryChunkSize) * MemoryChunkSize; for (; blockaddr < addr + len; blockaddr += MemoryChunkSize) { const Snapshot::Memory::const_iterator it = m_snapshot.memory.constFind(blockaddr); if (it == m_snapshot.memory.constEnd()) @@ -1235,21 +1439,7 @@ void TrkGdbAdapter::reportReadMemoryBuffered(uint addr, uint len) sendGdbServerMessage(ba.toHex(), memoryReadLogMessage(addr, len, ba)); } } - -void TrkGdbAdapter::handleReadMemoryUnbuffered(const TrkResult &result) -{ - //logMessage("UNBUFFERED MEMORY READ: " + stringFromArray(result.data)); - const uint blockaddr = result.cookie.toUInt(); - if (extractShort(result.data.data() + 1) + 3 != result.data.size()) - logMessage("\n BAD MEMORY RESULT: " + result.data.toHex() + "\n"); - if (const int errorCode = result.errorCode()) { - const QByteArray ba = "E20"; - sendGdbServerMessage(ba, msgMemoryReadError(32, blockaddr).toLatin1()); - } else { - const QByteArray ba = result.data.mid(3); - sendGdbServerMessage(ba.toHex(), memoryReadLogMessage(blockaddr, ba.size(), ba)); - } -} +*/ void TrkGdbAdapter::handleStepInto(const TrkResult &result) { @@ -1372,7 +1562,7 @@ void TrkGdbAdapter::handleDisconnect(const TrkResult & /*result*/) logMessage(QLatin1String("Trk disconnected")); } -void TrkGdbAdapter::readMemory(uint addr, uint len) +void TrkGdbAdapter::readMemory(uint addr, uint len, bool buffered) { Q_ASSERT(len < (2 << 16)); @@ -1381,43 +1571,15 @@ void TrkGdbAdapter::readMemory(uint addr, uint len) logMessage(_("readMemory %1 bytes from 0x%2 blocksize=%3") .arg(len).arg(addr, 0, 16).arg(MemoryChunkSize)); - if (m_bufferedMemoryRead) { - uint requests = 0; - uint blockaddr = (addr / MemoryChunkSize) * MemoryChunkSize; - for (; blockaddr < addr + len; blockaddr += MemoryChunkSize) { - if (!m_snapshot.memory.contains(blockaddr)) { - if (m_verbose) - logMessage(_("Requesting buffered " - "memory %1 bytes from 0x%2") - .arg(MemoryChunkSize).arg(blockaddr, 0, 16)); - sendTrkMessage(0x10, TrkCB(handleReadMemoryBuffered), - trkReadMemoryMessage(blockaddr, MemoryChunkSize), - QVariant(blockaddr)); - requests++; - } - } - // If requests have been sent: Sync - if (requests) { - const qulonglong cookie = (qulonglong(addr) << 32) + len; - sendTrkMessage(TRK_WRITE_QUEUE_NOOP_CODE, TrkCB(reportReadMemoryBuffered), - QByteArray(), cookie); - } else { - // Everything is already buffered: invoke callback directly - reportReadMemoryBuffered(addr, len); - } - } else { // Unbuffered, direct requests - if (m_verbose) - logMessage(_("Requesting unbuffered memory %1 " - "bytes from 0x%2").arg(len).arg(addr, 0, 16)); - sendTrkMessage(0x10, TrkCB(handleReadMemoryUnbuffered), - trkReadMemoryMessage(addr, len), QVariant(addr)); - } + m_snapshot.wantedMemory = MemoryRange(addr, addr + len); + tryAnswerGdbMemoryRequest(buffered); + } void TrkGdbAdapter::interruptInferior() { QTC_ASSERT(state() == AdapterStarted, qDebug() << state()); - qDebug() << "TRYING TO INTERRUPT INFERIOR"; + logMessage("TRYING TO INTERRUPT INFERIOR"); sendTrkMessage(0x1a, TrkCallback(), trkInterruptMessage(), "Interrupting..."); } @@ -1456,7 +1618,7 @@ void TrkGdbAdapter::startAdapter() m_remoteExecutable = parameters.executable; m_symbolFile = parameters.symbolFileName; // FIXME: testing hack, remove! - if (parameters.processArgs.at(0) == _("@sym@")) { + if (parameters.processArgs.size() == 3 && parameters.processArgs.at(0) == _("@sym@")) { m_remoteExecutable = parameters.processArgs.at(1); m_symbolFile = parameters.processArgs.at(2); } @@ -1579,7 +1741,9 @@ void TrkGdbAdapter::startGdb() QString msg = QString("Unable to start the gdb server at %1: %2.") .arg(m_gdbServerName).arg(m_gdbServer->errorString()); logMessage(msg); - emit adapterStartFailed(msg); + // Delay cleanup as not to close a trk device from its read handler, + // which blocks. + emitDelayedAdapterStartFailed(msg); return; } @@ -1669,13 +1833,6 @@ void TrkGdbAdapter::write(const QByteArray &data) { // Write magic packets directly to TRK. if (data.startsWith("@#")) { - QByteArray ba = QByteArray::fromHex(data.mid(2)); - qDebug() << "Writing: " << quoteUnprintableLatin1(ba); - if (ba.size() >= 1) - sendTrkMessage(ba.at(0), TrkCB(handleDirectTrk), ba.mid(1)); - return; - } - if (data.startsWith("@@")) { QByteArray data1 = data.mid(2); if (data1.endsWith(char(10))) data1.chop(1); @@ -1689,16 +1846,173 @@ void TrkGdbAdapter::write(const QByteArray &data) directStep(addr); return; } + if (data.startsWith("@$")) { + QByteArray ba = QByteArray::fromHex(data.mid(2)); + qDebug() << "Writing: " << quoteUnprintableLatin1(ba); + if (ba.size() >= 1) + sendTrkMessage(ba.at(0), TrkCB(handleDirectTrk), ba.mid(1)); + return; + } + if (data.startsWith("@@")) { + // Read data + sendTrkMessage(0x10, TrkCB(handleDirectWrite1), + trkReadMemoryMessage(m_session.dataseg, 12)); + return; + } m_gdbProc.write(data, data.size()); } +uint oldPC; +QByteArray oldMem; +uint scratch; + +void TrkGdbAdapter::handleDirectWrite1(const TrkResult &response) +{ + scratch = m_session.dataseg + 512; + logMessage("DIRECT WRITE1: " + response.toString()); + if (const int errorCode = response.errorCode()) { + logMessage("ERROR: " + response.errorString() + "in handleDirectWrite1"); + } else { + oldMem = response.data.mid(3); + oldPC = m_snapshot.registers[RegisterPC]; + logMessage("READ MEM: " + oldMem.toHex()); + //qDebug("READ MEM: " + oldMem.toHex()); + QByteArray ba; + appendByte(&ba, 0xaa); + appendByte(&ba, 0xaa); + appendByte(&ba, 0xaa); + appendByte(&ba, 0xaa); + +#if 0 + // Arm: + // 0: e51f4004 ldr r4, [pc, #-4] ; 4 <.text+0x4> + appendByte(&ba, 0x04); + appendByte(&ba, 0x50); // R5 + appendByte(&ba, 0x1f); + appendByte(&ba, 0xe5); +#else + // Thumb: + // subs r0, #16 + appendByte(&ba, 0x08); + appendByte(&ba, 0x3b); + // subs r0, #16 + appendByte(&ba, 0x08); + appendByte(&ba, 0x3b); + // + appendByte(&ba, 0x08); + appendByte(&ba, 0x3b); + // subs r0, #16 + appendByte(&ba, 0x08); + appendByte(&ba, 0x3b); +#endif + + // Write data + sendTrkMessage(0x11, TrkCB(handleDirectWrite2), + trkWriteMemoryMessage(scratch, ba)); + } +} + +void TrkGdbAdapter::handleDirectWrite2(const TrkResult &response) +{ + logMessage("DIRECT WRITE2: " + response.toString()); + if (const int errorCode = response.errorCode()) { + logMessage("ERROR: " + response.errorString() + "in handleDirectWrite1"); + } else { + // Check + sendTrkMessage(0x10, TrkCB(handleDirectWrite3), + trkReadMemoryMessage(scratch, 12)); + } +} + +void TrkGdbAdapter::handleDirectWrite3(const TrkResult &response) +{ + logMessage("DIRECT WRITE3: " + response.toString()); + if (const int errorCode = response.errorCode()) { + logMessage("ERROR: " + response.errorString() + "in handleDirectWrite1"); + } else { + // Set PC + sendTrkMessage(0x13, TrkCB(handleDirectWrite4), + trkWriteRegisterMessage(RegisterPC, scratch + 4)); + } +} + +void TrkGdbAdapter::handleDirectWrite4(const TrkResult &response) +{ + m_snapshot.registers[RegisterPC] = scratch + 4; +return; + logMessage("DIRECT WRITE4: " + response.toString()); + if (const int errorCode = response.errorCode()) { + logMessage("ERROR: " + response.errorString() + "in handleDirectWrite1"); + } else { + QByteArray ba1; + appendByte(&ba1, 0x11); // options "step over" + appendInt(&ba1, scratch + 4); + appendInt(&ba1, scratch + 4); + appendInt(&ba1, m_session.pid); + appendInt(&ba1, m_session.tid); + sendTrkMessage(0x19, TrkCB(handleDirectWrite5), ba1); + } +} + +void TrkGdbAdapter::handleDirectWrite5(const TrkResult &response) +{ + logMessage("DIRECT WRITE5: " + response.toString()); + if (const int errorCode = response.errorCode()) { + logMessage("ERROR: " + response.errorString() + "in handleDirectWrite1"); + } else { + // Restore PC + sendTrkMessage(0x13, TrkCB(handleDirectWrite6), + trkWriteRegisterMessage(RegisterPC, oldPC)); + } +} + +void TrkGdbAdapter::handleDirectWrite6(const TrkResult &response) +{ + logMessage("DIRECT WRITE6: " + response.toString()); + if (const int errorCode = response.errorCode()) { + logMessage("ERROR: " + response.errorString() + "in handleDirectWrite1"); + } else { + // Restore memory + sendTrkMessage(0x11, TrkCB(handleDirectWrite7), + trkWriteMemoryMessage(scratch, oldMem)); + } +} + +void TrkGdbAdapter::handleDirectWrite7(const TrkResult &response) +{ + logMessage("DIRECT WRITE7: " + response.toString()); + if (const int errorCode = response.errorCode()) { + logMessage("ERROR: " + response.errorString() + "in handleDirectWrite1"); + } else { + // Check + sendTrkMessage(0x10, TrkCB(handleDirectWrite8), + trkReadMemoryMessage(scratch, 8)); + } +} + +void TrkGdbAdapter::handleDirectWrite8(const TrkResult &response) +{ + logMessage("DIRECT WRITE8: " + response.toString()); + if (const int errorCode = response.errorCode()) { + logMessage("ERROR: " + response.errorString() + "in handleDirectWrite1"); + } else { + // Re-read registers + sendTrkMessage(0x12, + TrkCB(handleAndReportReadRegistersAfterStop), + trkReadRegistersMessage()); + } +} + +void TrkGdbAdapter::handleDirectWrite9(const TrkResult &response) +{ + logMessage("DIRECT WRITE9: " + response.toString()); +} + void TrkGdbAdapter::handleDirectTrk(const TrkResult &result) { logMessage("HANDLE DIRECT TRK: " + stringFromArray(result.data)); } -uint oldPC; - void TrkGdbAdapter::directStep(uint addr) { // Write PC: @@ -1744,11 +2058,19 @@ void TrkGdbAdapter::setEnvironment(const QStringList &env) m_gdbProc.setEnvironment(env); } +void TrkGdbAdapter::cleanup() +{ + if (m_trkDevice.isOpen()) + m_trkDevice.close(); + if (m_gdbServer) + delete m_gdbServer; +} + void TrkGdbAdapter::shutdown() { switch (state()) { - case AdapterStarting: + cleanup(); setState(DebuggerNotReady); return; @@ -1767,10 +2089,7 @@ void TrkGdbAdapter::shutdown() case InferiorShutDown: setState(AdapterShuttingDown); - //sendTrkMessage(0x02, TrkCB(handleDisconnect)); - m_trkDevice.close(); - delete m_gdbServer; - m_gdbServer = 0; + cleanup(); m_engine->postCommand(_("-gdb-exit"), CB(handleExit)); return; diff --git a/src/plugins/debugger/gdb/trkgdbadapter.h b/src/plugins/debugger/gdb/trkgdbadapter.h index 5d7f88584350ee87eecb466436783b57bee3da0c..b2fe1aee0ca615ff8c3236dfd8ac1441671a4f6c 100644 --- a/src/plugins/debugger/gdb/trkgdbadapter.h +++ b/src/plugins/debugger/gdb/trkgdbadapter.h @@ -49,6 +49,67 @@ namespace Debugger { namespace Internal { +enum CodeMode +{ + ArmMode = 0, + ThumbMode, +}; + +enum TargetConstants +{ + + RegisterCount = 17, + RegisterSP = 13, // Stack Pointer + RegisterLR = 14, // Return address + RegisterPC = 15, // Program counter + RegisterPSGdb = 25, // gdb's view of the world + RegisterPSTrk = 16, // TRK's view of the world + + MemoryChunkSize = 256 +}; + +struct MemoryRange +{ + MemoryRange() : from(0), to(0) {} + MemoryRange(uint f, uint t) : from(f), to(t) {} + void operator-=(const MemoryRange &other); + bool intersects(const MemoryRange &other) const; + quint64 hash() const { return (quint64(from) << 32) + to; } + bool operator==(const MemoryRange &other) const { return hash() == other.hash(); } + bool operator<(const MemoryRange &other) const { return hash() < other.hash(); } + int size() const { return to - from; } + + uint from; // Inclusive. + uint to; // Exclusive. +}; + +struct Snapshot +{ + void reset(); + void insertMemory(const MemoryRange &range, const QByteArray &ba); + + uint registers[RegisterCount]; + typedef QMap<MemoryRange, QByteArray> Memory; + Memory memory; + + // Current state. + MemoryRange wantedMemory; +}; + + +struct Breakpoint +{ + Breakpoint(uint offset_ = 0) + { + number = 0; + offset = offset_; + mode = ArmMode; + } + uint offset; + ushort number; + CodeMode mode; +}; + struct GdbResult { QByteArray data; @@ -90,8 +151,6 @@ signals: void output(const QString &msg); private: - friend class RunnerGui; - const TrkOptionsPtr m_options; QString m_overrideTrkDevice; @@ -115,11 +174,15 @@ public: bool isTrkAdapter() const { return true; } bool dumpersAvailable() const { return false; } +private: void startAdapter(); void prepareInferior(); void startInferior(); void interruptInferior(); void shutdown(); + void cleanup(); + void emitDelayedAdapterStartFailed(const QString &msg); + Q_SLOT void slotEmitDelayedAdapterStartFailed(); Q_SLOT void startInferiorEarly(); void handleKill(const GdbResponse &response); @@ -150,25 +213,10 @@ public: void handleDisconnect(const TrkResult &result); void handleDeleteProcess(const TrkResult &result); void handleDeleteProcess2(const TrkResult &result); - void handleDirectTrk(const TrkResult &response); - - void directStep(uint addr); - void handleDirectStep1(const TrkResult &response); - void handleDirectStep2(const TrkResult &response); - void handleDirectStep3(const TrkResult &response); - void handleAndReportCreateProcess(const TrkResult &result); void handleAndReportReadRegistersAfterStop(const TrkResult &result); void reportRegisters(); - QByteArray memoryReadLogMessage(uint addr, uint len, const QByteArray &ba) const; - QByteArray trkContinueMessage(); - QByteArray trkReadRegistersMessage(); - QByteArray trkWriteRegisterMessage(byte reg, uint value); - QByteArray trkReadMemoryMessage(uint addr, uint len); - QByteArray trkBreakpointMessage(uint addr, uint len, bool armMode = true); - QByteArray trkStepRangeMessage(byte option); - QByteArray trkDeleteProcessMessage(); - QByteArray trkInterruptMessage(); + QByteArray memoryReadLogMessage(uint addr, const QByteArray &ba) const; void handleAndReportSetBreakpoint(const TrkResult &result); void handleReadMemoryBuffered(const TrkResult &result); void handleReadMemoryUnbuffered(const TrkResult &result); @@ -177,14 +225,42 @@ public: void handleStepOver(const TrkResult &result); void handleStepOver2(const TrkResult &result); void handleReadRegisters(const TrkResult &result); - void reportReadMemoryBuffered(const TrkResult &result); - void reportReadMemoryBuffered(uint addr, uint len); void handleWriteRegister(const TrkResult &result); void reportToGdb(const TrkResult &result); + //void reportReadMemoryBuffered(const TrkResult &result); + //void reportReadMemoryUnbuffered(const TrkResult &result); + + void readMemory(uint addr, uint len, bool buffered); + + void handleDirectTrk(const TrkResult &response); + void directStep(uint addr); + void handleDirectStep1(const TrkResult &response); + void handleDirectStep2(const TrkResult &response); + void handleDirectStep3(const TrkResult &response); - void readMemory(uint addr, uint len); + void handleDirectWrite1(const TrkResult &response); + void handleDirectWrite2(const TrkResult &response); + void handleDirectWrite3(const TrkResult &response); + void handleDirectWrite4(const TrkResult &response); + void handleDirectWrite5(const TrkResult &response); + void handleDirectWrite6(const TrkResult &response); + void handleDirectWrite7(const TrkResult &response); + void handleDirectWrite8(const TrkResult &response); + void handleDirectWrite9(const TrkResult &response); + + QByteArray trkContinueMessage(); + QByteArray trkReadRegistersMessage(); + QByteArray trkWriteRegisterMessage(byte reg, uint value); + QByteArray trkReadMemoryMessage(const MemoryRange &range); + QByteArray trkReadMemoryMessage(uint addr, uint len); + QByteArray trkWriteMemoryMessage(uint addr, const QByteArray &date); + QByteArray trkBreakpointMessage(uint addr, uint len, bool armMode = true); + QByteArray trkStepRangeMessage(byte option); + QByteArray trkDeleteProcessMessage(); + QByteArray trkInterruptMessage(); trk::TrkDevice m_trkDevice; + QString m_adapterFailMessage; // // Gdb @@ -214,6 +290,7 @@ public: const QByteArray &logNote = QByteArray()); void sendGdbServerAck(); bool sendGdbServerPacket(const QByteArray &packet, bool doFlush); + void tryAnswerGdbMemoryRequest(bool buffered); Q_SLOT void handleGdbError(QProcess::ProcessError error); Q_SLOT void handleGdbFinished(int exitCode, QProcess::ExitStatus exitStatus); @@ -245,7 +322,7 @@ public: // Debuggee state Q_SLOT void executeCommand(const QString &msg); trk::Session m_session; // global-ish data (process id, target information) - trk::Snapshot m_snapshot; // local-ish data (memory and registers) + Snapshot m_snapshot; // local-ish data (memory and registers) QString m_remoteExecutable; QString m_symbolFile; int m_verbose; @@ -256,4 +333,6 @@ public: } // namespace Internal } // namespace Debugger +Q_DECLARE_METATYPE(Debugger::Internal::MemoryRange); + #endif // DEBUGGER_TRKGDBADAPTER_H diff --git a/src/plugins/debugger/gdb/trkoptions.h b/src/plugins/debugger/gdb/trkoptions.h index cacf1a93cbea8d051d9b4966d8eda102450bbece..9e50796ea7cf941c17730da0dc4a5831b86a7fe2 100644 --- a/src/plugins/debugger/gdb/trkoptions.h +++ b/src/plugins/debugger/gdb/trkoptions.h @@ -65,8 +65,15 @@ struct TrkOptions QString cygwin; // ignored on Linux }; -inline bool operator==(const TrkOptions &o1, const TrkOptions &o2) { return o1.equals(o2); } -inline bool operator!=(const TrkOptions &o1, const TrkOptions &o2) { return !o1.equals(o2); } +inline bool operator==(const TrkOptions &o1, const TrkOptions &o2) +{ + return o1.equals(o2); +} + +inline bool operator!=(const TrkOptions &o1, const TrkOptions &o2) +{ + return !o1.equals(o2); +} } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/gdb/trkoptionswidget.cpp b/src/plugins/debugger/gdb/trkoptionswidget.cpp index 34b5afb4f3c0b00ad2eefef59b896333125477c1..b77a030c1a50a63b9145dad39e9a3bdf611b390a 100644 --- a/src/plugins/debugger/gdb/trkoptionswidget.cpp +++ b/src/plugins/debugger/gdb/trkoptionswidget.cpp @@ -40,8 +40,8 @@ TrkOptionsWidget::TrkOptionsWidget(QWidget *parent) : ui(new Ui::TrkOptionsWidget) { ui->setupUi(this); - ui->gdbChooser->setExpectedKind(Core::Utils::PathChooser::Command); - ui->cygwinChooser->setExpectedKind(Core::Utils::PathChooser::Directory); + ui->gdbChooser->setExpectedKind(Utils::PathChooser::Command); + ui->cygwinChooser->setExpectedKind(Utils::PathChooser::Directory); ui->blueToothComboBox->addItems(TrkOptions::blueToothDevices()); ui->serialComboBox->addItems(TrkOptions::serialPorts()); connect(ui->commComboBox, SIGNAL(currentIndexChanged(int)), ui->commStackedWidget, SLOT(setCurrentIndex(int))); diff --git a/src/plugins/debugger/gdb/trkoptionswidget.ui b/src/plugins/debugger/gdb/trkoptionswidget.ui index a1c699438d17e271576331ad489bb2d8c8b96d0e..f8786a979d94c2f591e6689c3007fadbc3173516 100644 --- a/src/plugins/debugger/gdb/trkoptionswidget.ui +++ b/src/plugins/debugger/gdb/trkoptionswidget.ui @@ -28,7 +28,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="Core::Utils::PathChooser" name="gdbChooser" native="true"/> + <widget class="Utils::PathChooser" name="gdbChooser" native="true"/> </item> <item row="1" column="0"> <widget class="QLabel" name="cygwinLabel"> @@ -38,7 +38,7 @@ </widget> </item> <item row="1" column="1"> - <widget class="Core::Utils::PathChooser" name="cygwinChooser" native="true"/> + <widget class="Utils::PathChooser" name="cygwinChooser" native="true"/> </item> </layout> </widget> @@ -138,7 +138,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/debugger/idebuggerengine.h b/src/plugins/debugger/idebuggerengine.h index db990fa9389b98feb7a311b3eaf3a948104c12b6..c4d7202152d947459ec3acea8fb24723359fb407 100644 --- a/src/plugins/debugger/idebuggerengine.h +++ b/src/plugins/debugger/idebuggerengine.h @@ -116,6 +116,7 @@ public: { Q_UNUSED(regnr); Q_UNUSED(value); } virtual void addOptionPages(QList<Core::IOptionsPage*> *) const {} + virtual bool isGdbEngine() const { return false; } protected: void showStatusMessage(const QString &msg, int timeout = -1); diff --git a/src/plugins/debugger/registerwindow.cpp b/src/plugins/debugger/registerwindow.cpp index 13c7a537c2aa289452c07835faf6b571e90a4734..3bc52f294567c15000ee3a3177948468bf8fac9c 100644 --- a/src/plugins/debugger/registerwindow.cpp +++ b/src/plugins/debugger/registerwindow.cpp @@ -144,8 +144,7 @@ private: /////////////////////////////////////////////////////////////////////// RegisterWindow::RegisterWindow(DebuggerManager *manager) - : m_manager(manager), m_alwaysResizeColumnsToContents(true), - m_alwaysReloadContents(false) + : m_manager(manager), m_alwaysResizeColumnsToContents(true) { QAction *act = theDebuggerAction(UseAlternatingRowColors); setWindowTitle(tr("Registers")); @@ -167,9 +166,6 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev) QMenu menu; QAction *actReload = menu.addAction(tr("Reload register listing")); - QAction *actAlwaysReload = menu.addAction(tr("Always reload register listing")); - actAlwaysReload->setCheckable(true); - actAlwaysReload->setChecked(m_alwaysReloadContents); menu.addSeparator(); QModelIndex idx = indexAt(ev->pos()); @@ -214,9 +210,7 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev) else if (act == actAlwaysAdjust) setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents); else if (act == actReload) - reloadContents(); - else if (act == actAlwaysReload) - setAlwaysReloadContents(!m_alwaysReloadContents); + m_manager->reloadRegisters(); else if (act == actShowMemory) (void) new MemoryViewAgent(m_manager, address); else if (act) { @@ -240,18 +234,6 @@ void RegisterWindow::setAlwaysResizeColumnsToContents(bool on) header()->setResizeMode(1, mode); } -void RegisterWindow::setAlwaysReloadContents(bool on) -{ - m_alwaysReloadContents = on; - if (m_alwaysReloadContents) - reloadContents(); -} - -void RegisterWindow::reloadContents() -{ - emit reloadRegisterRequested(); -} - void RegisterWindow::setModel(QAbstractItemModel *model) { diff --git a/src/plugins/debugger/registerwindow.h b/src/plugins/debugger/registerwindow.h index 394a1ca3c916078c816ea1b42cfdc8f110f2dbe4..3e7da419cf8166613f151377edce3f5b163b8eb8 100644 --- a/src/plugins/debugger/registerwindow.h +++ b/src/plugins/debugger/registerwindow.h @@ -44,14 +44,9 @@ public: explicit RegisterWindow(DebuggerManager *manager); void setModel(QAbstractItemModel *model); -signals: - void reloadRegisterRequested(); - public slots: void resizeColumnsToContents(); void setAlwaysResizeColumnsToContents(bool on); - void reloadContents(); - void setAlwaysReloadContents(bool on); void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); } private: @@ -61,7 +56,6 @@ private: DebuggerManager *m_manager; bool m_alwaysResizeColumnsToContents; - bool m_alwaysReloadContents; }; } // namespace Internal diff --git a/src/plugins/debugger/shared/peutils.cpp b/src/plugins/debugger/shared/peutils.cpp index a0e779e9311c940e9f58c642460dc6b6ee58693f..0fb5350fbb610d3b4c83c6a674f5b7566c0c757f 100644 --- a/src/plugins/debugger/shared/peutils.cpp +++ b/src/plugins/debugger/shared/peutils.cpp @@ -35,7 +35,7 @@ #include <climits> #include <windows.h> -using Core::Utils::winErrorMessage; +using Utils::winErrorMessage; // Create a pointer from base and offset when rummaging around in // a memory mapped file diff --git a/src/plugins/debugger/shared/sharedlibraryinjector.cpp b/src/plugins/debugger/shared/sharedlibraryinjector.cpp index 24d81c6fa6673ade54e3c8e2409a497e8d2adaa1..b9e1252a5d4cf59bbf9ba5bee402700b449fc831 100644 --- a/src/plugins/debugger/shared/sharedlibraryinjector.cpp +++ b/src/plugins/debugger/shared/sharedlibraryinjector.cpp @@ -66,7 +66,7 @@ enum { debug = 0 }; static QString msgFuncFailed(const char *f, unsigned long error) { - return QString::fromLatin1("%1 failed: %2").arg(QLatin1String(f), Core::Utils::winErrorMessage(error)); + return QString::fromLatin1("%1 failed: %2").arg(QLatin1String(f), Utils::winErrorMessage(error)); } // Resolve a symbol from a library handle diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp index e3b25b24334f82f8406a828ae8c252c38a655f1d..a12367df9a4c2ad6a3abf194a8fb2330b661c434 100644 --- a/src/plugins/debugger/stackhandler.cpp +++ b/src/plugins/debugger/stackhandler.cpp @@ -238,11 +238,28 @@ bool StackHandler::isDebuggingDebuggingHelpers() const // //////////////////////////////////////////////////////////////////////// -ThreadsHandler::ThreadsHandler(QObject *parent) - : QAbstractTableModel(parent), m_currentIndex(0) +ThreadData::ThreadData(int threadId) : + id(threadId), + line(-1) +{ +} + +void ThreadData::notifyRunning() +{ + address = 0; + function.clear(); + file.clear(); + line = -1; +} + +enum { IdColumn, AddressColumn, FunctionColumn, FileColumn, LineColumn, ColumnCount }; + +ThreadsHandler::ThreadsHandler(QObject *parent) : + QAbstractTableModel(parent), + m_currentIndex(0), + m_positionIcon(QLatin1String(":/debugger/images/location.svg")), + m_emptyIcon(QLatin1String(":/debugger/images/empty.svg")) { - m_emptyIcon = QIcon(":/debugger/images/empty.svg"); - m_positionIcon = QIcon(":/debugger/images/location.svg"); } int ThreadsHandler::rowCount(const QModelIndex &parent) const @@ -253,23 +270,39 @@ int ThreadsHandler::rowCount(const QModelIndex &parent) const int ThreadsHandler::columnCount(const QModelIndex &parent) const { - return parent.isValid() ? 0 : 1; + return parent.isValid() ? 0 : int(ColumnCount); } QVariant ThreadsHandler::data(const QModelIndex &index, int role) const { - if (!index.isValid() || index.row() >= m_threads.size()) + if (!index.isValid()) + return QVariant(); + const int row = index.row(); + if (row >= m_threads.size()) return QVariant(); + const ThreadData &thread = m_threads.at(row); if (role == Qt::DisplayRole) { switch (index.column()) { - case 0: // Thread ID - return m_threads.at(index.row()).id; - case 1: // Function name - return "???"; + case IdColumn: + return thread.id; + case FunctionColumn: + return thread.function; + case FileColumn: + return thread.file; + case LineColumn: + return thread.line >= 0 ? QString::number(thread.line) : QString(); + case AddressColumn: + return thread.address > 0 ? QLatin1String("0x") + QString::number(thread.address, 16) : QString(); } } else if (role == Qt::ToolTipRole) { - return tr("Thread: %1").arg(m_threads.at(index.row()).id); + if (thread.address == 0) + return tr("Thread: %1").arg(thread.id); + // Stopped + if (thread.file.isEmpty()) + return tr("Thread: %1 at %2 (0x%3)").arg(thread.id).arg(thread.function).arg(thread.address, 0, 16); + return tr("Thread: %1 at %2, %3:%4 (0x%5)"). + arg(thread.id).arg(thread.function, thread.file).arg(thread.line).arg(thread.address, 0, 16); } else if (role == Qt::DecorationRole && index.column() == 0) { // Return icon that indicates whether this is the active stack frame return (index.row() == m_currentIndex) ? m_positionIcon : m_emptyIcon; @@ -280,9 +313,19 @@ QVariant ThreadsHandler::data(const QModelIndex &index, int role) const QVariant ThreadsHandler::headerData(int section, Qt::Orientation orientation, int role) const { - if (orientation == Qt::Horizontal && role == Qt::DisplayRole) { - if (section < 1) - return tr("Thread ID"); + if (orientation != Qt::Horizontal || role != Qt::DisplayRole) + return QVariant(); + switch (section) { + case IdColumn: + return tr("Thread ID"); + case FunctionColumn: + return tr("Function"); + case FileColumn: + return tr("File"); + case LineColumn: + return tr("Line"); + case AddressColumn: + return tr("Address"); } return QVariant(); } @@ -322,3 +365,16 @@ void ThreadsHandler::removeAll() m_currentIndex = 0; reset(); } + +void ThreadsHandler::notifyRunning() +{ + // Threads stopped (that is, address != 0 showing)? + if (m_threads.empty()) + return; + if (m_threads.front().address == 0) + return; + const QList<ThreadData>::iterator end = m_threads.end(); + for (QList<ThreadData>::iterator it = m_threads.begin(); it != end; ++it) + it->notifyRunning(); + emit dataChanged(index(0, 1), index(m_threads.size()- 1, ColumnCount - 1)); +} diff --git a/src/plugins/debugger/stackhandler.h b/src/plugins/debugger/stackhandler.h index dd2c0a4997fac25ccdb23b0fd5e5eeafffa9fd2f..0df1d602573d6d2c59e6a5f97a0175c5bf4f1ceb 100644 --- a/src/plugins/debugger/stackhandler.h +++ b/src/plugins/debugger/stackhandler.h @@ -41,6 +41,14 @@ namespace Debugger { namespace Internal { +struct StackCookie +{ + StackCookie() : isFull(true), gotoLocation(false) {} + StackCookie(bool full, bool jump) : isFull(full), gotoLocation(jump) {} + bool isFull; + bool gotoLocation; +}; + //////////////////////////////////////////////////////////////////////// // // StackModel @@ -92,8 +100,15 @@ private: struct ThreadData { - ThreadData(int threadId = 0) : id(threadId) {} + ThreadData(int threadId = 0); + void notifyRunning(); // Clear state information + int id; + // State information when stopped + quint64 address; + QString function; + QString file; + int line; }; /*! A model to represent the running threads in a QTreeView or ComboBox */ @@ -111,6 +126,9 @@ public: QList<ThreadData> threads() const; QAbstractItemModel *threadsModel() { return this; } + // Clear out all frame information + void notifyRunning(); + private: int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; @@ -118,15 +136,17 @@ private: QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; private: - friend class StackHandler; QList<ThreadData> m_threads; int m_currentIndex; - QIcon m_positionIcon; - QIcon m_emptyIcon; + const QIcon m_positionIcon; + const QIcon m_emptyIcon; }; } // namespace Internal } // namespace Debugger +Q_DECLARE_METATYPE(Debugger::Internal::StackCookie) + + #endif // DEBUGGER_STACKHANDLER_H diff --git a/src/plugins/debugger/startexternaldialog.ui b/src/plugins/debugger/startexternaldialog.ui index ff2aea3608d5aabd9d89adbf97b47b58ddb3167c..90ed85ac592adeccdd88461465e950874682ec1e 100644 --- a/src/plugins/debugger/startexternaldialog.ui +++ b/src/plugins/debugger/startexternaldialog.ui @@ -59,7 +59,7 @@ <widget class="QLineEdit" name="argsEdit"/> </item> <item row="0" column="1"> - <widget class="Core::Utils::PathChooser" name="execFile" native="true"/> + <widget class="Utils::PathChooser" name="execFile" native="true"/> </item> <item row="2" column="1"> <widget class="QCheckBox" name="checkBoxBreakAtMain"> @@ -98,7 +98,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/debugger/startremotedialog.ui b/src/plugins/debugger/startremotedialog.ui index 242589276dc75164d36b96cb2029ce50012b2927..4bfc215190702820a2dd59ab9890975631887cda 100644 --- a/src/plugins/debugger/startremotedialog.ui +++ b/src/plugins/debugger/startremotedialog.ui @@ -60,7 +60,7 @@ </widget> </item> <item row="3" column="1"> - <widget class="Core::Utils::PathChooser" name="serverStartScript" native="true"/> + <widget class="Utils::PathChooser" name="serverStartScript" native="true"/> </item> <item row="3" column="0"> <widget class="QLabel" name="serverStartScriptLabel"> @@ -85,7 +85,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> </customwidget> diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index ca5e6425b794c0b47ee99cc2eb5d76583580de4a..f40bb93085dcf57d4e4ffd45a4e232f479513338 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -34,6 +34,7 @@ #include "debuggeragents.h" #include "debuggerdialogs.h" #include "debuggermanager.h" +#include "idebuggerengine.h" #include <utils/qtcassert.h> @@ -274,6 +275,10 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addSeparator(); menu.addAction(theDebuggerAction(UseToolTipsInLocalsView)); + + menu.addAction(theDebuggerAction(AutoDerefPointers)); + theDebuggerAction(AutoDerefPointers)-> + setEnabled(m_manager->currentEngine()->isGdbEngine()); QAction *actAdjustColumnWidths = menu.addAction(tr("Adjust column widths to contents")); QAction *actAlwaysAdjustColumnWidth = diff --git a/src/plugins/designer/cpp/formclasswizardpage.ui b/src/plugins/designer/cpp/formclasswizardpage.ui index 6381b45fd0b62cc4703b592ccce43eee7925bd96..605406993dacd1970f9b02097364b1f6464d3ce2 100644 --- a/src/plugins/designer/cpp/formclasswizardpage.ui +++ b/src/plugins/designer/cpp/formclasswizardpage.ui @@ -21,7 +21,7 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="Core::Utils::NewClassWidget" name="newClassWidget"/> + <widget class="Utils::NewClassWidget" name="newClassWidget"/> </item> </layout> </widget> @@ -54,7 +54,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::NewClassWidget</class> + <class>Utils::NewClassWidget</class> <extends>QWidget</extends> <header location="global">utils/newclasswidget.h</header> <container>1</container> diff --git a/src/plugins/designer/cpp/formclasswizardparameters.cpp b/src/plugins/designer/cpp/formclasswizardparameters.cpp index f777d0eec7e21e545a243cf61f63a0ac116470fa..e05079f8da64ee56c5760cd1be065a230252bc08 100644 --- a/src/plugins/designer/cpp/formclasswizardparameters.cpp +++ b/src/plugins/designer/cpp/formclasswizardparameters.cpp @@ -341,7 +341,7 @@ bool FormClassWizardParametersPrivate::generateCpp(const FormClassWizardGenerati const QString license = CppTools::AbstractEditorSupport::licenseTemplate(); // Include guards - const QString guard = Core::Utils::headerGuard(headerFile); + const QString guard = Utils::headerGuard(headerFile); QString uiInclude = QLatin1String("ui_"); uiInclude += QFileInfo(uiFile).completeBaseName(); @@ -354,7 +354,7 @@ bool FormClassWizardParametersPrivate::generateCpp(const FormClassWizardGenerati // Include 'ui_' if (embedding != FormClassWizardGenerationParameters::PointerAggregatedUiClass) { - Core::Utils::writeIncludeFileDirective(uiInclude, false, headerStr); + Utils::writeIncludeFileDirective(uiInclude, false, headerStr); } else { // Todo: Can we obtain the header from the code model for custom widgets? // Alternatively, from Designer. @@ -362,11 +362,11 @@ bool FormClassWizardParametersPrivate::generateCpp(const FormClassWizardGenerati QString baseInclude = formBaseClass; if (generationParameters.includeQtModule()) baseInclude.insert(0, QLatin1String("QtGui/")); - Core::Utils::writeIncludeFileDirective(baseInclude, true, headerStr); + Utils::writeIncludeFileDirective(baseInclude, true, headerStr); } } - const QString namespaceIndent = Core::Utils::writeOpeningNameSpaces(namespaceList, + const QString namespaceIndent = Utils::writeOpeningNameSpaces(namespaceList, generationParameters.indentNamespace() ? indent : QString(), headerStr); @@ -402,17 +402,17 @@ bool FormClassWizardParametersPrivate::generateCpp(const FormClassWizardGenerati headerStr << uiMemberC << ";\n"; } headerStr << namespaceIndent << "};\n\n"; - Core::Utils::writeClosingNameSpaces(namespaceList, generationParameters.indentNamespace() ? indent : QString(), headerStr); + Utils::writeClosingNameSpaces(namespaceList, generationParameters.indentNamespace() ? indent : QString(), headerStr); headerStr << "#endif // "<< guard << '\n'; // 2) Source file QTextStream sourceStr(source); sourceStr << license; - Core::Utils::writeIncludeFileDirective(headerFile, false, sourceStr); + Utils::writeIncludeFileDirective(headerFile, false, sourceStr); if (embedding == FormClassWizardGenerationParameters::PointerAggregatedUiClass) - Core::Utils::writeIncludeFileDirective(uiInclude, false, sourceStr); + Utils::writeIncludeFileDirective(uiInclude, false, sourceStr); // NameSpaces( - Core::Utils::writeOpeningNameSpaces(namespaceList, generationParameters.indentNamespace() ? indent : QString(), sourceStr); + Utils::writeOpeningNameSpaces(namespaceList, generationParameters.indentNamespace() ? indent : QString(), sourceStr); // Constructor with setupUi sourceStr << '\n' << namespaceIndent << unqualifiedClassName << "::" << unqualifiedClassName << "(QWidget *parent) :\n" << namespaceIndent << indent << formBaseClass << "(parent)"; @@ -443,7 +443,7 @@ bool FormClassWizardParametersPrivate::generateCpp(const FormClassWizardGenerati << namespaceIndent << indent << "}\n" << namespaceIndent << "}\n"; } - Core::Utils::writeClosingNameSpaces(namespaceList, generationParameters.indentNamespace() ? indent : QString(), sourceStr); + Utils::writeClosingNameSpaces(namespaceList, generationParameters.indentNamespace() ? indent : QString(), sourceStr); return true; } diff --git a/src/plugins/designer/editorwidget.cpp b/src/plugins/designer/editorwidget.cpp index 65555e32413030bdea014e871abe5c32a7c100c5..c12a07610043e2e7c1534ac13f4952b809e4c08b 100644 --- a/src/plugins/designer/editorwidget.cpp +++ b/src/plugins/designer/editorwidget.cpp @@ -80,7 +80,7 @@ SharedSubWindow::~SharedSubWindow() QHash<QString, QVariant> EditorWidget::m_globalState = QHash<QString, QVariant>(); EditorWidget::EditorWidget(QWidget *formWindow) - : m_mainWindow(new Core::Utils::FancyMainWindow), + : m_mainWindow(new Utils::FancyMainWindow), m_initialized(false) { QVBoxLayout *layout = new QVBoxLayout; diff --git a/src/plugins/designer/editorwidget.h b/src/plugins/designer/editorwidget.h index 17385310694ea1803d53f9cf833271cd447fd1c5..4f1312c3b6c9c17745fefa7ada9da0f2dd700125 100644 --- a/src/plugins/designer/editorwidget.h +++ b/src/plugins/designer/editorwidget.h @@ -95,7 +95,7 @@ protected: private: SharedSubWindow* m_designerSubWindows[Designer::Constants::DesignerSubWindowCount]; QDockWidget *m_designerDockWidgets[Designer::Constants::DesignerSubWindowCount]; - Core::Utils::FancyMainWindow *m_mainWindow; + Utils::FancyMainWindow *m_mainWindow; bool m_initialized; static QHash<QString, QVariant> m_globalState; diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index 41b1d11dfd2b17a66835c8dda772ebe3fef5e906..50bc5f1e9321d20b4872dd0c2db1d4f04c6a1d17 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -159,6 +159,7 @@ static inline void addToolAction(QAction *a, c1->addAction(command); } +using namespace Designer; using namespace Designer::Internal; using namespace Designer::Constants; diff --git a/src/plugins/designer/formeditorw.h b/src/plugins/designer/formeditorw.h index 58cdd64e6f133468b8508c05fb6c5312f49002c8..e592cfacf287be02a429f577472c5b6779899188 100644 --- a/src/plugins/designer/formeditorw.h +++ b/src/plugins/designer/formeditorw.h @@ -68,9 +68,10 @@ class IEditor; } namespace Designer { +class FormWindowEditor; + namespace Internal { -class FormWindowEditor; class SettingsPage; class ProxyAction : public QAction diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp index 0be5ec28a1db8c9e0bfc756b56056c452d982366..2623f1b9dfa48a63d805fc7084526675faada70e 100644 --- a/src/plugins/designer/formwindoweditor.cpp +++ b/src/plugins/designer/formwindoweditor.cpp @@ -60,6 +60,7 @@ #include <QtGui/QToolBar> #include <QtGui/QDockWidget> +using namespace Designer; using namespace Designer::Internal; using namespace Designer::Constants; using namespace SharedTools; diff --git a/src/plugins/designer/formwindoweditor.h b/src/plugins/designer/formwindoweditor.h index cc49605ac3d17b90e405a6649466dfaa7dc1ad8e..3ca63df81a30afc8dbc579a365751bbecf3399b8 100644 --- a/src/plugins/designer/formwindoweditor.h +++ b/src/plugins/designer/formwindoweditor.h @@ -51,10 +51,10 @@ class NodesWatcher; namespace Designer { namespace Internal { - class FormWindowFile; class FormWindowHost; class EditorWidget; +} // Master class maintaining a form window editor, // containing file and widget host @@ -114,9 +114,9 @@ private: QString m_displayName; const QList<int> m_context; QDesignerFormWindowInterface *m_formWindow; - FormWindowFile *m_file; - FormWindowHost *m_host; - EditorWidget *m_editorWidget; + Internal::FormWindowFile *m_file; + Internal::FormWindowHost *m_host; + Internal::EditorWidget *m_editorWidget; QToolBar *m_toolBar; QStringList m_originalUiQrcPaths; ProjectExplorer::SessionNode *m_sessionNode; @@ -124,6 +124,5 @@ private: }; } // namespace Internal -} // namespace Designer #endif // FORMWINDOWEDITOR_H diff --git a/src/plugins/designer/formwindowfile.cpp b/src/plugins/designer/formwindowfile.cpp index 4df60e9f5d04d82d35a3a86c2d49da1e1df8d386..0ab5f767f6c2cf831b3111717b21639047cfe45e 100644 --- a/src/plugins/designer/formwindowfile.cpp +++ b/src/plugins/designer/formwindowfile.cpp @@ -134,17 +134,17 @@ void FormWindowFile::modified(Core::IFile::ReloadBehavior *behavior) break; } - switch (Core::Utils::reloadPrompt(m_fileName, isModified(), Core::ICore::instance()->mainWindow())) { - case Core::Utils::ReloadCurrent: + switch (Utils::reloadPrompt(m_fileName, isModified(), Core::ICore::instance()->mainWindow())) { + case Utils::ReloadCurrent: emit reload(m_fileName); break; - case Core::Utils::ReloadAll: + case Utils::ReloadAll: emit reload(m_fileName); *behavior = Core::IFile::ReloadAll; break; - case Core::Utils::ReloadSkipCurrent: + case Utils::ReloadSkipCurrent: break; - case Core::Utils::ReloadNone: + case Utils::ReloadNone: *behavior = Core::IFile::ReloadNone; break; } diff --git a/src/plugins/designer/formwizarddialog.cpp b/src/plugins/designer/formwizarddialog.cpp index a9bb38e0ce2f6ebf4345addafcda6a0464a953bd..ac04fd3db89a6dede4c69aabc75ac6ca89eb085c 100644 --- a/src/plugins/designer/formwizarddialog.cpp +++ b/src/plugins/designer/formwizarddialog.cpp @@ -79,7 +79,7 @@ QString FormWizardDialog::templateContents() const FormFileWizardDialog::FormFileWizardDialog(const WizardPageList &extensionPages, QWidget *parent) : FormWizardDialog(extensionPages, parent), - m_filePage(new Core::Utils::FileWizardPage) + m_filePage(new Utils::FileWizardPage) { setPage(FilePageId, m_filePage); connect(m_filePage, SIGNAL(activated()), diff --git a/src/plugins/designer/formwizarddialog.h b/src/plugins/designer/formwizarddialog.h index 534ac9ac390358d55438f3c12fae0f2a2b55325c..a31630515ea6b77a1ad6c6156aa9ba859d828c3a 100644 --- a/src/plugins/designer/formwizarddialog.h +++ b/src/plugins/designer/formwizarddialog.h @@ -32,11 +32,9 @@ #include <QtGui/QWizard> -namespace Core { namespace Utils { class FileWizardPage; } -} namespace Designer { namespace Internal { @@ -88,7 +86,7 @@ private slots: void slotCurrentIdChanged(int id); private: - Core::Utils::FileWizardPage *m_filePage; + Utils::FileWizardPage *m_filePage; }; } // namespace Internal diff --git a/src/plugins/fakevim/fakevimactions.cpp b/src/plugins/fakevim/fakevimactions.cpp index e805311a24f4050435900e4912bb7ae79c953d73..272c2d10fefda776bfaf91dd061e4ad7dddc1387 100644 --- a/src/plugins/fakevim/fakevimactions.cpp +++ b/src/plugins/fakevim/fakevimactions.cpp @@ -48,7 +48,7 @@ #include <QtCore/QCoreApplication> #include <QtCore/QStack> -using namespace Core::Utils; +using namespace Utils; /////////////////////////////////////////////////////////////////////// // diff --git a/src/plugins/fakevim/fakevimactions.h b/src/plugins/fakevim/fakevimactions.h index 11d23989359622f2059962671f62b42291108657..2a5a5e4cbeee3b332b46c5d258c3656a22c60f47 100644 --- a/src/plugins/fakevim/fakevimactions.h +++ b/src/plugins/fakevim/fakevimactions.h @@ -66,24 +66,24 @@ class FakeVimSettings : public QObject public: FakeVimSettings(); ~FakeVimSettings(); - void insertItem(int code, Core::Utils::SavedAction *item, + void insertItem(int code, Utils::SavedAction *item, const QString &longname = QString(), const QString &shortname = QString()); - Core::Utils::SavedAction *item(int code); - Core::Utils::SavedAction *item(const QString &name); + Utils::SavedAction *item(int code); + Utils::SavedAction *item(const QString &name); void readSettings(QSettings *settings); void writeSettings(QSettings *settings); private: - QHash<int, Core::Utils::SavedAction *> m_items; + QHash<int, Utils::SavedAction *> m_items; QHash<QString, int> m_nameToCode; QHash<int, QString> m_codeToName; }; FakeVimSettings *theFakeVimSettings(); -Core::Utils::SavedAction *theFakeVimSetting(int code); +Utils::SavedAction *theFakeVimSetting(int code); } // namespace Internal } // namespace FakeVim diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 49bf5df7932d20ab6b6ee28d9ccb4e53d51eacb8..09dd1307532172e99851fc45ec899dff938e6294 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -93,7 +93,7 @@ # define UNDO_DEBUG(s) #endif -using namespace Core::Utils; +using namespace Utils; namespace FakeVim { namespace Internal { diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index c4c4792f49db489f7ff37a986e0159a525189dcf..4246e1d1335f29ccf87fcdb27cbeeb67820d2d7d 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -128,7 +128,7 @@ private: friend class DebuggerPlugin; Ui::FakeVimOptionPage m_ui; - Core::Utils::SavedActionSet m_group; + Utils::SavedActionSet m_group; }; QWidget *FakeVimOptionPage::createPage(QWidget *parent) diff --git a/src/plugins/find/findtoolbar.cpp b/src/plugins/find/findtoolbar.cpp index 01d6449aaca1a22be84584d287c9b624141f551c..948aeb6f892ae8dadca9b13397a19b69dfcc323f 100644 --- a/src/plugins/find/findtoolbar.cpp +++ b/src/plugins/find/findtoolbar.cpp @@ -91,7 +91,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen m_findCompleter->popup()->installEventFilter(this); m_ui.replaceEdit->setCompleter(m_replaceCompleter); - m_ui.findEdit->setSide(qApp->layoutDirection() == Qt::LeftToRight ? Core::Utils::FancyLineEdit::Right : Core::Utils::FancyLineEdit::Left); + m_ui.findEdit->setSide(qApp->layoutDirection() == Qt::LeftToRight ? Utils::FancyLineEdit::Right : Utils::FancyLineEdit::Left); QMenu *lineEditMenu = new QMenu(m_ui.findEdit); m_ui.findEdit->setMenu(lineEditMenu); @@ -278,7 +278,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event) m_currentDocumentFind->clearFindScope(); } } - return Core::Utils::StyledBar::eventFilter(obj, event); + return Utils::StyledBar::eventFilter(obj, event); } void FindToolBar::adaptToCandidate() @@ -598,7 +598,7 @@ bool FindToolBar::focusNextPrevChild(bool next) else if (!next && m_ui.findEdit->hasFocus()) m_ui.replaceAllButton->setFocus(Qt::TabFocusReason); else - return Core::Utils::StyledBar::focusNextPrevChild(next); + return Utils::StyledBar::focusNextPrevChild(next); return true; } diff --git a/src/plugins/find/findtoolbar.h b/src/plugins/find/findtoolbar.h index cbde5eceb5287adb194c5e7848a9e2faf2b2512a..ac531defdf7aa55261667bec0efb5a503a8c825f 100644 --- a/src/plugins/find/findtoolbar.h +++ b/src/plugins/find/findtoolbar.h @@ -48,7 +48,7 @@ namespace Internal { class FindPlugin; -class FindToolBar : public Core::Utils::StyledBar +class FindToolBar : public Utils::StyledBar { Q_OBJECT diff --git a/src/plugins/find/findwidget.ui b/src/plugins/find/findwidget.ui index 08abeb8efc7f75cae37b51a811710bedd26a3cd9..59153e49362643e69f69e8bd4d64b2e91b22f61a 100644 --- a/src/plugins/find/findwidget.ui +++ b/src/plugins/find/findwidget.ui @@ -40,7 +40,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="Core::Utils::FancyLineEdit" name="findEdit"/> + <widget class="Utils::FancyLineEdit" name="findEdit"/> </item> <item row="0" column="2"> <layout class="QHBoxLayout" name="horizontalLayout_2"> @@ -162,7 +162,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::FancyLineEdit</class> + <class>Utils::FancyLineEdit</class> <extends>QLineEdit</extends> <header location="global">utils/fancylineedit.h</header> </customwidget> diff --git a/src/plugins/find/searchresulttreeview.cpp b/src/plugins/find/searchresulttreeview.cpp index c5317c0fdb7e6107b41dda4b8c052f84e64049a0..e05360a4354319c2fcc118e4d6718d388ff24bd7 100644 --- a/src/plugins/find/searchresulttreeview.cpp +++ b/src/plugins/find/searchresulttreeview.cpp @@ -81,13 +81,10 @@ void SearchResultTreeView::emitJumpToSearchResult(const QModelIndex &index) if (model()->data(index, ItemDataRoles::TypeRole).toString().compare("row") != 0) return; - QString fileName = model()->data(index, ItemDataRoles::FileNameRole).toString(); int position = model()->data(index, ItemDataRoles::ResultIndexRole).toInt(); - int lineNumber = model()->data(index, ItemDataRoles::ResultLineNumberRole).toInt(); - int searchTermStart = model()->data(index, ItemDataRoles::SearchTermStartRole).toInt(); - int searchTermLength = model()->data(index, ItemDataRoles::SearchTermLengthRole).toInt(); + int checked = model()->data(index, Qt::CheckStateRole).toBool(); - emit jumpToSearchResult(position, fileName, lineNumber, searchTermStart, searchTermLength); + emit jumpToSearchResult(position, checked); } void SearchResultTreeView::keyPressEvent(QKeyEvent *e) diff --git a/src/plugins/find/searchresulttreeview.h b/src/plugins/find/searchresulttreeview.h index c8a5cc52e51d1db5f4d5e45bb2c66cb191654aa0..81b767cee728d5906b37f4e2ba5bb1b7e3746e7e 100644 --- a/src/plugins/find/searchresulttreeview.h +++ b/src/plugins/find/searchresulttreeview.h @@ -51,8 +51,7 @@ public: SearchResultTreeModel *model() const; signals: - void jumpToSearchResult(int index, const QString &fileName, int lineNumber, - int searchTermStart, int searchTermLength); + void jumpToSearchResult(int index, bool checked); public slots: void clear(); diff --git a/src/plugins/find/searchresultwindow.cpp b/src/plugins/find/searchresultwindow.cpp index 1503eb270c701c2ab5081b598a45c766ed414fea..2f846cd89c88f95328b25ff00fbb992114df8941 100644 --- a/src/plugins/find/searchresultwindow.cpp +++ b/src/plugins/find/searchresultwindow.cpp @@ -29,8 +29,10 @@ #include "searchresultwindow.h" #include "searchresulttreemodel.h" +#include "searchresulttreeitems.h" #include <coreplugin/icore.h> +#include <utils/qtcassert.h> #include <QtCore/QFile> #include <QtCore/QTextStream> @@ -49,18 +51,9 @@ static const QString SETTINGSKEYSECTIONNAME("SearchResults"); static const QString SETTINGSKEYEXPANDRESULTS("ExpandResults"); -void ResultWindowItem::setData(const QVariant &data) -{ - m_data = data; -} - -QVariant ResultWindowItem::data() const -{ - return m_data; -} - SearchResultWindow::SearchResultWindow() - : m_isShowingReplaceUI(false) + : m_currentSearch(0), + m_isShowingReplaceUI(false) { m_widget = new QStackedWidget; m_widget->setWindowTitle(name()); @@ -91,9 +84,10 @@ SearchResultWindow::SearchResultWindow() m_replaceButton->setAutoRaise(true); m_replaceTextEdit->setTabOrder(m_replaceTextEdit, m_searchResultTreeView); - connect(m_searchResultTreeView, SIGNAL(jumpToSearchResult(int,const QString&,int,int,int)), - this, SLOT(handleJumpToSearchResult(int,const QString&,int,int,int))); + connect(m_searchResultTreeView, SIGNAL(jumpToSearchResult(int,bool)), + this, SLOT(handleJumpToSearchResult(int,bool))); connect(m_expandCollapseToolButton, SIGNAL(toggled(bool)), this, SLOT(handleExpandCollapseToolButton(bool))); + connect(m_replaceTextEdit, SIGNAL(returnPressed()), this, SLOT(handleReplaceButton())); connect(m_replaceButton, SIGNAL(clicked()), this, SLOT(handleReplaceButton())); readSettings(); @@ -103,9 +97,10 @@ SearchResultWindow::SearchResultWindow() SearchResultWindow::~SearchResultWindow() { writeSettings(); + delete m_currentSearch; + m_currentSearch = 0; delete m_widget; m_widget = 0; - qDeleteAll(m_items); m_items.clear(); } @@ -115,7 +110,6 @@ void SearchResultWindow::setShowReplaceUI(bool show) m_replaceLabel->setVisible(show); m_replaceTextEdit->setVisible(show); m_replaceButton->setVisible(show); -// TODO m_searchResultTreeView->setShowCheckboxes(show); m_isShowingReplaceUI = show; } @@ -126,18 +120,27 @@ bool SearchResultWindow::isShowingReplaceUI() const void SearchResultWindow::handleReplaceButton() { - emit replaceButtonClicked(m_replaceTextEdit->text()); + QTC_ASSERT(m_currentSearch, return); + m_currentSearch->replaceButtonClicked(m_replaceTextEdit->text(), checkedItems()); } -QList<ResultWindowItem *> SearchResultWindow::selectedItems() const +QList<SearchResultItem> SearchResultWindow::checkedItems() const { - QList<ResultWindowItem *> items; - // TODO -// foreach (ResultWindowItem *item, m_items) { -// if (item->isSelected) -// items << item; -// } - return items; + QList<SearchResultItem> result; + SearchResultTreeModel *model = m_searchResultTreeView->model(); + const int fileCount = model->rowCount(QModelIndex()); + for (int i = 0; i < fileCount; ++i) { + QModelIndex fileIndex = model->index(i, 0, QModelIndex()); + SearchResultFile *fileItem = static_cast<SearchResultFile *>(fileIndex.internalPointer()); + Q_ASSERT(fileItem != 0); + for (int rowIndex = 0; rowIndex < fileItem->childrenCount(); ++rowIndex) { + QModelIndex textIndex = model->index(rowIndex, 0, fileIndex); + SearchResultTextRow *rowItem = static_cast<SearchResultTextRow *>(textIndex.internalPointer()); + if (rowItem->checkState()) + result << m_items.at(rowItem->index()); + } + } + return result; } void SearchResultWindow::visibilityChanged(bool /*visible*/) @@ -154,18 +157,27 @@ QList<QWidget*> SearchResultWindow::toolBarWidgets() const return QList<QWidget*>() << m_expandCollapseToolButton << m_replaceLabel << m_replaceTextEdit << m_replaceButton; } +SearchResult *SearchResultWindow::startNewSearch(SearchMode searchOrSearchAndReplace) +{ + clearContents(); + setShowReplaceUI(searchOrSearchAndReplace != SearchOnly); + delete m_currentSearch; + m_currentSearch = new SearchResult; + return m_currentSearch; +} + void SearchResultWindow::clearContents() { - setShowReplaceUI(false); - m_widget->setCurrentWidget(m_searchResultTreeView); + setReplaceUIEnabled(false); m_searchResultTreeView->clear(); - qDeleteAll(m_items); m_items.clear(); + m_widget->setCurrentWidget(m_searchResultTreeView); navigateStateChanged(); } void SearchResultWindow::showNoMatchesFound() { + setReplaceUIEnabled(false); m_widget->setCurrentWidget(m_noMatchesFoundDisplay); } @@ -176,7 +188,7 @@ bool SearchResultWindow::isEmpty() const int SearchResultWindow::numberOfResults() const { - return m_searchResultTreeView->model()->rowCount(); + return m_items.count(); } bool SearchResultWindow::hasFocus() @@ -210,30 +222,41 @@ void SearchResultWindow::setTextEditorFont(const QFont &font) m_searchResultTreeView->setTextEditorFont(font); } -void SearchResultWindow::handleJumpToSearchResult(int index, const QString &fileName, int lineNumber, - int searchTermStart, int searchTermLength) +void SearchResultWindow::handleJumpToSearchResult(int index, bool checked) { - Q_UNUSED(searchTermLength) - ResultWindowItem *item = m_items.at(index); - emit item->activated(fileName, lineNumber, searchTermStart); + QTC_ASSERT(m_currentSearch, return); + m_currentSearch->activated(m_items.at(index)); } -ResultWindowItem *SearchResultWindow::addResult(const QString &fileName, int lineNumber, const QString &rowText, - int searchTermStart, int searchTermLength) +void SearchResultWindow::addResult(const QString &fileName, int lineNumber, const QString &rowText, + int searchTermStart, int searchTermLength, const QVariant &userData) { //qDebug()<<"###"<<fileName; m_widget->setCurrentWidget(m_searchResultTreeView); int index = m_items.size(); - ResultWindowItem *item = new ResultWindowItem; + SearchResultItem item; + item.fileName = fileName; + item.lineNumber = lineNumber; + item.lineText = rowText; + item.searchTermStart = searchTermStart; + item.searchTermLength = searchTermLength; + item.userData = userData; + item.index = index; m_items.append(item); m_searchResultTreeView->appendResultLine(index, fileName, lineNumber, rowText, searchTermStart, searchTermLength); if (index == 0) { + setReplaceUIEnabled(true); // We didn't have an item before, set the focus to the m_searchResultTreeView setFocus(); m_searchResultTreeView->selectionModel()->select(m_searchResultTreeView->model()->index(0, 0, QModelIndex()), QItemSelectionModel::Select); emit navigateStateChanged(); } - return item; +} + +void SearchResultWindow::setReplaceUIEnabled(bool enabled) +{ + m_replaceTextEdit->setEnabled(enabled); + m_replaceButton->setEnabled(enabled); } void SearchResultWindow::handleExpandCollapseToolButton(bool checked) @@ -272,17 +295,17 @@ int SearchResultWindow::priorityInStatusBar() const bool SearchResultWindow::canNext() { - return m_searchResultTreeView->model()->rowCount(); + return m_items.count() > 0; } bool SearchResultWindow::canPrevious() { - return m_searchResultTreeView->model()->rowCount(); + return m_items.count() > 0; } void SearchResultWindow::goToNext() { - if (!m_searchResultTreeView->model()->rowCount()) + if (m_items.count() == 0) return; QModelIndex idx = m_searchResultTreeView->model()->next(m_searchResultTreeView->currentIndex()); if (idx.isValid()) { diff --git a/src/plugins/find/searchresultwindow.h b/src/plugins/find/searchresultwindow.h index d806bf67bf6be7fe29e15abd3e3b81e94b77d4cc..093eb26884359c4f6a7da2ed9f94424eaad3a9a8 100644 --- a/src/plugins/find/searchresultwindow.h +++ b/src/plugins/find/searchresultwindow.h @@ -47,19 +47,25 @@ namespace Find { class SearchResultWindow; -class FIND_EXPORT ResultWindowItem : public QObject +struct FIND_EXPORT SearchResultItem { - Q_OBJECT + QString fileName; + int lineNumber; + QString lineText; + int searchTermStart; + int searchTermLength; + int index; + QVariant userData; + // whatever information we also need here +}; -public: - void setData(const QVariant &data); - QVariant data() const; +class FIND_EXPORT SearchResult : public QObject +{ + Q_OBJECT signals: - void activated(const QString &fileName, int lineNumber, int column); - -private: - QVariant m_data; + void activated(const Find::SearchResultItem &item); + void replaceButtonClicked(const QString &replaceText, const QList<Find::SearchResultItem> &checkedItems); friend class SearchResultWindow; }; @@ -69,6 +75,11 @@ class FIND_EXPORT SearchResultWindow : public Core::IOutputPane Q_OBJECT public: + enum SearchMode { + SearchOnly, + SearchAndReplace + }; + SearchResultWindow(); ~SearchResultWindow(); @@ -90,30 +101,30 @@ public: void goToPrev(); bool canNavigate(); + void setTextEditorFont(const QFont &font); + void setShowReplaceUI(bool show); bool isShowingReplaceUI() const; - QList<ResultWindowItem *> selectedItems() const; - void setTextEditorFont(const QFont &font); - -signals: - void replaceButtonClicked(const QString &replaceText); + // search result object only lives till next startnewsearch call + SearchResult *startNewSearch(SearchMode searchOrSearchAndReplace = SearchOnly); public slots: void clearContents(); void showNoMatchesFound(); - ResultWindowItem *addResult(const QString &fileName, int lineNumber, const QString &lineText, - int searchTermStart, int searchTermLength); + void addResult(const QString &fileName, int lineNumber, const QString &lineText, + int searchTermStart, int searchTermLength, const QVariant &userData = QVariant()); private slots: void handleExpandCollapseToolButton(bool checked); - void handleJumpToSearchResult(int index, const QString &fileName, int lineNumber, - int searchTermStart, int searchTermLength); + void handleJumpToSearchResult(int index, bool checked); void handleReplaceButton(); + void setReplaceUIEnabled(bool enabled); private: void readSettings(); void writeSettings(); + QList<SearchResultItem> checkedItems() const; Internal::SearchResultTreeView *m_searchResultTreeView; QListWidget *m_noMatchesFoundDisplay; @@ -123,7 +134,8 @@ private: QToolButton *m_replaceButton; static const bool m_initiallyExpand = false; QStackedWidget *m_widget; - QList<ResultWindowItem *> m_items; + SearchResult *m_currentSearch; + QList<SearchResultItem> m_items; bool m_isShowingReplaceUI; }; diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp index 03e24d1b6bb971f19038f43d72058f87b5c736a3..bc7c96138b1ef0559ae04462f0160a8a9aff4de6 100644 --- a/src/plugins/genericprojectmanager/genericproject.cpp +++ b/src/plugins/genericprojectmanager/genericproject.cpp @@ -587,7 +587,7 @@ GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project) fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); // build directory - m_pathChooser = new Core::Utils::PathChooser(this); + m_pathChooser = new Utils::PathChooser(this); m_pathChooser->setEnabled(true); fl->addRow(tr("Build directory:"), m_pathChooser); connect(m_pathChooser, SIGNAL(changed(QString)), this, SLOT(buildDirectoryChanged())); diff --git a/src/plugins/genericprojectmanager/genericproject.h b/src/plugins/genericprojectmanager/genericproject.h index 3d87082df4e10303ebac02b72c2f9acc91fe4c6e..8b096fc133688407383abca51f7736bc6a37d2eb 100644 --- a/src/plugins/genericprojectmanager/genericproject.h +++ b/src/plugins/genericprojectmanager/genericproject.h @@ -45,11 +45,9 @@ class QPushButton; class QStringListModel; QT_END_NAMESPACE -namespace Core { namespace Utils { class PathChooser; } -} namespace GenericProjectManager { namespace Internal { @@ -204,7 +202,7 @@ private Q_SLOTS: private: GenericProject *m_project; - Core::Utils::PathChooser *m_pathChooser; + Utils::PathChooser *m_pathChooser; QString m_buildConfiguration; }; diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.cpp b/src/plugins/genericprojectmanager/genericprojectwizard.cpp index 0ee4d297e9635c0ed8451520546c85a843b326e8..46bdecf414dcf9615786ca9e9cbe90482bb9a950 100644 --- a/src/plugins/genericprojectmanager/genericprojectwizard.cpp +++ b/src/plugins/genericprojectmanager/genericprojectwizard.cpp @@ -46,7 +46,7 @@ #include <QtGui/QTreeView> using namespace GenericProjectManager::Internal; -using namespace Core::Utils; +using namespace Utils; namespace { @@ -209,7 +209,7 @@ void GenericProjectWizardDialog::initializePage(int id) Q_UNUSED(id) #if 0 if (id == m_secondPageId) { - using namespace Core::Utils; + using namespace Utils; const QString projectPath = m_pathChooser->path(); @@ -221,7 +221,7 @@ void GenericProjectWizardDialog::initializePage(int id) bool GenericProjectWizardDialog::validateCurrentPage() { - using namespace Core::Utils; + using namespace Utils; #if 0 if (currentId() == m_secondPageId) { diff --git a/src/plugins/genericprojectmanager/genericprojectwizard.h b/src/plugins/genericprojectmanager/genericprojectwizard.h index 8b72a179d42748e615098b715a58a7b1fbcef5d8..a5d3b26dcf804c1b947e03c0334b305ec0c9548b 100644 --- a/src/plugins/genericprojectmanager/genericprojectwizard.h +++ b/src/plugins/genericprojectmanager/genericprojectwizard.h @@ -44,13 +44,11 @@ class QStringList; class QTreeView; QT_END_NAMESPACE -namespace Core { namespace Utils { class FileWizardPage; } // namespace Utils -} // namespace Core namespace GenericProjectManager { namespace Internal { @@ -79,7 +77,7 @@ protected: private: int m_secondPageId; - Core::Utils::FileWizardPage *m_firstPage; + Utils::FileWizardPage *m_firstPage; QTreeView *m_dirView; QDirModel *m_dirModel; diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 38b9b52f91f2c2188457c51df77b146f5f09783e..f08e8b65d7dca060c6815b2e464fe5db43d48f0e 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -238,7 +238,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) Core::Command *command; - m_diffAction = new Core::Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Core::Utils::ParameterAction::AlwaysEnabled, this); + m_diffAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); command = actionManager->registerAction(m_diffAction, "Git.Diff", globalcontext); command->setAttribute(Core::Command::CA_UpdateText); #ifndef Q_WS_MAC @@ -247,7 +247,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_diffAction, SIGNAL(triggered()), this, SLOT(diffCurrentFile())); gitContainer->addAction(command); - m_statusAction = new Core::Utils::ParameterAction(tr("File Status"), tr("Status Related to \"%1\""), Core::Utils::ParameterAction::AlwaysEnabled, this); + m_statusAction = new Utils::ParameterAction(tr("File Status"), tr("Status Related to \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); command = actionManager->registerAction(m_statusAction, "Git.Status", globalcontext); #ifndef Q_WS_MAC command->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+S"))); @@ -256,7 +256,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_statusAction, SIGNAL(triggered()), this, SLOT(statusFile())); gitContainer->addAction(command); - m_logAction = new Core::Utils::ParameterAction(tr("Log File"), tr("Log of \"%1\""), Core::Utils::ParameterAction::AlwaysEnabled, this); + m_logAction = new Utils::ParameterAction(tr("Log File"), tr("Log of \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); command = actionManager->registerAction(m_logAction, "Git.Log", globalcontext); #ifndef Q_WS_MAC command->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+L"))); @@ -265,7 +265,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_logAction, SIGNAL(triggered()), this, SLOT(logFile())); gitContainer->addAction(command); - m_blameAction = new Core::Utils::ParameterAction(tr("Blame"), tr("Blame for \"%1\""), Core::Utils::ParameterAction::AlwaysEnabled, this); + m_blameAction = new Utils::ParameterAction(tr("Blame"), tr("Blame for \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); command = actionManager->registerAction(m_blameAction, "Git.Blame", globalcontext); #ifndef Q_WS_MAC command->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+B"))); @@ -274,7 +274,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_blameAction, SIGNAL(triggered()), this, SLOT(blameFile())); gitContainer->addAction(command); - m_undoFileAction = new Core::Utils::ParameterAction(tr("Undo Changes"), tr("Undo Changes for \"%1\""), Core::Utils::ParameterAction::AlwaysEnabled, this); + m_undoFileAction = new Utils::ParameterAction(tr("Undo Changes"), tr("Undo Changes for \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); command = actionManager->registerAction(m_undoFileAction, "Git.Undo", globalcontext); #ifndef Q_WS_MAC command->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+U"))); @@ -283,7 +283,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_undoFileAction, SIGNAL(triggered()), this, SLOT(undoFileChanges())); gitContainer->addAction(command); - m_stageAction = new Core::Utils::ParameterAction(tr("Stage File for Commit"), tr("Stage \"%1\" for Commit"), Core::Utils::ParameterAction::AlwaysEnabled, this); + m_stageAction = new Utils::ParameterAction(tr("Stage File for Commit"), tr("Stage \"%1\" for Commit"), Utils::ParameterAction::AlwaysEnabled, this); command = actionManager->registerAction(m_stageAction, "Git.Stage", globalcontext); #ifndef Q_WS_MAC command->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+A"))); @@ -292,7 +292,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_stageAction, SIGNAL(triggered()), this, SLOT(stageFile())); gitContainer->addAction(command); - m_unstageAction = new Core::Utils::ParameterAction(tr("Unstage File from Commit"), tr("Unstage \"%1\" from Commit"), Core::Utils::ParameterAction::AlwaysEnabled, this); + m_unstageAction = new Utils::ParameterAction(tr("Unstage File from Commit"), tr("Unstage \"%1\" from Commit"), Utils::ParameterAction::AlwaysEnabled, this); command = actionManager->registerAction(m_unstageAction, "Git.Unstage", globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_unstageAction, SIGNAL(triggered()), this, SLOT(unstageFile())); @@ -300,7 +300,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) gitContainer->addAction(createSeparator(actionManager, globalcontext, QLatin1String("Git.Sep.Project"), this)); - m_diffProjectAction = new Core::Utils::ParameterAction(tr("Diff Current Project"), tr("Diff Project \"%1\""), Core::Utils::ParameterAction::AlwaysEnabled, this); + m_diffProjectAction = new Utils::ParameterAction(tr("Diff Current Project"), tr("Diff Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); command = actionManager->registerAction(m_diffProjectAction, "Git.DiffProject", globalcontext); #ifndef Q_WS_MAC command->setDefaultKeySequence(QKeySequence("Alt+G,Alt+Shift+D")); @@ -309,13 +309,13 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffCurrentProject())); gitContainer->addAction(command); - m_statusProjectAction = new Core::Utils::ParameterAction(tr("Project Status"), tr("Status Project \"%1\""), Core::Utils::ParameterAction::AlwaysEnabled, this); + m_statusProjectAction = new Utils::ParameterAction(tr("Project Status"), tr("Status Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); command = actionManager->registerAction(m_statusProjectAction, "Git.StatusProject", globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_statusProjectAction, SIGNAL(triggered()), this, SLOT(statusProject())); gitContainer->addAction(command); - m_logProjectAction = new Core::Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Core::Utils::ParameterAction::AlwaysEnabled, this); + m_logProjectAction = new Utils::ParameterAction(tr("Log Project"), tr("Log Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); command = actionManager->registerAction(m_logProjectAction, "Git.LogProject", globalcontext); #ifndef Q_WS_MAC command->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+K"))); diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h index 116d8f6638bb120ef77bac5bb18fb1ac4477fa7a..4f934a893936a4f5dda262656a971f165e8a1348 100644 --- a/src/plugins/git/gitplugin.h +++ b/src/plugins/git/gitplugin.h @@ -50,10 +50,10 @@ namespace Core { class IEditorFactory; class ICore; class IVersionControl; +} namespace Utils { class ParameterAction; } -} // namespace Core namespace Git { namespace Internal { @@ -133,18 +133,18 @@ private: static GitPlugin *m_instance; Core::ICore *m_core; - Core::Utils::ParameterAction *m_diffAction; - Core::Utils::ParameterAction *m_diffProjectAction; - Core::Utils::ParameterAction *m_statusAction; - Core::Utils::ParameterAction *m_statusProjectAction; - Core::Utils::ParameterAction *m_logAction; - Core::Utils::ParameterAction *m_blameAction; - Core::Utils::ParameterAction *m_logProjectAction; - Core::Utils::ParameterAction *m_undoFileAction; + Utils::ParameterAction *m_diffAction; + Utils::ParameterAction *m_diffProjectAction; + Utils::ParameterAction *m_statusAction; + Utils::ParameterAction *m_statusProjectAction; + Utils::ParameterAction *m_logAction; + Utils::ParameterAction *m_blameAction; + Utils::ParameterAction *m_logProjectAction; + Utils::ParameterAction *m_undoFileAction; QAction *m_undoProjectAction; QAction *m_showAction; - Core::Utils::ParameterAction *m_stageAction; - Core::Utils::ParameterAction *m_unstageAction; + Utils::ParameterAction *m_stageAction; + Utils::ParameterAction *m_unstageAction; QAction *m_commitAction; QAction *m_pullAction; QAction *m_pushAction; diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp index 971282247e3cf2c8de5b25db3cb3664c0bc4ec26..cffe8b351a357df0fb44d3781ed752a9ff0c320b 100644 --- a/src/plugins/git/gitsettings.cpp +++ b/src/plugins/git/gitsettings.cpp @@ -102,7 +102,7 @@ QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const if (!adoptPath) return binary; // Search in path? - const QString pathBinary = Core::Utils::SynchronousProcess::locateBinary(path, binary); + const QString pathBinary = Utils::SynchronousProcess::locateBinary(path, binary); if (pathBinary.isEmpty()) { if (ok) *ok = false; diff --git a/src/plugins/git/gitsubmiteditorwidget.cpp b/src/plugins/git/gitsubmiteditorwidget.cpp index b12a4f03cc6d8d988b8614993363df69a56805a0..d735611b6eb361ac5d54a52a067097c1055be5b9 100644 --- a/src/plugins/git/gitsubmiteditorwidget.cpp +++ b/src/plugins/git/gitsubmiteditorwidget.cpp @@ -110,7 +110,7 @@ void GitSubmitHighlighter::highlightBlock(const QString &text) // ------------------ GitSubmitEditorWidget::GitSubmitEditorWidget(QWidget *parent) : - Core::Utils::SubmitEditorWidget(parent), + Utils::SubmitEditorWidget(parent), m_gitSubmitPanel(new QWidget) { m_gitSubmitPanelUi.setupUi(m_gitSubmitPanel); diff --git a/src/plugins/git/gitsubmiteditorwidget.h b/src/plugins/git/gitsubmiteditorwidget.h index faadcc5a1650fc78f16036e864a9423abd9dcd5f..9abf9335850f8a4a824382a1349a6a57c015141a 100644 --- a/src/plugins/git/gitsubmiteditorwidget.h +++ b/src/plugins/git/gitsubmiteditorwidget.h @@ -47,7 +47,7 @@ struct GitSubmitEditorPanelData; * remaining un-added and untracked files will be added 'unchecked' for the * user to click. */ -class GitSubmitEditorWidget : public Core::Utils::SubmitEditorWidget +class GitSubmitEditorWidget : public Utils::SubmitEditorWidget { public: diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 63375b7ef00fbbc99bf34554fcee2cd1b6e07ab3..8421dca38d269cb2c2e46fc1a360aafe341dda8a 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -478,7 +478,7 @@ void HelpPlugin::createRightPaneSideBar() hboxLayout->addWidget(rightPaneToolBar); hboxLayout->addStretch(5); hboxLayout->addWidget(closeButton); - Core::Utils::StyledBar *w = new Core::Utils::StyledBar; + Utils::StyledBar *w = new Utils::StyledBar; w->setLayout(hboxLayout); connect(closeButton, SIGNAL(clicked()), this, SLOT(slotHideRightPane())); @@ -633,9 +633,9 @@ void HelpPlugin::extensionsInitialized() hc.addCustomFilter(tr("Unfiltered"), QStringList()); hc.setCustomValue(key, 1); } - m_helpEngine->blockSignals(true); + bool blocked = m_helpEngine->blockSignals(true); m_helpEngine->setCurrentFilter(tr("Unfiltered")); - m_helpEngine->blockSignals(false); + m_helpEngine->blockSignals(blocked); needsSetup = true; } diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 0777d21235b3c9ab51fd79542616d8217bde7e71..60f0d98522d9dd49f567b98e012e9dc1899cc0da 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -257,7 +257,7 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess Core::Command *command; QAction *tmpaction; - m_editAction = new Core::Utils::ParameterAction(tr("Edit"), tr("Edit \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_editAction = new Utils::ParameterAction(tr("Edit"), tr("Edit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = am->registerAction(m_editAction, CMD_ID_EDIT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); #ifndef Q_WS_MAC @@ -267,7 +267,7 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess connect(m_editAction, SIGNAL(triggered()), this, SLOT(openCurrentFile())); mperforce->addAction(command); - m_addAction = new Core::Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = am->registerAction(m_addAction, CMD_ID_ADD, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); #ifndef Q_WS_MAC @@ -277,14 +277,14 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile())); mperforce->addAction(command); - m_deleteAction = new Core::Utils::ParameterAction(tr("Delete"), tr("Delete \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_deleteAction = new Utils::ParameterAction(tr("Delete"), tr("Delete \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = am->registerAction(m_deleteAction, CMD_ID_DELETE_FILE, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultText(tr("Delete File")); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(deleteCurrentFile())); mperforce->addAction(command); - m_revertAction = new Core::Utils::ParameterAction(tr("Revert"), tr("Revert \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_revertAction = new Utils::ParameterAction(tr("Revert"), tr("Revert \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = am->registerAction(m_revertAction, CMD_ID_REVERT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); #ifndef Q_WS_MAC @@ -299,7 +299,7 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess command = am->registerAction(tmpaction, QLatin1String("Perforce.Sep.Edit"), globalcontext); mperforce->addAction(command); - m_diffCurrentAction = new Core::Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_diffCurrentAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = am->registerAction(m_diffCurrentAction, CMD_ID_DIFF_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultText(tr("Diff Current File")); @@ -307,7 +307,7 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess mperforce->addAction(command); const QString diffProjectDefaultText = tr("Diff Current Project/Session"); - m_diffProjectAction = new Core::Utils::ParameterAction(diffProjectDefaultText, tr("Diff Project \"%1\""), Core::Utils::ParameterAction::AlwaysEnabled, this); + m_diffProjectAction = new Utils::ParameterAction(diffProjectDefaultText, tr("Diff Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); command = am->registerAction(m_diffProjectAction, CMD_ID_DIFF_PROJECT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); #ifndef Q_WS_MAC @@ -347,7 +347,7 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess mperforce->addAction(command); const QString updateProjectDefaultText = tr("Update Current Project/Session"); - m_updateProjectAction = new Core::Utils::ParameterAction(updateProjectDefaultText, tr("Update Project \"%1\""), Core::Utils::ParameterAction::AlwaysEnabled, this); + m_updateProjectAction = new Utils::ParameterAction(updateProjectDefaultText, tr("Update Project \"%1\""), Utils::ParameterAction::AlwaysEnabled, this); command = am->registerAction(m_updateProjectAction, CMD_ID_UPDATE_PROJECT, globalcontext); command->setDefaultText(updateProjectDefaultText); command->setAttribute(Core::Command::CA_UpdateText); @@ -364,7 +364,7 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess connect(m_describeAction, SIGNAL(triggered()), this, SLOT(describeChange())); mperforce->addAction(command); - m_annotateCurrentAction = new Core::Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = am->registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); command->setDefaultText(tr("Annotate Current File")); @@ -376,7 +376,7 @@ bool PerforcePlugin::initialize(const QStringList &arguments, QString *errorMess connect(m_annotateAction, SIGNAL(triggered()), this, SLOT(annotate())); mperforce->addAction(command); - m_filelogCurrentAction = new Core::Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = am->registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); #ifndef Q_WS_MAC @@ -833,7 +833,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args, outputWindow->appendCommand(formatCommand(m_settings.p4Command(), actualArgs)); // Run, connect stderr to the output window - Core::Utils::SynchronousProcess process; + Utils::SynchronousProcess process; process.setTimeout(p4Timeout); process.setStdOutCodec(outputCodec); process.setEnvironment(environment()); @@ -850,7 +850,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args, connect(&process, SIGNAL(stdOutBuffered(QString,bool)), outputWindow, SLOT(append(QString))); } - const Core::Utils::SynchronousProcessResponse sp_resp = process.run(m_settings.p4Command(), actualArgs); + const Utils::SynchronousProcessResponse sp_resp = process.run(m_settings.p4Command(), actualArgs); if (Perforce::Constants::debug) qDebug() << sp_resp; @@ -858,19 +858,19 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args, response.stdErr = sp_resp.stdErr; response.stdOut = sp_resp.stdOut; switch (sp_resp.result) { - case Core::Utils::SynchronousProcessResponse::Finished: + case Utils::SynchronousProcessResponse::Finished: response.error = false; break; - case Core::Utils::SynchronousProcessResponse::FinishedError: + case Utils::SynchronousProcessResponse::FinishedError: response.message = tr("The process terminated with exit code %1.").arg(sp_resp.exitCode); break; - case Core::Utils::SynchronousProcessResponse::TerminatedAbnormally: + case Utils::SynchronousProcessResponse::TerminatedAbnormally: response.message = tr("The process terminated abnormally."); break; - case Core::Utils::SynchronousProcessResponse::StartFailed: + case Utils::SynchronousProcessResponse::StartFailed: response.message = tr("Could not start perforce '%1'. Please check your settings in the preferences.").arg(m_settings.p4Command()); break; - case Core::Utils::SynchronousProcessResponse::Hang: + case Utils::SynchronousProcessResponse::Hang: response.message = tr("Perforce did not respond within timeout limit (%1 ms).").arg(p4Timeout ); break; } diff --git a/src/plugins/perforce/perforceplugin.h b/src/plugins/perforce/perforceplugin.h index 761fb96799c3b2740d0e57eb95c4e2f4443b5aef..275903a9c595c60bd56c77465412c1799673c069 100644 --- a/src/plugins/perforce/perforceplugin.h +++ b/src/plugins/perforce/perforceplugin.h @@ -48,10 +48,8 @@ class QAction; class QTextCodec; QT_END_NAMESPACE -namespace Core { - namespace Utils { - class ParameterAction; - } +namespace Utils { + class ParameterAction; } namespace Perforce { @@ -168,22 +166,22 @@ private: ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; - Core::Utils::ParameterAction *m_editAction; - Core::Utils::ParameterAction *m_addAction; - Core::Utils::ParameterAction *m_deleteAction; + Utils::ParameterAction *m_editAction; + Utils::ParameterAction *m_addAction; + Utils::ParameterAction *m_deleteAction; QAction *m_openedAction; - Core::Utils::ParameterAction *m_revertAction; - Core::Utils::ParameterAction *m_diffCurrentAction; - Core::Utils::ParameterAction *m_diffProjectAction; - Core::Utils::ParameterAction *m_updateProjectAction; + Utils::ParameterAction *m_revertAction; + Utils::ParameterAction *m_diffCurrentAction; + Utils::ParameterAction *m_diffProjectAction; + Utils::ParameterAction *m_updateProjectAction; QAction *m_diffAllAction; QAction *m_resolveAction; QAction *m_submitAction; QAction *m_pendingAction; QAction *m_describeAction; - Core::Utils::ParameterAction *m_annotateCurrentAction; + Utils::ParameterAction *m_annotateCurrentAction; QAction *m_annotateAction; - Core::Utils::ParameterAction *m_filelogCurrentAction; + Utils::ParameterAction *m_filelogCurrentAction; QAction *m_filelogAction; QAction *m_submitCurrentLogAction; QAction *m_updateAllAction; diff --git a/src/plugins/perforce/perforcesubmiteditorwidget.cpp b/src/plugins/perforce/perforcesubmiteditorwidget.cpp index 9ef31d562674e1df4bb068583d94bfc8f75b8980..b11ba12b81b9dd9862090ee21738123c55c74404 100644 --- a/src/plugins/perforce/perforcesubmiteditorwidget.cpp +++ b/src/plugins/perforce/perforcesubmiteditorwidget.cpp @@ -33,7 +33,7 @@ namespace Perforce { namespace Internal { PerforceSubmitEditorWidget::PerforceSubmitEditorWidget(QWidget *parent) : - Core::Utils::SubmitEditorWidget(parent), + Utils::SubmitEditorWidget(parent), m_submitPanel(new QGroupBox) { m_submitPanelUi.setupUi(m_submitPanel); diff --git a/src/plugins/perforce/perforcesubmiteditorwidget.h b/src/plugins/perforce/perforcesubmiteditorwidget.h index a5240cb94ecefb6d945151c5f3cca594c1e58fe5..6afeca66aa99b398620b5c2599bdd77b5d4f44a5 100644 --- a/src/plugins/perforce/perforcesubmiteditorwidget.h +++ b/src/plugins/perforce/perforcesubmiteditorwidget.h @@ -38,7 +38,7 @@ namespace Internal { /* Submit editor widget with additional information pane * at the top. */ -class PerforceSubmitEditorWidget : public Core::Utils::SubmitEditorWidget +class PerforceSubmitEditorWidget : public Utils::SubmitEditorWidget { public: diff --git a/src/plugins/perforce/settingspage.cpp b/src/plugins/perforce/settingspage.cpp index f2e01fd90c33ba58b4804c2db2a2ea63dac5a674..4fe846f8ead560a129d949123aa999b691742575 100644 --- a/src/plugins/perforce/settingspage.cpp +++ b/src/plugins/perforce/settingspage.cpp @@ -38,7 +38,7 @@ #include <QtGui/QFileDialog> using namespace Perforce::Internal; -using namespace Core::Utils; +using namespace Utils; SettingsPageWidget::SettingsPageWidget(QWidget *parent) : QWidget(parent) diff --git a/src/plugins/perforce/settingspage.ui b/src/plugins/perforce/settingspage.ui index 5eccd25c95000aad23d9ad93755a4abb727b2b2e..fe25bcf5844c1626f696d89c2d91ad5035887cc6 100644 --- a/src/plugins/perforce/settingspage.ui +++ b/src/plugins/perforce/settingspage.ui @@ -51,7 +51,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="Core::Utils::PathChooser" name="pathChooser"/> + <widget class="Utils::PathChooser" name="pathChooser"/> </item> <item row="1" column="0" colspan="2"> <widget class="QCheckBox" name="defaultCheckBox"> @@ -161,7 +161,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/projectexplorer/applicationlauncher.h b/src/plugins/projectexplorer/applicationlauncher.h index f11fa7c82d1c8bf9ab00cc79245b4420bac7be29..937f9409a9971d7069da08c88f5038e44a9afc48 100644 --- a/src/plugins/projectexplorer/applicationlauncher.h +++ b/src/plugins/projectexplorer/applicationlauncher.h @@ -39,11 +39,9 @@ #include <QtCore/QTextCodec> #endif -namespace Core { namespace Utils { class ConsoleProcess; } -} namespace ProjectExplorer { @@ -92,7 +90,7 @@ private slots: private: QProcess *m_guiProcess; - Core::Utils::ConsoleProcess *m_consoleProcess; + Utils::ConsoleProcess *m_consoleProcess; Mode m_currentMode; #ifdef Q_OS_WIN diff --git a/src/plugins/projectexplorer/applicationlauncher_win.cpp b/src/plugins/projectexplorer/applicationlauncher_win.cpp index 7880465a2f25ad6f1ee5ebea950222a4eb06bc73..2647ad150726024e3de3e224fedf8a8e919e3651 100644 --- a/src/plugins/projectexplorer/applicationlauncher_win.cpp +++ b/src/plugins/projectexplorer/applicationlauncher_win.cpp @@ -35,7 +35,7 @@ using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; -using namespace Core::Utils; +using namespace Utils; ApplicationLauncher::ApplicationLauncher(QObject *parent) : QObject(parent) diff --git a/src/plugins/projectexplorer/applicationlauncher_x11.cpp b/src/plugins/projectexplorer/applicationlauncher_x11.cpp index 87291dd252410400499a51886a41bd13dbc39dd4..f4a0bb018a4da0910ac8ecca9ec834426b988ad8 100644 --- a/src/plugins/projectexplorer/applicationlauncher_x11.cpp +++ b/src/plugins/projectexplorer/applicationlauncher_x11.cpp @@ -35,7 +35,7 @@ #include <QtCore/QTimer> using namespace ProjectExplorer; -using namespace Core::Utils; +using namespace Utils; ApplicationLauncher::ApplicationLauncher(QObject *parent) : QObject(parent) diff --git a/src/plugins/projectexplorer/buildmanager.cpp b/src/plugins/projectexplorer/buildmanager.cpp index cc3fa45a9ecfe50acaa92b70ec55e742077b4a1b..54f821dd7e16375816caa604273d11b59cdf74c7 100644 --- a/src/plugins/projectexplorer/buildmanager.cpp +++ b/src/plugins/projectexplorer/buildmanager.cpp @@ -189,8 +189,10 @@ void BuildManager::gotoTaskWindow() void BuildManager::startBuildQueue() { - if (m_buildQueue.isEmpty()) + if (m_buildQueue.isEmpty()) { + emit buildQueueFinished(true); return; + } if (!m_running) { // Progress Reporting Core::ProgressManager *progressManager = Core::ICore::instance()->progressManager(); @@ -332,9 +334,11 @@ void BuildManager::buildProjects(const QList<Project *> &projects, const QList<Q end = projects.constEnd(); for (it = projects.constBegin(); it != end; ++it, ++cit) { - QList<BuildStep *> buildSteps = (*it)->buildSteps(); - foreach (BuildStep *bs, buildSteps) { - buildQueueAppend(bs, *cit); + if (*cit != QString::null) { + QList<BuildStep *> buildSteps = (*it)->buildSteps(); + foreach (BuildStep *bs, buildSteps) { + buildQueueAppend(bs, *cit); + } } } startBuildQueue(); diff --git a/src/plugins/projectexplorer/buildprogress.cpp b/src/plugins/projectexplorer/buildprogress.cpp index 9c6ab93799c99720c16b7fc13805911954ba1c9d..edc3576b71507cff7b0323b3c7c2b85636a0f390 100644 --- a/src/plugins/projectexplorer/buildprogress.cpp +++ b/src/plugins/projectexplorer/buildprogress.cpp @@ -62,12 +62,12 @@ BuildProgress::BuildProgress(TaskWindow *taskWindow) // ### TODO this setup should be done by style QFont f = this->font(); - f.setPointSizeF(StyleHelper::sidebarFontSize()); + f.setPointSizeF(Utils::StyleHelper::sidebarFontSize()); f.setBold(true); m_errorLabel->setFont(f); m_warningLabel->setFont(f); - m_errorLabel->setPalette(StyleHelper::sidebarFontPalette(m_errorLabel->palette())); - m_warningLabel->setPalette(StyleHelper::sidebarFontPalette(m_warningLabel->palette())); + m_errorLabel->setPalette(Utils::StyleHelper::sidebarFontPalette(m_errorLabel->palette())); + m_warningLabel->setPalette(Utils::StyleHelper::sidebarFontPalette(m_warningLabel->palette())); m_errorIcon->setAlignment(Qt::AlignRight); m_warningIcon->setAlignment(Qt::AlignRight); diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp index b6fe770d543112d287fb2ee0088e4fb92237f20c..82e187367b6a11105a34ee1e448236a8c63c900e 100644 --- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp @@ -220,7 +220,7 @@ void BuildSettingsWidget::updateBuildSettings() // TODO save position, entry from combbox // Delete old tree items - m_buildConfigurationComboBox->blockSignals(true); + bool blocked = m_buildConfigurationComboBox->blockSignals(true); m_buildConfigurationComboBox->clear(); m_subWidgets->clear(); @@ -245,7 +245,7 @@ void BuildSettingsWidget::updateBuildSettings() m_buildConfigurationComboBox->setCurrentIndex(m_buildConfigurationComboBox->count() - 1); } - m_buildConfigurationComboBox->blockSignals(false); + m_buildConfigurationComboBox->blockSignals(blocked); // TODO Restore position, entry from combbox // TODO? select entry from combobox ? diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp index 6755ccc835040c822d848fa22b06259e6dc4ef90..4839443baeabd718ecaa008faadfc57d587b5a02 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.cpp @@ -53,11 +53,11 @@ using namespace ProjectExplorer; using namespace ProjectExplorer::Internal; -class CustomDirectoryPathChooser : public Core::Utils::PathChooser +class CustomDirectoryPathChooser : public Utils::PathChooser { public: CustomDirectoryPathChooser(QWidget *parent) - : Core::Utils::PathChooser(parent) + : Utils::PathChooser(parent) { } virtual bool validatePath(const QString &path, QString *errorMessage = 0) @@ -78,8 +78,8 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE m_userName = new QLineEdit(this); layout->addRow(tr("Name:"), m_userName); - m_executableChooser = new Core::Utils::PathChooser(this); - m_executableChooser->setExpectedKind(Core::Utils::PathChooser::Command); + m_executableChooser = new Utils::PathChooser(this); + m_executableChooser->setExpectedKind(Utils::PathChooser::Command); layout->addRow(tr("Executable:"), m_executableChooser); m_commandLineArgumentsLineEdit = new QLineEdit(this); @@ -87,7 +87,7 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE layout->addRow(tr("Arguments:"), m_commandLineArgumentsLineEdit); m_workingDirectory = new CustomDirectoryPathChooser(this); - m_workingDirectory->setExpectedKind(Core::Utils::PathChooser::Directory); + m_workingDirectory->setExpectedKind(Utils::PathChooser::Directory); layout->addRow(tr("Working Directory:"), m_workingDirectory); m_useTerminalCheck = new QCheckBox(tr("Run in &Terminal"), this); diff --git a/src/plugins/projectexplorer/customexecutablerunconfiguration.h b/src/plugins/projectexplorer/customexecutablerunconfiguration.h index 2387f9ca72e1245a680e3357d5209eae2f2b4df4..46c871bd67da66d57d5018e302c743f03cc51d44 100644 --- a/src/plugins/projectexplorer/customexecutablerunconfiguration.h +++ b/src/plugins/projectexplorer/customexecutablerunconfiguration.h @@ -33,7 +33,6 @@ #include "applicationrunconfiguration.h" #include <QtGui/QWidget> - QT_BEGIN_NAMESPACE class QCheckBox; class QLineEdit; @@ -44,12 +43,8 @@ QT_END_NAMESPACE namespace Utils { class DetailsWidget; -} -namespace Core { -namespace Utils { class PathChooser; } -} namespace ProjectExplorer { class EnvironmentWidget; @@ -172,10 +167,10 @@ private slots: private: bool m_ignoreChange; CustomExecutableRunConfiguration *m_runConfiguration; - Core::Utils::PathChooser *m_executableChooser; + Utils::PathChooser *m_executableChooser; QLineEdit *m_userName; QLineEdit *m_commandLineArgumentsLineEdit; - Core::Utils::PathChooser *m_workingDirectory; + Utils::PathChooser *m_workingDirectory; QCheckBox *m_useTerminalCheck; ProjectExplorer::EnvironmentWidget *m_environmentWidget; QComboBox *m_baseEnvironmentComboBox; diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index 53e5a0f4075374ac26ddd5a0be636d0426233c31..163418b0dbb001c35ec386fc5344ed4ef5712882 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -139,7 +139,7 @@ void FolderNavigationWidget::setCurrentFile(const QString &filePath) QString dir = QFileInfo(filePath).path(); if (dir.isEmpty()) - dir = Core::Utils::PathChooser::homePath(); + dir = Utils::PathChooser::homePath(); QModelIndex dirIndex = m_dirModel->index(dir); QModelIndex fileIndex = m_dirModel->index(filePath); diff --git a/src/plugins/projectexplorer/processstep.cpp b/src/plugins/projectexplorer/processstep.cpp index 7e1f5afb827d24c4b8f091da9dd85daa04b0b07c..15c5b0d17ac981300423e29b8dfd309379ef7182 100644 --- a/src/plugins/projectexplorer/processstep.cpp +++ b/src/plugins/projectexplorer/processstep.cpp @@ -71,7 +71,10 @@ QString ProcessStep::name() void ProcessStep::setDisplayName(const QString &name) { - setValue("ProjectExplorer.ProcessStep.DisplayName", name); + if (name.isEmpty()) + setValue("ProjectExplorer.ProcessStep.DisplayName", QVariant()); + else + setValue("ProjectExplorer.ProcessStep.DisplayName", name); } QString ProcessStep::displayName() @@ -132,7 +135,7 @@ ProcessStepConfigWidget::ProcessStepConfigWidget(ProcessStep *step) : m_step(step) { m_ui.setupUi(this); - m_ui.command->setExpectedKind(Core::Utils::PathChooser::File); + m_ui.command->setExpectedKind(Utils::PathChooser::File); connect(m_ui.command, SIGNAL(changed(QString)), this, SLOT(commandLineEditTextEdited())); connect(m_ui.workingDirectory, SIGNAL(changed(QString)), @@ -148,8 +151,12 @@ ProcessStepConfigWidget::ProcessStepConfigWidget(ProcessStep *step) void ProcessStepConfigWidget::updateDetails() { - m_summaryText = tr("<b>Process Step</b> %1 %2 %3") - .arg(m_step->command(m_buildConfiguration), + QString displayName = m_step->displayName(); + if (displayName.isEmpty()) + displayName = "Custom Process Step"; + m_summaryText = tr("<b>%1</b> %2 %3 %4") + .arg(displayName, + m_step->command(m_buildConfiguration), m_step->arguments(m_buildConfiguration).join(" "), m_step->enabled(m_buildConfiguration) ? "" : tr("(disabled)")); emit updateSummary(); @@ -186,6 +193,7 @@ QString ProcessStepConfigWidget::summaryText() const void ProcessStepConfigWidget::nameLineEditTextEdited() { m_step->setDisplayName(m_ui.nameLineEdit->text()); + emit updateDetails(); } void ProcessStepConfigWidget::commandLineEditTextEdited() diff --git a/src/plugins/projectexplorer/processstep.ui b/src/plugins/projectexplorer/processstep.ui index ed01c90aecc0a1a8bdd74af4c704ea4d78ca4237..8d049ed36352386b8756cdda1df0257f180716f1 100644 --- a/src/plugins/projectexplorer/processstep.ui +++ b/src/plugins/projectexplorer/processstep.ui @@ -43,7 +43,7 @@ </widget> </item> <item row="2" column="1"> - <widget class="Core::Utils::PathChooser" name="command" native="true"/> + <widget class="Utils::PathChooser" name="command" native="true"/> </item> <item row="3" column="0"> <widget class="QLabel" name="workingDirecoryLabel"> @@ -53,7 +53,7 @@ </widget> </item> <item row="3" column="1"> - <widget class="Core::Utils::PathChooser" name="workingDirectory" native="true"/> + <widget class="Utils::PathChooser" name="workingDirectory" native="true"/> </item> <item row="4" column="0"> <widget class="QLabel" name="commandArgumentsLabel"> @@ -69,7 +69,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index f5ba13661dbadaa5b76b3f0e78e6e13047b952f1..034dd07469e73c6c7110ed3222f2f666590ce019 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -126,16 +126,16 @@ struct ProjectExplorerPluginPrivate { #if 0 QAction *m_loadAction; #endif - Core::Utils::ParameterAction *m_unloadAction; + Utils::ParameterAction *m_unloadAction; QAction *m_clearSession; QAction *m_buildProjectOnlyAction; - Core::Utils::ParameterAction *m_buildAction; + Utils::ParameterAction *m_buildAction; QAction *m_buildSessionAction; QAction *m_rebuildProjectOnlyAction; - Core::Utils::ParameterAction *m_rebuildAction; + Utils::ParameterAction *m_rebuildAction; QAction *m_rebuildSessionAction; QAction *m_cleanProjectOnlyAction; - Core::Utils::ParameterAction *m_cleanAction; + Utils::ParameterAction *m_cleanAction; QAction *m_cleanSessionAction; QAction *m_runAction; QAction *m_runActionContextMenu; @@ -508,8 +508,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er this, SLOT(updateRecentProjectMenu())); // unload action - d->m_unloadAction = new Core::Utils::ParameterAction(tr("Close Project"), tr("Close Project \"%1\""), - Core::Utils::ParameterAction::EnabledWithParameter, this); + d->m_unloadAction = new Utils::ParameterAction(tr("Close Project"), tr("Close Project \"%1\""), + Utils::ParameterAction::EnabledWithParameter, this); cmd = am->registerAction(d->m_unloadAction, Constants::UNLOAD, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDefaultText(d->m_unloadAction->text()); @@ -569,8 +569,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD); // build action - d->m_buildAction = new Core::Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""), - Core::Utils::ParameterAction::EnabledWithParameter, this); + d->m_buildAction = new Utils::ParameterAction(tr("Build Project"), tr("Build Project \"%1\""), + Utils::ParameterAction::EnabledWithParameter, this); cmd = am->registerAction(d->m_buildAction, Constants::BUILD, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDefaultText(d->m_buildAction->text()); @@ -579,8 +579,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er mproject->addAction(cmd, Constants::G_PROJECT_BUILD); // rebuild action - d->m_rebuildAction = new Core::Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""), - Core::Utils::ParameterAction::EnabledWithParameter, this); + d->m_rebuildAction = new Utils::ParameterAction(tr("Rebuild Project"), tr("Rebuild Project \"%1\""), + Utils::ParameterAction::EnabledWithParameter, this); cmd = am->registerAction(d->m_rebuildAction, Constants::REBUILD, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDefaultText(d->m_rebuildAction->text()); @@ -588,8 +588,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er mproject->addAction(cmd, Constants::G_PROJECT_BUILD); // clean action - d->m_cleanAction = new Core::Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""), - Core::Utils::ParameterAction::EnabledWithParameter, this); + d->m_cleanAction = new Utils::ParameterAction(tr("Clean Project"), tr("Clean Project \"%1\""), + Utils::ParameterAction::EnabledWithParameter, this); cmd = am->registerAction(d->m_cleanAction, Constants::CLEAN, globalcontext); cmd->setAttribute(Core::Command::CA_UpdateText); cmd->setDefaultText(d->m_cleanAction->text()); @@ -1336,7 +1336,9 @@ void ProjectExplorerPlugin::updateActions() if (debug) qDebug() << "ProjectExplorerPlugin::updateActions"; - bool enableBuildActions = d->m_currentProject && ! (d->m_buildManager->isBuilding(d->m_currentProject)); + bool enableBuildActions = d->m_currentProject + && ! (d->m_buildManager->isBuilding(d->m_currentProject)) + && d->m_currentProject->hasBuildSettings(); bool hasProjects = !d->m_session->projects().isEmpty(); bool building = d->m_buildManager->isBuilding(); QString projectName = d->m_currentProject ? d->m_currentProject->name() : QString(); @@ -1421,8 +1423,13 @@ void ProjectExplorerPlugin::buildProjectOnly() static QStringList configurations(const QList<Project *> &projects) { QStringList result; - foreach (const Project * pro, projects) - result << pro->activeBuildConfiguration()->name(); + foreach (const Project * pro, projects) { + if (BuildConfiguration *bc = pro->activeBuildConfiguration()) { + result << bc->name(); + } else { + result << QString::null; + } + } return result; } @@ -1533,7 +1540,7 @@ void ProjectExplorerPlugin::runProjectImpl(Project *pro) if (!pro) return; - if (d->m_projectExplorerSettings.buildBeforeRun) { + if (d->m_projectExplorerSettings.buildBeforeRun && pro->hasBuildSettings()) { if (saveModifiedFiles()) { d->m_runMode = ProjectExplorer::Constants::RUNMODE; d->m_delayedRunConfiguration = pro->activeRunConfiguration(); @@ -1552,7 +1559,7 @@ void ProjectExplorerPlugin::debugProject() if (!pro || d->m_debuggingRunControl ) return; - if (d->m_projectExplorerSettings.buildBeforeRun) { + if (d->m_projectExplorerSettings.buildBeforeRun && pro->hasBuildSettings()) { if (saveModifiedFiles()) { d->m_runMode = ProjectExplorer::Constants::DEBUGMODE; d->m_delayedRunConfiguration = pro->activeRunConfiguration(); diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index 4fe3b3d6f50ea253adf555e05f89e338905770a3..6066b9e69d80582f8348d0902a84a5cb4600bdb0 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -45,9 +45,10 @@ namespace Core { class IContext; class IMode; class IFileFactory; - namespace Utils { - class ParameterAction; - } +} + +namespace Utils { +class ParameterAction; } namespace ProjectExplorer { diff --git a/src/plugins/projectexplorer/projectmodels.cpp b/src/plugins/projectexplorer/projectmodels.cpp index 55e1a54298217e872853f9de47b69ae9f483c100..b81441121544fc0aa9000ec2dd25f03460d8c57c 100644 --- a/src/plugins/projectexplorer/projectmodels.cpp +++ b/src/plugins/projectexplorer/projectmodels.cpp @@ -243,10 +243,6 @@ QVariant DetailedModel::data(const QModelIndex &index, int role) const } case Qt::FontRole: { QFont font; - if (qobject_cast<ProjectNode*>(folderNode)) { - if (index == this->index(0,0) && m_isStartupProject) - font.setBold(true); - } result = font; break; } diff --git a/src/plugins/projectexplorer/projectmodels.h b/src/plugins/projectexplorer/projectmodels.h index c04a6e2b9acc329d1ca7528658732e56995eda78..32007250ca083a6c0ddaf4d59905af548102aa52 100644 --- a/src/plugins/projectexplorer/projectmodels.h +++ b/src/plugins/projectexplorer/projectmodels.h @@ -98,8 +98,6 @@ private: SessionNode *m_rootNode; mutable QHash<FolderNode*, QList<Node*> > m_childNodes; - bool m_isStartupProject; - FolderNode *m_folderToAddTo; friend class DetailedModelManager; diff --git a/src/plugins/projectexplorer/projectwelcomepagewidget.ui b/src/plugins/projectexplorer/projectwelcomepagewidget.ui index 38558d441bd95fce838aa8b118916cc108403b81..cb94d9b53bc70e787f6f4c8e2419aa45539b8a84 100644 --- a/src/plugins/projectexplorer/projectwelcomepagewidget.ui +++ b/src/plugins/projectexplorer/projectwelcomepagewidget.ui @@ -39,7 +39,7 @@ <number>3</number> </property> <item row="0" column="0" colspan="3"> - <widget class="Core::Utils::WelcomeModeLabel" name="recentSessionsTitleLabel"> + <widget class="Utils::WelcomeModeLabel" name="recentSessionsTitleLabel"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum"> <horstretch>0</horstretch> @@ -52,7 +52,7 @@ </widget> </item> <item row="1" column="0" colspan="3"> - <widget class="Core::Utils::WelcomeModeTreeWidget" name="sessTreeWidget"> + <widget class="Utils::WelcomeModeTreeWidget" name="sessTreeWidget"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -146,7 +146,7 @@ <number>9</number> </property> <item row="0" column="0" colspan="3"> - <widget class="Core::Utils::WelcomeModeLabel" name="projTitleLabel"> + <widget class="Utils::WelcomeModeLabel" name="projTitleLabel"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum"> <horstretch>0</horstretch> @@ -159,7 +159,7 @@ </widget> </item> <item row="1" column="0" colspan="3"> - <widget class="Core::Utils::WelcomeModeTreeWidget" name="projTreeWidget"> + <widget class="Utils::WelcomeModeTreeWidget" name="projTreeWidget"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -244,12 +244,12 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::WelcomeModeTreeWidget</class> + <class>Utils::WelcomeModeTreeWidget</class> <extends>QTreeWidget</extends> <header>utils/welcomemodetreewidget.h</header> </customwidget> <customwidget> - <class>Core::Utils::WelcomeModeLabel</class> + <class>Utils::WelcomeModeLabel</class> <extends>QLabel</extends> <header>utils/welcomemodetreewidget.h</header> </customwidget> diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp index 8e16591d25d0a8a75892b8f2eb7da3eaf565ccbe..326b9ec3961acec693ae9dd3c23a1cb95662cdfe 100644 --- a/src/plugins/projectexplorer/projectwindow.cpp +++ b/src/plugins/projectexplorer/projectwindow.cpp @@ -653,7 +653,7 @@ public: void paintEvent(QPaintEvent *e) { QPainter p(this); - p.fillRect(e->rect(), QBrush(StyleHelper::borderColor())); + p.fillRect(e->rect(), QBrush(Utils::StyleHelper::borderColor())); } }; @@ -704,7 +704,7 @@ ProjectWindow::ProjectWindow(QWidget *parent) QVBoxLayout *topLevelLayout = new QVBoxLayout(this); topLevelLayout->setMargin(0); topLevelLayout->setSpacing(0); - topLevelLayout->addWidget(new Core::Utils::StyledBar(this)); + topLevelLayout->addWidget(new Utils::StyledBar(this)); topLevelLayout->addWidget(m_panelsWidget); diff --git a/src/plugins/projectexplorer/toolchain.cpp b/src/plugins/projectexplorer/toolchain.cpp index 15568937c06568fd9f38966922b0be3a8aa4c6cd..a6cb33ec228128c1cd589a64830b28f2710e6843 100644 --- a/src/plugins/projectexplorer/toolchain.cpp +++ b/src/plugins/projectexplorer/toolchain.cpp @@ -119,8 +119,6 @@ QString ToolChain::toolChainName(ToolChainType tc) return QCoreApplication::translate("ToolChain", "Microsoft Visual C++"); case WINCE: return QCoreApplication::translate("ToolChain", "Windows CE"); - -#ifdef QTCREATOR_WITH_S60 case WINSCW: return QCoreApplication::translate("ToolChain", "WINSCW"); case GCCE: @@ -129,8 +127,6 @@ QString ToolChain::toolChainName(ToolChainType tc) return QCoreApplication::translate("ToolChain", "RVCT (ARMV5)"); case RVCT_ARMV6: return QCoreApplication::translate("ToolChain", "RVCT (ARMV6)"); -#endif - case OTHER: return QCoreApplication::translate("ToolChain", "Other"); case INVALID: diff --git a/src/plugins/projectexplorer/winguiprocess.h b/src/plugins/projectexplorer/winguiprocess.h index c74f4f389ca2d9b31a72f5bb7c5650dc250bd643..460651ff12caecd77a63df25eee23765ec1e44a5 100644 --- a/src/plugins/projectexplorer/winguiprocess.h +++ b/src/plugins/projectexplorer/winguiprocess.h @@ -37,7 +37,7 @@ #include <windows.h> -using namespace Core::Utils; +using namespace Utils; namespace ProjectExplorer { namespace Internal { diff --git a/src/plugins/qmleditor/qmlcodecompletion.cpp b/src/plugins/qmleditor/qmlcodecompletion.cpp index f403b6b15acd0ee10f42c249f0ea46bc724f7d8b..e0e5dac2c05fd9b34c9784a8255b1dde8c5712c4 100644 --- a/src/plugins/qmleditor/qmlcodecompletion.cpp +++ b/src/plugins/qmleditor/qmlcodecompletion.cpp @@ -105,7 +105,7 @@ int QmlCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) continue; TextEditor::CompletionItem item(this); - item.m_text = word; + item.text = word; m_completions.append(item); } } @@ -154,9 +154,9 @@ void QmlCodeCompletion::completions(QList<TextEditor::CompletionItem> *completio const QRegExp regExp(keyRegExp, Qt::CaseSensitive); foreach (TextEditor::CompletionItem item, m_completions) { - if (regExp.indexIn(item.m_text) == 0) { - item.m_relevance = (key.length() > 0 && - item.m_text.startsWith(key, Qt::CaseInsensitive)) ? 1 : 0; + if (regExp.indexIn(item.text) == 0) { + item.relevance = (key.length() > 0 && + item.text.startsWith(key, Qt::CaseInsensitive)) ? 1 : 0; (*completions) << item; } } @@ -165,7 +165,7 @@ void QmlCodeCompletion::completions(QList<TextEditor::CompletionItem> *completio void QmlCodeCompletion::complete(const TextEditor::CompletionItem &item) { - const QString toInsert = item.m_text; + const QString toInsert = item.text; const int length = m_editor->position() - m_startPosition; m_editor->setCurPos(m_startPosition); m_editor->replace(length, toInsert); @@ -178,8 +178,8 @@ bool QmlCodeCompletion::partiallyComplete(const QList<TextEditor::CompletionItem return true; } else { // Compute common prefix - QString firstKey = completionItems.first().m_text; - QString lastKey = completionItems.last().m_text; + QString firstKey = completionItems.first().text; + QString lastKey = completionItems.last().text; const int length = qMin(firstKey.length(), lastKey.length()); firstKey.truncate(length); lastKey.truncate(length); diff --git a/src/plugins/qmleditor/qmleditor.cpp b/src/plugins/qmleditor/qmleditor.cpp index 1b1fb71311e6018077bccc39cb55c746fa24e5dc..d0f57c0ae6a3a82254fa6700b31409791ca4361a 100644 --- a/src/plugins/qmleditor/qmleditor.cpp +++ b/src/plugins/qmleditor/qmleditor.cpp @@ -784,7 +784,7 @@ void ScriptEditor::contextMenuEvent(QContextMenuEvent *e) void ScriptEditor::unCommentSelection() { - Core::Utils::unCommentSelection(this); + Utils::unCommentSelection(this); } } // namespace Internal diff --git a/src/plugins/qmlprojectmanager/qmlnewprojectwizard.cpp b/src/plugins/qmlprojectmanager/qmlnewprojectwizard.cpp index febfb21521af9e10bebd27b154a70af101b716c2..1cb73470937dc1cce5ce7e5de44dff9c351d5e63 100644 --- a/src/plugins/qmlprojectmanager/qmlnewprojectwizard.cpp +++ b/src/plugins/qmlprojectmanager/qmlnewprojectwizard.cpp @@ -47,7 +47,7 @@ #include <QtGui/QTreeView> using namespace QmlProjectManager::Internal; -using namespace Core::Utils; +using namespace Utils; namespace { @@ -124,7 +124,7 @@ QmlNewProjectWizardDialog::QmlNewProjectWizardDialog(QWidget *parent) { setWindowTitle(tr("New QML Project")); - m_introPage = new Core::Utils::ProjectIntroPage(); + m_introPage = new Utils::ProjectIntroPage(); m_introPage->setDescription(tr("This wizard generates a QML application project.")); addPage(m_introPage); diff --git a/src/plugins/qmlprojectmanager/qmlnewprojectwizard.h b/src/plugins/qmlprojectmanager/qmlnewprojectwizard.h index acc8db618d51b9e19d7e3ebac5836203c27543ca..52acd2cf9da3a7de559e1f8e5c44695f960cf867 100644 --- a/src/plugins/qmlprojectmanager/qmlnewprojectwizard.h +++ b/src/plugins/qmlprojectmanager/qmlnewprojectwizard.h @@ -43,14 +43,13 @@ class QStringList; class QTreeView; QT_END_NAMESPACE -namespace Core { namespace Utils { class FileWizardPage; class ProjectIntroPage; } // namespace Utils -} // namespace Core + namespace QmlProjectManager { namespace Internal { @@ -79,7 +78,7 @@ protected: private: int m_secondPageId; - Core::Utils::ProjectIntroPage *m_introPage; + Utils::ProjectIntroPage *m_introPage; QTreeView *m_dirView; QDirModel *m_dirModel; diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index e68e8d9730a4251951046cc1196dde5047f03bd1..3eba42cdcd45b5a211b14902ca99eb934bb86358 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -338,7 +338,7 @@ QmlRunConfiguration::QmlRunConfiguration(QmlProject *pro) { setName(tr("QML Viewer")); - m_qmlViewer = Core::Utils::SynchronousProcess::locateBinary(QLatin1String("qmlviewer")); + m_qmlViewer = Utils::SynchronousProcess::locateBinary(QLatin1String("qmlviewer")); } QmlRunConfiguration::~QmlRunConfiguration() @@ -428,8 +428,8 @@ QWidget *QmlRunConfiguration::configurationWidget() connect(combo, SIGNAL(activated(QString)), this, SLOT(setMainScript(QString))); - Core::Utils::PathChooser *qmlViewer = new Core::Utils::PathChooser; - qmlViewer->setExpectedKind(Core::Utils::PathChooser::Command); + Utils::PathChooser *qmlViewer = new Utils::PathChooser; + qmlViewer->setExpectedKind(Utils::PathChooser::Command); qmlViewer->setPath(executable()); connect(qmlViewer, SIGNAL(changed(QString)), this, SLOT(onQmlViewerChanged())); @@ -463,7 +463,7 @@ void QmlRunConfiguration::setMainScript(const QString &scriptFile) void QmlRunConfiguration::onQmlViewerChanged() { - if (Core::Utils::PathChooser *chooser = qobject_cast<Core::Utils::PathChooser *>(sender())) { + if (Utils::PathChooser *chooser = qobject_cast<Utils::PathChooser *>(sender())) { m_qmlViewer = chooser->path(); } } @@ -492,7 +492,7 @@ void QmlRunConfiguration::restore(const ProjectExplorer::PersistentSettingsReade m_scriptFile = reader.restoreValue(QLatin1String("mainscript")).toString(); if (m_qmlViewer.isEmpty()) - m_qmlViewer = Core::Utils::SynchronousProcess::locateBinary(QLatin1String("qmlviewer")); + m_qmlViewer = Utils::SynchronousProcess::locateBinary(QLatin1String("qmlviewer")); if (m_scriptFile.isEmpty()) m_scriptFile = tr("<Current File>"); diff --git a/src/plugins/qmlprojectmanager/qmlprojectwizard.cpp b/src/plugins/qmlprojectmanager/qmlprojectwizard.cpp index e7d50aa9d64a50f076856b5a2e93a52e2b7957b8..c797e461cf20298075b2fd2e295fb8e3366a03f7 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectwizard.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectwizard.cpp @@ -46,7 +46,7 @@ #include <QtGui/QTreeView> using namespace QmlProjectManager::Internal; -using namespace Core::Utils; +using namespace Utils; namespace { diff --git a/src/plugins/qmlprojectmanager/qmlprojectwizard.h b/src/plugins/qmlprojectmanager/qmlprojectwizard.h index 1715ccdeb0f73115d4926c62ec4827b5c429d54a..9f46c6b4a34307659c6e4608921ca318ecab67ab 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectwizard.h +++ b/src/plugins/qmlprojectmanager/qmlprojectwizard.h @@ -44,13 +44,9 @@ class QStringList; class QTreeView; QT_END_NAMESPACE -namespace Core { namespace Utils { - class FileWizardPage; - } // namespace Utils -} // namespace Core namespace QmlProjectManager { namespace Internal { @@ -79,7 +75,7 @@ protected: private: int m_secondPageId; - Core::Utils::FileWizardPage *m_firstPage; + Utils::FileWizardPage *m_firstPage; QTreeView *m_dirView; QDirModel *m_dirModel; diff --git a/src/plugins/qt4projectmanager/customwidgetwizard/classdefinition.cpp b/src/plugins/qt4projectmanager/customwidgetwizard/classdefinition.cpp index 98b4f13f8022e183f9da93c537087ef34d21ee32..df5c911699ed1a0ab906f76f9a2ee8c43fc392d5 100644 --- a/src/plugins/qt4projectmanager/customwidgetwizard/classdefinition.cpp +++ b/src/plugins/qt4projectmanager/customwidgetwizard/classdefinition.cpp @@ -40,7 +40,7 @@ ClassDefinition::ClassDefinition(QWidget *parent) : m_domXmlChanged(false) { setupUi(this); - iconPathChooser->setExpectedKind(Core::Utils::PathChooser::File); + iconPathChooser->setExpectedKind(Utils::PathChooser::File); iconPathChooser->setPromptDialogTitle(tr("Select Icon")); iconPathChooser->setPromptDialogFilter(tr("Icon files (*.png *.ico *.jpg *.xpm *.tif *.svg)")); } diff --git a/src/plugins/qt4projectmanager/customwidgetwizard/classdefinition.ui b/src/plugins/qt4projectmanager/customwidgetwizard/classdefinition.ui index 21fc000415eb78a3ff977091597fbb6e74ccabcc..d705685a2d45512e7f15c6e9aa940a86896ba982 100644 --- a/src/plugins/qt4projectmanager/customwidgetwizard/classdefinition.ui +++ b/src/plugins/qt4projectmanager/customwidgetwizard/classdefinition.ui @@ -158,7 +158,7 @@ </widget> </item> <item row="9" column="1"> - <widget class="Core::Utils::PathChooser" name="iconPathChooser"/> + <widget class="Utils::PathChooser" name="iconPathChooser"/> </item> <item row="0" column="1"> <layout class="QGridLayout" name="gridLayout"> @@ -296,7 +296,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> </customwidget> diff --git a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.cpp b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.cpp index bf621b9f1567cf24f63add5123182e20c8ef4c2c..8020bdfcf8c238ffb20e3ce4553b61c4b890ef36 100644 --- a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.cpp +++ b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizard.cpp @@ -51,7 +51,7 @@ QWizard *CustomWidgetWizard::createWizardDialog(QWidget *parent, const WizardPageList &extensionPages) const { CustomWidgetWizardDialog *rc = new CustomWidgetWizardDialog(name(), icon(), extensionPages, parent); - rc->setPath(defaultPath.isEmpty() ? Core::Utils::PathChooser::homePath() : defaultPath); + rc->setPath(defaultPath.isEmpty() ? Utils::PathChooser::homePath() : defaultPath); rc->setFileNamingParameters(FileNamingParameters(headerSuffix(), sourceSuffix(), QtWizard::lowerCaseFiles())); return rc; } diff --git a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp index 9ff8933083a512c0e7bc16eb5fb82c6ee1f7c2c1..b0f2c5a362d5899cf53f9acfc17a0e9c43b98017 100644 --- a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp +++ b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp @@ -44,7 +44,7 @@ CustomWidgetWizardDialog::CustomWidgetWizardDialog(const QString &templateName, const QList<QWizardPage*> &extensionPages, QWidget *parent) : QWizard(parent), - m_introPage(new Core::Utils::ProjectIntroPage), + m_introPage(new Utils::ProjectIntroPage), m_widgetsPage(new CustomWidgetWidgetsWizardPage), m_pluginPage(new CustomWidgetPluginWizardPage) diff --git a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.h b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.h index e3fc976a1ff77c471173df3a07eb89d81e5647da..c4c3505770537611246d15aa2487944f63e23b63 100644 --- a/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.h +++ b/src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.h @@ -35,10 +35,8 @@ #include <QtGui/QWizard> #include <QtGui/QWizardPage> -namespace Core { - namespace Utils { - class ProjectIntroPage; - } +namespace Utils { + class ProjectIntroPage; } namespace Qt4ProjectManager { @@ -73,7 +71,7 @@ private slots: void slotCurrentIdChanged (int id); private: - Core::Utils::ProjectIntroPage *m_introPage; + Utils::ProjectIntroPage *m_introPage; CustomWidgetWidgetsWizardPage *m_widgetsPage; CustomWidgetPluginWizardPage *m_pluginPage; }; diff --git a/src/plugins/qt4projectmanager/externaleditors.cpp b/src/plugins/qt4projectmanager/externaleditors.cpp index 68ab239079ce10809db83207987cbb104cadf5e3..142bef7f501daa58ed36c5889d493cdeb950db89 100644 --- a/src/plugins/qt4projectmanager/externaleditors.cpp +++ b/src/plugins/qt4projectmanager/externaleditors.cpp @@ -104,7 +104,7 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName, data->workingDirectory = QFileInfo(project->file()->fileName()).absolutePath(); } else { data->workingDirectory.clear(); - data->binary = Core::Utils::SynchronousProcess::locateBinary(fallbackBinary); + data->binary = Utils::SynchronousProcess::locateBinary(fallbackBinary); } if (data->binary.isEmpty()) { *errorMessage = msgAppNotFound(kind()); diff --git a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.ui b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.ui index e4dc34ba355ebb0cc81d0eeb9b3d5432daceb87e..13238718fd98523b7b49a0ee914f033b53e9850f 100644 --- a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.ui +++ b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.ui @@ -33,7 +33,7 @@ </property> <layout class="QGridLayout" name="gridLayout_6"> <item row="0" column="0"> - <widget class="Core::Utils::WelcomeModeLabel" name="tutorialsTitleLabel"> + <widget class="Utils::WelcomeModeLabel" name="tutorialsTitleLabel"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <horstretch>0</horstretch> @@ -46,7 +46,7 @@ </widget> </item> <item row="1" column="0"> - <widget class="Core::Utils::WelcomeModeTreeWidget" name="tutorialTreeWidget"> + <widget class="Utils::WelcomeModeTreeWidget" name="tutorialTreeWidget"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -126,7 +126,7 @@ <number>0</number> </property> <item row="0" column="0" colspan="4"> - <widget class="Core::Utils::WelcomeModeLabel" name="demoTitleLabel"> + <widget class="Utils::WelcomeModeLabel" name="demoTitleLabel"> <property name="alignment"> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> </property> @@ -207,7 +207,7 @@ <number>9</number> </property> <item row="0" column="0"> - <widget class="Core::Utils::WelcomeModeLabel" name="didYouKnowTitleLabel"> + <widget class="Utils::WelcomeModeLabel" name="didYouKnowTitleLabel"> <property name="sizePolicy"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum"> <horstretch>0</horstretch> @@ -331,12 +331,12 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::WelcomeModeTreeWidget</class> + <class>Utils::WelcomeModeTreeWidget</class> <extends>QTreeWidget</extends> <header>utils/welcomemodetreewidget.h</header> </customwidget> <customwidget> - <class>Core::Utils::WelcomeModeLabel</class> + <class>Utils::WelcomeModeLabel</class> <extends>QLabel</extends> <header>utils/welcomemodetreewidget.h</header> </customwidget> diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp index 757bde525f540fee0ba167c90366c3584afd1dbd..1aa46aacd25d5487fb0cbe9555910c0684430737 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp @@ -355,12 +355,12 @@ S60DeviceRunConfigurationWidget::S60DeviceRunConfigurationWidget(S60DeviceRunCon QFormLayout *customLayout = new QFormLayout(); customLayout->setMargin(0); customLayout->setLabelAlignment(Qt::AlignRight); - Core::Utils::PathChooser *signaturePath = new Core::Utils::PathChooser(); - signaturePath->setExpectedKind(Core::Utils::PathChooser::File); + Utils::PathChooser *signaturePath = new Utils::PathChooser(); + signaturePath->setExpectedKind(Utils::PathChooser::File); signaturePath->setPromptDialogTitle(tr("Choose certificate file (.cer)")); customLayout->addRow(new QLabel(tr("Custom certificate:")), signaturePath); - Core::Utils::PathChooser *keyPath = new Core::Utils::PathChooser(); - keyPath->setExpectedKind(Core::Utils::PathChooser::File); + Utils::PathChooser *keyPath = new Utils::PathChooser(); + keyPath->setExpectedKind(Utils::PathChooser::File); keyPath->setPromptDialogTitle(tr("Choose key file (.key / .pem)")); customLayout->addRow(new QLabel(tr("Key file:")), keyPath); customHBox->addLayout(customLayout); @@ -624,11 +624,13 @@ void S60DeviceRunControlBase::signsisProcessFinished() emit finished(); return; } - m_launcher = new trk::Launcher; + m_launcher = new trk::Launcher(); connect(m_launcher, SIGNAL(finished()), this, SLOT(launcherFinished())); connect(m_launcher, SIGNAL(copyingStarted()), this, SLOT(printCopyingNotice())); connect(m_launcher, SIGNAL(canNotCreateFile(QString,QString)), this, SLOT(printCreateFileFailed(QString,QString))); + connect(m_launcher, SIGNAL(canNotWriteFile(QString,QString)), this, SLOT(printWriteFileFailed(QString,QString))); connect(m_launcher, SIGNAL(installingStarted()), this, SLOT(printInstallingNotice())); + connect(m_launcher, SIGNAL(canNotInstall(QString,QString)), this, SLOT(printInstallFailed(QString,QString))); connect(m_launcher, SIGNAL(copyProgress(int)), this, SLOT(printCopyProgress(int))); //TODO sisx destination and file path user definable @@ -655,10 +657,14 @@ void S60DeviceRunControlBase::printCreateFileFailed(const QString &filename, con emit addToOutputWindow(this, tr("Could not create file %1 on device: %2").arg(filename, errorMessage)); } +void S60DeviceRunControlBase::printWriteFileFailed(const QString &filename, const QString &errorMessage) +{ + emit addToOutputWindow(this, tr("Could not write to file %1 on device: %2").arg(filename, errorMessage)); +} + void S60DeviceRunControlBase::printCopyingNotice() { emit addToOutputWindow(this, tr("Copying install file...")); - emit addToOutputWindow(this, tr("0% copied.")); } void S60DeviceRunControlBase::printCopyProgress(int progress) @@ -671,6 +677,11 @@ void S60DeviceRunControlBase::printInstallingNotice() emit addToOutputWindow(this, tr("Installing application...")); } +void S60DeviceRunControlBase::printInstallFailed(const QString &filename, const QString &errorMessage) +{ + emit addToOutputWindow(this, tr("Could not install from package %1 on device: %2").arg(filename, errorMessage)); +} + void S60DeviceRunControlBase::launcherFinished() { m_launcher->deleteLater(); @@ -695,6 +706,11 @@ void S60DeviceRunControlBase::processFailed(const QString &program, QProcess::Pr emit finished(); } +void S60DeviceRunControlBase::printApplicationOutput(const QString &output) +{ + emit addToOutputWindowInline(this, output); +} + // =============== S60DeviceRunControl S60DeviceRunControl::S60DeviceRunControl(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration) : S60DeviceRunControlBase(runConfiguration) @@ -707,6 +723,7 @@ void S60DeviceRunControl::initLauncher(const QString &executable, trk::Launcher connect(launcher, SIGNAL(applicationRunning(uint)), this, SLOT(printRunNotice(uint))); connect(launcher, SIGNAL(canNotRun(QString)), this, SLOT(printRunFailNotice(QString))); connect(launcher, SIGNAL(applicationOutputReceived(QString)), this, SLOT(printApplicationOutput(QString))); + launcher->addStartupActions(trk::Launcher::ActionCopyInstallRun); launcher->setFileName(executable); } @@ -730,11 +747,6 @@ void S60DeviceRunControl::printRunFailNotice(const QString &errorMessage) { emit addToOutputWindow(this, tr("Could not start application: %1").arg(errorMessage)); } -void S60DeviceRunControl::printApplicationOutput(const QString &output) -{ - emit addToOutputWindowInline(this, output); -} - // ======== S60DeviceDebugRunControl S60DeviceDebugRunControl::S60DeviceDebugRunControl(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration) : @@ -748,7 +760,7 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(const QSharedPointer<ProjectE connect(dm, SIGNAL(debuggingFinished()), this, SLOT(debuggingFinished()), Qt::QueuedConnection); connect(dm, SIGNAL(applicationOutputAvailable(QString)), - this, SLOT(slotAddToOutputWindow(QString)), + this, SLOT(printApplicationOutput(QString)), Qt::QueuedConnection); m_startParams->remoteChannel = rc->serialPortName(); @@ -769,7 +781,7 @@ S60DeviceDebugRunControl::~S60DeviceDebugRunControl() { } -void S60DeviceDebugRunControl::initLauncher(const QString &executable, trk::Launcher *) +void S60DeviceDebugRunControl::initLauncher(const QString &executable, trk::Launcher *launcher) { // No setting an executable on the launcher causes it to deploy only m_startParams->executable = executable; @@ -785,6 +797,7 @@ void S60DeviceDebugRunControl::initLauncher(const QString &executable, trk::Laun emit addToOutputWindow(this, tr("Warning: Cannot locate the symbol file belonging to %1.").arg(localExecutableFileName)); } } + launcher->addStartupActions(trk::Launcher::ActionCopyInstall); } void S60DeviceDebugRunControl::handleLauncherFinished() diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h index c4c3d5496bb013e2a56f2a51e2d0b75bac307085..65f9d7f3eef9ac4fcbc4625685c66cf89eb442f6 100644 --- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h @@ -160,6 +160,9 @@ protected: virtual void handleLauncherFinished() = 0; void processFailed(const QString &program, QProcess::ProcessError errorCode); +protected slots: + void printApplicationOutput(const QString &output); + private slots: void readStandardError(); void readStandardOutput(); @@ -169,8 +172,10 @@ private slots: void signsisProcessFinished(); void printCopyingNotice(); void printCreateFileFailed(const QString &filename, const QString &errorMessage); + void printWriteFileFailed(const QString &filename, const QString &errorMessage); void printCopyProgress(int progress); void printInstallingNotice(); + void printInstallFailed(const QString &filename, const QString &errorMessage); void launcherFinished(); private: @@ -208,7 +213,6 @@ private slots: void printStartingNotice(); void printRunNotice(uint pid); void printRunFailNotice(const QString &errorMessage); - void printApplicationOutput(const QString &output); private: }; diff --git a/src/plugins/qt4projectmanager/qt4nodes.cpp b/src/plugins/qt4projectmanager/qt4nodes.cpp index 660d46961d61120569859b34b8806ba7d0742378..9d213e2cf2861ed4f96d70cfdb4a5e1a02720c80 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.cpp +++ b/src/plugins/qt4projectmanager/qt4nodes.cpp @@ -1236,7 +1236,7 @@ void Qt4ProFileNode::updateCodeModelSupportFromBuild(const QStringList &files) } } -void Qt4ProFileNode::updateCodeModelSupportFromEditor(const QString &uiFileName, Designer::Internal::FormWindowEditor *fw) +void Qt4ProFileNode::updateCodeModelSupportFromEditor(const QString &uiFileName, Designer::FormWindowEditor *fw) { QMap<QString, Qt4UiCodeModelSupport *>::const_iterator it; it = m_uiCodeModelSupport.constFind(uiFileName); diff --git a/src/plugins/qt4projectmanager/qt4nodes.h b/src/plugins/qt4projectmanager/qt4nodes.h index ecc32cddc3e93f2392bdde004aadf7d528a26fea..58ecafe5eb30bc51eb730c5cf5f037c418e37c15 100644 --- a/src/plugins/qt4projectmanager/qt4nodes.h +++ b/src/plugins/qt4projectmanager/qt4nodes.h @@ -53,10 +53,8 @@ class FileWatcher; } namespace Designer { -namespace Internal { class FormWindowEditor; } -} namespace Qt4ProjectManager { @@ -197,7 +195,7 @@ public: QStringList variableValue(const Qt4Variable var) const; void updateCodeModelSupportFromBuild(const QStringList &files); - void updateCodeModelSupportFromEditor(const QString &uiFileName, Designer::Internal::FormWindowEditor *fw); + void updateCodeModelSupportFromEditor(const QString &uiFileName, Designer::FormWindowEditor *fw); public slots: void scheduleUpdate(); void update(); diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp index 25e66aa189ef01bb9805d156825dcd819c9da407..b2ae00237185c0070213ffec1d3ce54128b6acf2 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.cpp @@ -69,7 +69,7 @@ Qt4ProjectConfigWidget::Qt4ProjectConfigWidget(Qt4Project *project) // TODO refix the layout m_ui->shadowBuildDirEdit->setPromptDialogTitle(tr("Shadow Build Directory")); - m_ui->shadowBuildDirEdit->setExpectedKind(Core::Utils::PathChooser::Directory); + m_ui->shadowBuildDirEdit->setExpectedKind(Utils::PathChooser::Directory); m_ui->invalidQtWarningLabel->setVisible(false); connect(m_ui->nameLineEdit, SIGNAL(textEdited(QString)), diff --git a/src/plugins/qt4projectmanager/qt4projectconfigwidget.ui b/src/plugins/qt4projectmanager/qt4projectconfigwidget.ui index 48501e8ec93b9b9e6784531de47938851ad4af91..0beb5258e6074a0def1ed3251bf7de30a58ee117 100644 --- a/src/plugins/qt4projectmanager/qt4projectconfigwidget.ui +++ b/src/plugins/qt4projectmanager/qt4projectconfigwidget.ui @@ -99,7 +99,7 @@ </widget> </item> <item row="7" column="1"> - <widget class="Core::Utils::PathChooser" name="shadowBuildDirEdit" native="true"> + <widget class="Utils::PathChooser" name="shadowBuildDirEdit" native="true"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -139,7 +139,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.cpp b/src/plugins/qt4projectmanager/qt4projectmanager.cpp index 04d32a826baa7892d4e59c172f8ead1d5d844ec0..7290b523ec6048c253b5e1b7b1a324d66b63c930 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.cpp +++ b/src/plugins/qt4projectmanager/qt4projectmanager.cpp @@ -124,7 +124,7 @@ void Qt4Manager::init() void Qt4Manager::editorChanged(Core::IEditor *editor) { // Handle old editor - Designer::Internal::FormWindowEditor *lastEditor = qobject_cast<Designer::Internal::FormWindowEditor *>(m_lastEditor); + Designer::FormWindowEditor *lastEditor = qobject_cast<Designer::FormWindowEditor *>(m_lastEditor); if (lastEditor) { disconnect(lastEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged())); @@ -138,7 +138,7 @@ void Qt4Manager::editorChanged(Core::IEditor *editor) m_lastEditor = editor; // Handle new editor - if (Designer::Internal::FormWindowEditor *fw = qobject_cast<Designer::Internal::FormWindowEditor *>(editor)) + if (Designer::FormWindowEditor *fw = qobject_cast<Designer::FormWindowEditor *>(editor)) connect(fw, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged())); } @@ -147,7 +147,7 @@ void Qt4Manager::editorAboutToClose(Core::IEditor *editor) if (m_lastEditor == editor) { // Oh no our editor is going to be closed // get the content first - Designer::Internal::FormWindowEditor *lastEditor = qobject_cast<Designer::Internal::FormWindowEditor *>(m_lastEditor); + Designer::FormWindowEditor *lastEditor = qobject_cast<Designer::FormWindowEditor *>(m_lastEditor); if (lastEditor) { disconnect(lastEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged())); if (m_dirty) { @@ -165,7 +165,7 @@ void Qt4Manager::uiEditorContentsChanged() // cast sender, get filename if (m_dirty) return; - Designer::Internal::FormWindowEditor *fw = qobject_cast<Designer::Internal::FormWindowEditor *>(sender()); + Designer::FormWindowEditor *fw = qobject_cast<Designer::FormWindowEditor *>(sender()); if (!fw) return; m_dirty = true; diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp index f6ee0a72e4f889cb175a2d21ee3abbd78b60b04e..2c4083ad46f9bfe9c4a556374f61beafa4f6e680 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.cpp +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.cpp @@ -138,9 +138,9 @@ Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4Run m_executableLabel = new QLabel(m_qt4RunConfiguration->executable()); toplayout->addRow(tr("Executable:"), m_executableLabel); - m_workingDirectoryEdit = new Core::Utils::PathChooser(); + m_workingDirectoryEdit = new Utils::PathChooser(); m_workingDirectoryEdit->setPath(m_qt4RunConfiguration->workingDirectory()); - m_workingDirectoryEdit->setExpectedKind(Core::Utils::PathChooser::Directory); + m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory); m_workingDirectoryEdit->setPromptDialogTitle(tr("Select the working directory")); QToolButton *resetButton = new QToolButton(); diff --git a/src/plugins/qt4projectmanager/qt4runconfiguration.h b/src/plugins/qt4projectmanager/qt4runconfiguration.h index 2584fa2853394ec87aded875497ece00c80c4b38..69fa0d6575fd35ff61041215e8995bcb698b1328 100644 --- a/src/plugins/qt4projectmanager/qt4runconfiguration.h +++ b/src/plugins/qt4projectmanager/qt4runconfiguration.h @@ -174,7 +174,7 @@ private: Qt4RunConfiguration *m_qt4RunConfiguration; bool m_ignoreChange; QLabel *m_executableLabel; - Core::Utils::PathChooser *m_workingDirectoryEdit; + Utils::PathChooser *m_workingDirectoryEdit; QLineEdit *m_nameLineEdit; QLineEdit *m_argumentsLineEdit; QCheckBox *m_useTerminalCheck; diff --git a/src/plugins/qt4projectmanager/qtoptionspage.cpp b/src/plugins/qt4projectmanager/qtoptionspage.cpp index ce7bd1aef9a3e8ee13f26f4dfb396957c48bd54f..60eef5de89fad2d77bb61b8b6e42b5418a0b302a 100644 --- a/src/plugins/qt4projectmanager/qtoptionspage.cpp +++ b/src/plugins/qt4projectmanager/qtoptionspage.cpp @@ -116,17 +116,17 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver m_versions.push_back(QSharedPointerQtVersion(new QtVersion(*version))); m_ui->setupUi(this); - m_ui->qmakePath->setExpectedKind(Core::Utils::PathChooser::File); + m_ui->qmakePath->setExpectedKind(Utils::PathChooser::File); m_ui->qmakePath->setPromptDialogTitle(tr("Select QMake Executable")); - m_ui->mingwPath->setExpectedKind(Core::Utils::PathChooser::Directory); + m_ui->mingwPath->setExpectedKind(Utils::PathChooser::Directory); m_ui->mingwPath->setPromptDialogTitle(tr("Select the MinGW Directory")); - m_ui->mwcPath->setExpectedKind(Core::Utils::PathChooser::Directory); + m_ui->mwcPath->setExpectedKind(Utils::PathChooser::Directory); m_ui->mwcPath->setPromptDialogTitle(tr("Select \"x86build\" Directory from Carbide Install")); m_ui->addButton->setIcon(QIcon(Core::Constants::ICON_PLUS)); m_ui->delButton->setIcon(QIcon(Core::Constants::ICON_MINUS)); - new Core::Utils::TreeWidgetColumnStretcher(m_ui->qtdirList, 1); + new Utils::TreeWidgetColumnStretcher(m_ui->qtdirList, 1); // setup parent items for auto-detected and manual versions m_ui->qtdirList->header()->setResizeMode(QHeaderView::ResizeToContents); diff --git a/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp b/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp index 8d078f60c62c903b341a13c67fa4f74b8cb9611b..62a0f1755352b9d56e910237178a447c2ef16982 100644 --- a/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp +++ b/src/plugins/qt4projectmanager/qtuicodemodelsupport.cpp @@ -109,7 +109,7 @@ bool Qt4UiCodeModelSupport::runUic(const QString &ui) const return false; } -void Qt4UiCodeModelSupport::updateFromEditor(Designer::Internal::FormWindowEditor *fw) +void Qt4UiCodeModelSupport::updateFromEditor(Designer::FormWindowEditor *fw) { // qDebug()<<"Qt4UiCodeModelSupport::updateFromEditor"<<fw; if (runUic(fw->contents())) { diff --git a/src/plugins/qt4projectmanager/qtuicodemodelsupport.h b/src/plugins/qt4projectmanager/qtuicodemodelsupport.h index 748a1288d235d7bdf15b4f0e1ddc1659ad0018f0..d7b46518d47f2d9e896f885bffe3e4ab14515e0f 100644 --- a/src/plugins/qt4projectmanager/qtuicodemodelsupport.h +++ b/src/plugins/qt4projectmanager/qtuicodemodelsupport.h @@ -35,10 +35,8 @@ #include <QtCore/QDateTime> namespace Designer { -namespace Internal { class FormWindowEditor; } -} namespace Qt4ProjectManager { class Qt4Project; @@ -56,7 +54,7 @@ public: void setSourceName(const QString &name); virtual QByteArray contents() const; virtual QString fileName() const; - void updateFromEditor(Designer::Internal::FormWindowEditor *); + void updateFromEditor(Designer::FormWindowEditor *); void updateFromBuild(); private: void init(); diff --git a/src/plugins/qt4projectmanager/qtversionmanager.ui b/src/plugins/qt4projectmanager/qtversionmanager.ui index ed7aedf3b8eea614a13e53c611b226d6ccbf4e78..9905b2fe09127e51e8335645aaebf80cf05adde0 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.ui +++ b/src/plugins/qt4projectmanager/qtversionmanager.ui @@ -174,7 +174,7 @@ p, li { white-space: pre-wrap; } </widget> </item> <item row="2" column="1"> - <widget class="Core::Utils::PathChooser" name="qmakePath" native="true"/> + <widget class="Utils::PathChooser" name="qmakePath" native="true"/> </item> <item row="3" column="0"> <widget class="QLabel" name="mingwLabel"> @@ -184,7 +184,7 @@ p, li { white-space: pre-wrap; } </widget> </item> <item row="3" column="1"> - <widget class="Core::Utils::PathChooser" name="mingwPath" native="true"/> + <widget class="Utils::PathChooser" name="mingwPath" native="true"/> </item> <item row="4" column="0"> <widget class="QLabel" name="msvcLabel"> @@ -215,7 +215,7 @@ p, li { white-space: pre-wrap; } </widget> </item> <item row="5" column="1"> - <widget class="Core::Utils::PathChooser" name="mwcPath" native="true"/> + <widget class="Utils::PathChooser" name="mwcPath" native="true"/> </item> </layout> </widget> @@ -245,7 +245,7 @@ p, li { white-space: pre-wrap; } </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp b/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp index cb178258e074ede2b28c2e5a0639d405eca21002..438ac44152a13dd3635625c772715f01a7f82eb7 100644 --- a/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp @@ -67,7 +67,7 @@ QWizard *ConsoleAppWizard::createWizardDialog(QWidget *parent, const WizardPageList &extensionPages) const { ConsoleAppWizardDialog *dialog = new ConsoleAppWizardDialog(name(), icon(), extensionPages, parent); - dialog->setPath(defaultPath.isEmpty() ? Core::Utils::PathChooser::homePath() : defaultPath); + dialog->setPath(defaultPath.isEmpty() ? Utils::PathChooser::homePath() : defaultPath); return dialog; } diff --git a/src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.cpp index 1d81b174d7fef3f59e07b3fd9fba3de9d5e9f5a0..b3214e400af45b2ba1de2ab52a50c4b998d71c7d 100644 --- a/src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.cpp @@ -42,7 +42,7 @@ ConsoleAppWizardDialog::ConsoleAppWizardDialog(const QString &templateName, const QList<QWizardPage*> &extensionPages, QWidget *parent) : QWizard(parent), - m_introPage(new Core::Utils::ProjectIntroPage), + m_introPage(new Utils::ProjectIntroPage), m_modulesPage(new ModulesPage) { setWindowIcon(icon); diff --git a/src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.h b/src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.h index cceefb4e6167a9cd4a965f92ae6ccfd2e9f0c156..41aa2f3dfd2ceec306411ce0e3c379264af73305 100644 --- a/src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.h +++ b/src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.h @@ -32,10 +32,8 @@ #include <QtGui/QWizard> -namespace Core { - namespace Utils { - class ProjectIntroPage; - } +namespace Utils { + class ProjectIntroPage; } namespace Qt4ProjectManager { @@ -61,7 +59,7 @@ public slots: void setName(const QString &name); private: - Core::Utils::ProjectIntroPage *m_introPage; + Utils::ProjectIntroPage *m_introPage; ModulesPage *m_modulesPage; }; diff --git a/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp b/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp index 7674be5f135782be49fd52dd936a5ed943ea0708..ad8e07aa33a23986f23fde8a42583fc7f6761124 100644 --- a/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/emptyprojectwizard.cpp @@ -48,7 +48,7 @@ QWizard *EmptyProjectWizard::createWizardDialog(QWidget *parent, const WizardPageList &extensionPages) const { EmptyProjectWizardDialog *dialog = new EmptyProjectWizardDialog(name(), icon(), extensionPages, parent); - dialog->setPath(defaultPath.isEmpty() ? Core::Utils::PathChooser::homePath() : defaultPath); + dialog->setPath(defaultPath.isEmpty() ? Utils::PathChooser::homePath() : defaultPath); return dialog; } diff --git a/src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.cpp index f72af6b58ec17305d71a301bb1631b1ac075d534..4953ecf3bdd518e006c2f6f00006aea7851e3269 100644 --- a/src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.cpp @@ -41,7 +41,7 @@ EmptyProjectWizardDialog::EmptyProjectWizardDialog(const QString &templateName, const QList<QWizardPage*> &extensionPages, QWidget *parent) : QWizard(parent), - m_introPage(new Core::Utils::ProjectIntroPage) + m_introPage(new Utils::ProjectIntroPage) { setWindowIcon(icon); setWindowTitle(templateName); diff --git a/src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.h b/src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.h index 0dc27d451216ad7cde80899dfac2aa22e10a320d..adc9571eec7662bb73b04cdacbdc14e7a82f555e 100644 --- a/src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.h +++ b/src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.h @@ -32,10 +32,8 @@ #include <QtGui/QWizard> -namespace Core { - namespace Utils { - class ProjectIntroPage; - } +namespace Utils { + class ProjectIntroPage; } namespace Qt4ProjectManager { @@ -60,7 +58,7 @@ public slots: void setName(const QString &name); private: - Core::Utils::ProjectIntroPage *m_introPage; + Utils::ProjectIntroPage *m_introPage; }; } // namespace Internal diff --git a/src/plugins/qt4projectmanager/wizards/filespage.cpp b/src/plugins/qt4projectmanager/wizards/filespage.cpp index e2d6bbffbddf58721399a1caa5e00018312a97ae..6346a409a6c97c8aaeca00866e510ff9b96837ef 100644 --- a/src/plugins/qt4projectmanager/wizards/filespage.cpp +++ b/src/plugins/qt4projectmanager/wizards/filespage.cpp @@ -39,7 +39,7 @@ namespace Internal { FilesPage::FilesPage(QWidget *parent) : QWizardPage(parent), - m_newClassWidget(new Core::Utils::NewClassWidget) + m_newClassWidget(new Utils::NewClassWidget) { m_newClassWidget->setPathInputVisible(false); setTitle(tr("Class Information")); diff --git a/src/plugins/qt4projectmanager/wizards/filespage.h b/src/plugins/qt4projectmanager/wizards/filespage.h index 9446170a1cefad9e6db53446d077abc9c6449b92..f20e6ce8ab460fedf9ff7604e694f636409c4d9b 100644 --- a/src/plugins/qt4projectmanager/wizards/filespage.h +++ b/src/plugins/qt4projectmanager/wizards/filespage.h @@ -36,11 +36,9 @@ QT_BEGIN_NAMESPACE class QLabel; QT_END_NAMESPACE -namespace Core { namespace Utils { class NewClassWidget; } // namespace Utils -} // namespace Core namespace Qt4ProjectManager { namespace Internal { @@ -83,7 +81,7 @@ public slots: void setLowerCaseFiles(bool l); private: - Core::Utils::NewClassWidget *m_newClassWidget; + Utils::NewClassWidget *m_newClassWidget; QLabel *m_errorLabel; }; diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp index 059387b462683ff00050dd9a6c25d180d78fd745..2c4a7d2c86cb4c9de3f97c4fff7f2505f178954e 100644 --- a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp @@ -84,7 +84,7 @@ QWizard *GuiAppWizard::createWizardDialog(QWidget *parent, const WizardPageList &extensionPages) const { GuiAppWizardDialog *dialog = new GuiAppWizardDialog(name(), icon(), extensionPages, parent); - dialog->setPath(defaultPath.isEmpty() ? Core::Utils::PathChooser::homePath() : defaultPath); + dialog->setPath(defaultPath.isEmpty() ? Utils::PathChooser::homePath() : defaultPath); // Order! suffixes first to generate files correctly dialog->setLowerCaseFiles(QtWizard::lowerCaseFiles()); dialog->setSuffixes(headerSuffix(), sourceSuffix(), formSuffix()); diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp index 833c2935f2b3f67fa2fc66382da4f417e5193328..1ba1edf7daacd239679ea46df8eb98ffc613b282 100644 --- a/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp @@ -52,7 +52,7 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName, const QList<QWizardPage*> &extensionPages, QWidget *parent) : QWizard(parent), - m_introPage(new Core::Utils::ProjectIntroPage), + m_introPage(new Utils::ProjectIntroPage), m_modulesPage(new ModulesPage), m_filesPage(new FilesPage) { diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.h b/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.h index a20f36a2165b1639b71b6620046dcdb39c3b6982..ee6d327cf5e168b674066c49f8c098be551b8099 100644 --- a/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.h +++ b/src/plugins/qt4projectmanager/wizards/guiappwizarddialog.h @@ -32,13 +32,9 @@ #include <QtGui/QWizard> -namespace Core { namespace Utils { - -class ProjectIntroPage; - -} // namespace Utils -} // namespace Core + class ProjectIntroPage; +} namespace Qt4ProjectManager { namespace Internal { @@ -81,7 +77,7 @@ public slots: void setName(const QString &name); private: - Core::Utils::ProjectIntroPage *m_introPage; + Utils::ProjectIntroPage *m_introPage; ModulesPage *m_modulesPage; FilesPage *m_filesPage; }; diff --git a/src/plugins/qt4projectmanager/wizards/libraryparameters.cpp b/src/plugins/qt4projectmanager/wizards/libraryparameters.cpp index 4df6d7e3ac6581469e57428f2641786810ff8634..a8e9c53bff46ba5195ed7a696df73599f42b260d 100644 --- a/src/plugins/qt4projectmanager/wizards/libraryparameters.cpp +++ b/src/plugins/qt4projectmanager/wizards/libraryparameters.cpp @@ -71,12 +71,12 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t, const QString indent = QString(indentation, QLatin1Char(' ')); // 1) Header - const QString guard = Core::Utils::headerGuard(headerFileName); + const QString guard = Utils::headerGuard(headerFileName); headerStr << "#ifndef " << guard << "\n#define " << guard << '\n' << '\n'; if (!sharedHeader.isEmpty()) - Core::Utils::writeIncludeFileDirective(sharedHeader, false, headerStr); + Utils::writeIncludeFileDirective(sharedHeader, false, headerStr); // include base class header if (!baseClassName.isEmpty()) { @@ -86,7 +86,7 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t, include += QLatin1Char('/'); } include += baseClassName; - Core::Utils::writeIncludeFileDirective(include, true, headerStr); + Utils::writeIncludeFileDirective(include, true, headerStr); headerStr << '\n'; } @@ -98,7 +98,7 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t, const QString unqualifiedClassName = namespaceList.back(); namespaceList.pop_back(); - const QString namespaceIndent = Core::Utils::writeOpeningNameSpaces(namespaceList, indent, headerStr); + const QString namespaceIndent = Utils::writeOpeningNameSpaces(namespaceList, indent, headerStr); // Class declaraction headerStr << '\n' << namespaceIndent << "class "; @@ -122,15 +122,15 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t, headerStr << namespaceIndent << indent << unqualifiedClassName << "();\n"; } headerStr << namespaceIndent << "};\n\n"; - Core::Utils::writeClosingNameSpaces(namespaceList, indent, headerStr); + Utils::writeClosingNameSpaces(namespaceList, indent, headerStr); headerStr << "#endif // "<< guard << '\n'; /// 2) Source QTextStream sourceStr(source); - Core::Utils::writeIncludeFileDirective(headerName, false, sourceStr); + Utils::writeIncludeFileDirective(headerName, false, sourceStr); sourceStr << '\n'; - Core::Utils::writeOpeningNameSpaces(namespaceList, indent, sourceStr); + Utils::writeOpeningNameSpaces(namespaceList, indent, sourceStr); // Constructor sourceStr << '\n' << namespaceIndent << unqualifiedClassName << "::" << unqualifiedClassName; if (inheritsQObject) { @@ -141,7 +141,7 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t, } sourceStr << namespaceIndent << "{\n" << namespaceIndent << "}\n"; - Core::Utils::writeClosingNameSpaces(namespaceList, indent, sourceStr); + Utils::writeClosingNameSpaces(namespaceList, indent, sourceStr); if (t == QtProjectParameters::Qt4Plugin) sourceStr << '\n' << "Q_EXPORT_PLUGIN2(" << projectTarget << ", " << className << ")\n"; @@ -152,7 +152,7 @@ QString LibraryParameters::generateSharedHeader(const QString &globalHeaderFile const QString &exportMacro) { QString contents = QLatin1String(globalHeaderContentsC); - contents.replace(QLatin1String(GUARD_VARIABLE), Core::Utils::headerGuard(globalHeaderFileName)); + contents.replace(QLatin1String(GUARD_VARIABLE), Utils::headerGuard(globalHeaderFileName)); contents.replace(QLatin1String(EXPORT_MACRO_VARIABLE), exportMacro); contents.replace(QLatin1String(LIBRARY_MACRO_VARIABLE), QtProjectParameters::libraryMacro(projectTarget)); return contents; diff --git a/src/plugins/qt4projectmanager/wizards/librarywizard.cpp b/src/plugins/qt4projectmanager/wizards/librarywizard.cpp index aa82b1bfe11da4bbe44d788f1717f1a4b1d582b4..9247d26b3cf91eb3c36841fdcf256ab80093984e 100644 --- a/src/plugins/qt4projectmanager/wizards/librarywizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/librarywizard.cpp @@ -60,7 +60,7 @@ QWizard *LibraryWizard::createWizardDialog(QWidget *parent, { LibraryWizardDialog *dialog = new LibraryWizardDialog(name(), icon(), extensionPages, parent); dialog->setLowerCaseFiles(QtWizard::lowerCaseFiles()); - dialog->setPath(defaultPath.isEmpty() ? Core::Utils::PathChooser::homePath() : defaultPath); + dialog->setPath(defaultPath.isEmpty() ? Utils::PathChooser::homePath() : defaultPath); dialog->setSuffixes(headerSuffix(), sourceSuffix(), formSuffix()); return dialog; } diff --git a/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp b/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp index 98bf5f010e34ca6e696e7f61857d59ee046d2b57..4515954d517fa5eb5b134b21021af6da5f4de381 100644 --- a/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp +++ b/src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp @@ -100,7 +100,7 @@ static QString pluginDependencies(const PluginBaseClasses *plb) } // A Project intro page with an additional type chooser. -class LibraryIntroPage : public Core::Utils::ProjectIntroPage +class LibraryIntroPage : public Utils::ProjectIntroPage { Q_DISABLE_COPY(LibraryIntroPage) public: @@ -115,7 +115,7 @@ private: }; LibraryIntroPage::LibraryIntroPage(QWidget *parent) : - Core::Utils::ProjectIntroPage(parent), + Utils::ProjectIntroPage(parent), m_typeCombo(new QComboBox) { m_typeCombo->setEditable(false); diff --git a/src/plugins/qtscripteditor/qtscriptcodecompletion.cpp b/src/plugins/qtscripteditor/qtscriptcodecompletion.cpp index 3bd0071993478ea6b45c9100b22d510ebaf986ce..dd1380dceb47b4a09558d7b1aa49e81e903591d0 100644 --- a/src/plugins/qtscripteditor/qtscriptcodecompletion.cpp +++ b/src/plugins/qtscripteditor/qtscriptcodecompletion.cpp @@ -55,7 +55,7 @@ int QtScriptCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) foreach (const QString &word, edit->words()) { TextEditor::CompletionItem item(this); - item.m_text = word; + item.text = word; m_completions.append(item); } @@ -102,9 +102,9 @@ void QtScriptCodeCompletion::completions(QList<TextEditor::CompletionItem> *comp const QRegExp regExp(keyRegExp, Qt::CaseSensitive); foreach (TextEditor::CompletionItem item, m_completions) { - if (regExp.indexIn(item.m_text) == 0) { - item.m_relevance = (key.length() > 0 && - item.m_text.startsWith(key, Qt::CaseInsensitive)) ? 1 : 0; + if (regExp.indexIn(item.text) == 0) { + item.relevance = (key.length() > 0 && + item.text.startsWith(key, Qt::CaseInsensitive)) ? 1 : 0; (*completions) << item; } } @@ -113,7 +113,7 @@ void QtScriptCodeCompletion::completions(QList<TextEditor::CompletionItem> *comp void QtScriptCodeCompletion::complete(const TextEditor::CompletionItem &item) { - const QString toInsert = item.m_text; + const QString toInsert = item.text; const int length = m_editor->position() - m_startPosition; m_editor->setCurPos(m_startPosition); m_editor->replace(length, toInsert); @@ -126,8 +126,8 @@ bool QtScriptCodeCompletion::partiallyComplete(const QList<TextEditor::Completio return true; } else { // Compute common prefix - QString firstKey = completionItems.first().m_text; - QString lastKey = completionItems.last().m_text; + QString firstKey = completionItems.first().text; + QString lastKey = completionItems.last().text; const int length = qMin(firstKey.length(), lastKey.length()); firstKey.truncate(length); lastKey.truncate(length); diff --git a/src/plugins/quickopen/quickopentoolwindow.cpp b/src/plugins/quickopen/quickopentoolwindow.cpp index 3462f1817ea9f57ee2c85070d94ce22d3e3500e1..d5ca7ec735c916c3858fba903cb043a74d76e239 100644 --- a/src/plugins/quickopen/quickopentoolwindow.cpp +++ b/src/plugins/quickopen/quickopentoolwindow.cpp @@ -253,7 +253,7 @@ QuickOpenToolWindow::QuickOpenToolWindow(QuickOpenPlugin *qop) : m_filterMenu(new QMenu(this)), m_refreshAction(new QAction(tr("Refresh"), this)), m_configureAction(new QAction(tr("Configure..."), this)), - m_fileLineEdit(new Core::Utils::FancyLineEdit) + m_fileLineEdit(new Utils::FancyLineEdit) { // Explicitly hide the completion list popup. m_completionList->hide(); diff --git a/src/plugins/quickopen/quickopentoolwindow.h b/src/plugins/quickopen/quickopentoolwindow.h index 6d0c9305e4cdbd6b9ccbb6de40882b9f9c7c10cc..2509b175444c54166eb0a8897d2219233ca372df 100644 --- a/src/plugins/quickopen/quickopentoolwindow.h +++ b/src/plugins/quickopen/quickopentoolwindow.h @@ -43,11 +43,10 @@ class QMenu; class QTreeView; QT_END_NAMESPACE -namespace Core { - namespace Utils { - class FancyLineEdit; - } +namespace Utils { + class FancyLineEdit; } + namespace QuickOpen { namespace Internal { @@ -89,7 +88,7 @@ private: QMenu *m_filterMenu; QAction *m_refreshAction; QAction *m_configureAction; - Core::Utils::FancyLineEdit *m_fileLineEdit; + Utils::FancyLineEdit *m_fileLineEdit; }; } // namespace Internal diff --git a/src/plugins/resourceeditor/resourceeditorw.cpp b/src/plugins/resourceeditor/resourceeditorw.cpp index de4f8ba877276586d45ce3d55ee978c1f2a0ff5b..abc2062b4002236f6905f2cbc1bc8a02e408eb58 100644 --- a/src/plugins/resourceeditor/resourceeditorw.cpp +++ b/src/plugins/resourceeditor/resourceeditorw.cpp @@ -208,17 +208,17 @@ void ResourceEditorFile::modified(Core::IFile::ReloadBehavior *behavior) break; } - switch (Core::Utils::reloadPrompt(fileName, isModified(), Core::ICore::instance()->mainWindow())) { - case Core::Utils::ReloadCurrent: + switch (Utils::reloadPrompt(fileName, isModified(), Core::ICore::instance()->mainWindow())) { + case Utils::ReloadCurrent: m_parent->open(fileName); break; - case Core::Utils::ReloadAll: + case Utils::ReloadAll: m_parent->open(fileName); *behavior = Core::IFile::ReloadAll; break; - case Core::Utils::ReloadSkipCurrent: + case Utils::ReloadSkipCurrent: break; - case Core::Utils::ReloadNone: + case Utils::ReloadNone: *behavior = Core::IFile::ReloadNone; break; } diff --git a/src/plugins/subversion/settingspage.cpp b/src/plugins/subversion/settingspage.cpp index a37a0a1d2046f4b7cf9eccf7ea25ac8ba88bffb6..93b9ef0a1e1aa924db4a54063745843853704182 100644 --- a/src/plugins/subversion/settingspage.cpp +++ b/src/plugins/subversion/settingspage.cpp @@ -40,7 +40,7 @@ #include <QtGui/QFileDialog> using namespace Subversion::Internal; -using namespace Core::Utils; +using namespace Utils; SettingsPageWidget::SettingsPageWidget(QWidget *parent) : QWidget(parent) diff --git a/src/plugins/subversion/settingspage.ui b/src/plugins/subversion/settingspage.ui index b4b8d93b7e1260a3e0c44605abe008b40f3c28f6..743702e684b38d49213315248fa6e35d5f3013f0 100644 --- a/src/plugins/subversion/settingspage.ui +++ b/src/plugins/subversion/settingspage.ui @@ -53,7 +53,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="Core::Utils::PathChooser" name="pathChooser"/> + <widget class="Utils::PathChooser" name="pathChooser"/> </item> </layout> </item> @@ -125,7 +125,7 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index dd6bdd7103f26708b88111adfca47271fd5fb77a..d99145aa62b8d5944ce9ff51baded1966670d45e 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -289,7 +289,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe globalcontext << core->uniqueIDManager()->uniqueIdentifier(C_GLOBAL); Core::Command *command; - m_addAction = new Core::Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_addAction = new Utils::ParameterAction(tr("Add"), tr("Add \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_addAction, CMD_ID_ADD, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -299,14 +299,14 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe connect(m_addAction, SIGNAL(triggered()), this, SLOT(addCurrentFile())); subversionMenu->addAction(command); - m_deleteAction = new Core::Utils::ParameterAction(tr("Delete"), tr("Delete \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_deleteAction = new Utils::ParameterAction(tr("Delete"), tr("Delete \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_deleteAction, CMD_ID_DELETE_FILE, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); connect(m_deleteAction, SIGNAL(triggered()), this, SLOT(deleteCurrentFile())); subversionMenu->addAction(command); - m_revertAction = new Core::Utils::ParameterAction(tr("Revert"), tr("Revert \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_revertAction = new Utils::ParameterAction(tr("Revert"), tr("Revert \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_revertAction, CMD_ID_REVERT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -321,7 +321,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe connect(m_diffProjectAction, SIGNAL(triggered()), this, SLOT(diffProject())); subversionMenu->addAction(command); - m_diffCurrentAction = new Core::Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_diffCurrentAction = new Utils::ParameterAction(tr("Diff Current File"), tr("Diff \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_diffCurrentAction, CMD_ID_DIFF_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -339,7 +339,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe connect(m_commitAllAction, SIGNAL(triggered()), this, SLOT(startCommitAll())); subversionMenu->addAction(command); - m_commitCurrentAction = new Core::Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_commitCurrentAction = new Utils::ParameterAction(tr("Commit Current File"), tr("Commit \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_commitCurrentAction, CMD_ID_COMMIT_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -351,7 +351,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe subversionMenu->addAction(createSeparator(this, ami, CMD_ID_SEPARATOR2, globalcontext)); - m_filelogCurrentAction = new Core::Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_filelogCurrentAction = new Utils::ParameterAction(tr("Filelog Current File"), tr("Filelog \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_filelogCurrentAction, CMD_ID_FILELOG_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -359,7 +359,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe SLOT(filelogCurrentFile())); subversionMenu->addAction(command); - m_annotateCurrentAction = new Core::Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Core::Utils::ParameterAction::EnabledWithParameter, this); + m_annotateCurrentAction = new Utils::ParameterAction(tr("Annotate Current File"), tr("Annotate \"%1\""), Utils::ParameterAction::EnabledWithParameter, this); command = ami->registerAction(m_annotateCurrentAction, CMD_ID_ANNOTATE_CURRENT, globalcontext); command->setAttribute(Core::Command::CA_UpdateText); @@ -935,7 +935,7 @@ SubversionResponse SubversionPlugin::runSvn(const QStringList &arguments, qDebug() << "runSvn" << timeOut << outputText; // Run, connect stderr to the output window - Core::Utils::SynchronousProcess process; + Utils::SynchronousProcess process; process.setTimeout(timeOut); process.setStdOutCodec(outputCodec); @@ -948,24 +948,24 @@ SubversionResponse SubversionPlugin::runSvn(const QStringList &arguments, connect(&process, SIGNAL(stdOutBuffered(QString,bool)), outputWindow, SLOT(append(QString))); } - const Core::Utils::SynchronousProcessResponse sp_resp = process.run(executable, allArgs); + const Utils::SynchronousProcessResponse sp_resp = process.run(executable, allArgs); response.error = true; response.stdErr = sp_resp.stdErr; response.stdOut = sp_resp.stdOut; switch (sp_resp.result) { - case Core::Utils::SynchronousProcessResponse::Finished: + case Utils::SynchronousProcessResponse::Finished: response.error = false; break; - case Core::Utils::SynchronousProcessResponse::FinishedError: + case Utils::SynchronousProcessResponse::FinishedError: response.message = tr("The process terminated with exit code %1.").arg(sp_resp.exitCode); break; - case Core::Utils::SynchronousProcessResponse::TerminatedAbnormally: + case Utils::SynchronousProcessResponse::TerminatedAbnormally: response.message = tr("The process terminated abnormally."); break; - case Core::Utils::SynchronousProcessResponse::StartFailed: + case Utils::SynchronousProcessResponse::StartFailed: response.message = tr("Could not start subversion '%1'. Please check your settings in the preferences.").arg(executable); break; - case Core::Utils::SynchronousProcessResponse::Hang: + case Utils::SynchronousProcessResponse::Hang: response.message = tr("Subversion did not respond within timeout limit (%1 ms).").arg(timeOut); break; } diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h index b7bbc2f710a9e53ef2dfa64d8387047eff3e5bf1..1dcfce680324d1ffe7de4e3c8cf71c1bc3e888f8 100644 --- a/src/plugins/subversion/subversionplugin.h +++ b/src/plugins/subversion/subversionplugin.h @@ -43,9 +43,9 @@ QT_END_NAMESPACE namespace Core { class IVersionControl; - namespace Utils { - class ParameterAction; - } +} +namespace Utils { + class ParameterAction; } namespace ProjectExplorer { @@ -136,15 +136,15 @@ private: ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; - Core::Utils::ParameterAction *m_addAction; - Core::Utils::ParameterAction *m_deleteAction; - Core::Utils::ParameterAction *m_revertAction; + Utils::ParameterAction *m_addAction; + Utils::ParameterAction *m_deleteAction; + Utils::ParameterAction *m_revertAction; QAction *m_diffProjectAction; - Core::Utils::ParameterAction *m_diffCurrentAction; + Utils::ParameterAction *m_diffCurrentAction; QAction *m_commitAllAction; - Core::Utils::ParameterAction *m_commitCurrentAction; - Core::Utils::ParameterAction *m_filelogCurrentAction; - Core::Utils::ParameterAction *m_annotateCurrentAction; + Utils::ParameterAction *m_commitCurrentAction; + Utils::ParameterAction *m_filelogCurrentAction; + Utils::ParameterAction *m_annotateCurrentAction; QAction *m_statusAction; QAction *m_updateProjectAction; QAction *m_describeAction; diff --git a/src/plugins/subversion/subversionsubmiteditor.cpp b/src/plugins/subversion/subversionsubmiteditor.cpp index 154009778cf7f2ee31332c89bf61889073273a94..e5c0f521b40745768b2c5bd613986b68fe0c1db0 100644 --- a/src/plugins/subversion/subversionsubmiteditor.cpp +++ b/src/plugins/subversion/subversionsubmiteditor.cpp @@ -37,7 +37,7 @@ using namespace Subversion::Internal; SubversionSubmitEditor::SubversionSubmitEditor(const VCSBase::VCSBaseSubmitEditorParameters *parameters, QWidget *parentWidget) : - VCSBase::VCSBaseSubmitEditor(parameters, new Core::Utils::SubmitEditorWidget(parentWidget)) + VCSBase::VCSBaseSubmitEditor(parameters, new Utils::SubmitEditorWidget(parentWidget)) { setDisplayName(tr("Subversion Submit")); } diff --git a/src/plugins/texteditor/basefilefind.cpp b/src/plugins/texteditor/basefilefind.cpp index c0e7996fefbaaac4a89c1b8225b6916089a31742..5126d2e96ab064fdff2b8dbccd600a032d2848e8 100644 --- a/src/plugins/texteditor/basefilefind.cpp +++ b/src/plugins/texteditor/basefilefind.cpp @@ -47,7 +47,7 @@ #include <QtGui/QPushButton> #include <QtGui/QFileDialog> -using namespace Core::Utils; +using namespace Utils; using namespace Find; using namespace TextEditor; @@ -91,12 +91,13 @@ void BaseFileFind::findAll(const QString &txt, QTextDocument::FindFlags findFlag if (m_filterCombo) updateComboEntries(m_filterCombo, false); m_watcher.setFuture(QFuture<FileSearchResult>()); - m_resultWindow->clearContents(); + SearchResult *result = m_resultWindow->startNewSearch(); + connect(result, SIGNAL(activated(Find::SearchResultItem)), this, SLOT(openEditor(Find::SearchResultItem))); m_resultWindow->popup(true); if (m_useRegExp) - m_watcher.setFuture(Core::Utils::findInFilesRegExp(txt, files(), findFlags, ITextEditor::openedTextEditorsContents())); + m_watcher.setFuture(Utils::findInFilesRegExp(txt, files(), findFlags, ITextEditor::openedTextEditorsContents())); else - m_watcher.setFuture(Core::Utils::findInFiles(txt, files(), findFlags, ITextEditor::openedTextEditorsContents())); + m_watcher.setFuture(Utils::findInFiles(txt, files(), findFlags, ITextEditor::openedTextEditorsContents())); Core::FutureProgress *progress = Core::ICore::instance()->progressManager()->addTask(m_watcher.future(), "Search", @@ -108,15 +109,12 @@ void BaseFileFind::findAll(const QString &txt, QTextDocument::FindFlags findFlag } void BaseFileFind::displayResult(int index) { - Core::Utils::FileSearchResult result = m_watcher.future().resultAt(index); - ResultWindowItem *item = m_resultWindow->addResult(result.fileName, + Utils::FileSearchResult result = m_watcher.future().resultAt(index); + m_resultWindow->addResult(result.fileName, result.lineNumber, result.matchingLine, result.matchStart, result.matchLength); - if (item) - connect(item, SIGNAL(activated(const QString&,int,int)), this, SLOT(openEditor(const QString&,int,int))); - if (m_resultLabel) m_resultLabel->setText(tr("%1 found").arg(m_resultWindow->numberOfResults())); } @@ -236,7 +234,7 @@ void BaseFileFind::syncRegExpSetting(bool useRegExp) m_useRegExp = useRegExp; } -void BaseFileFind::openEditor(const QString &fileName, int line, int column) +void BaseFileFind::openEditor(const Find::SearchResultItem &item) { - TextEditor::BaseTextEditor::openEditorAt(fileName, line, column); + TextEditor::BaseTextEditor::openEditorAt(item.fileName, item.lineNumber, item.searchTermStart); } diff --git a/src/plugins/texteditor/basefilefind.h b/src/plugins/texteditor/basefilefind.h index 64c45580c4df8ab590a0c6ed2c50e055cbd98ced..c31858d2409932b6bd9ea8fee0c1d7395cb72eef 100644 --- a/src/plugins/texteditor/basefilefind.h +++ b/src/plugins/texteditor/basefilefind.h @@ -49,6 +49,7 @@ QT_END_NAMESPACE namespace Find { class SearchResultWindow; +struct SearchResultItem; } namespace TextEditor { @@ -76,14 +77,14 @@ protected: private slots: void displayResult(int index); void searchFinished(); - void openEditor(const QString &fileName, int line, int column); + void openEditor(const Find::SearchResultItem &item); void syncRegExpSetting(bool useRegExp); private: QWidget *createProgressWidget(); Find::SearchResultWindow *m_resultWindow; - QFutureWatcher<Core::Utils::FileSearchResult> m_watcher; + QFutureWatcher<Utils::FileSearchResult> m_watcher; bool m_isSearching; QLabel *m_resultLabel; QStringListModel m_filterStrings; diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp index b4f6d873d522d8ab38762fd2deb0a9218e2d578c..ba6e835f3eb9080e31d03b494af2c7d30883f990 100644 --- a/src/plugins/texteditor/basetextdocument.cpp +++ b/src/plugins/texteditor/basetextdocument.cpp @@ -273,17 +273,17 @@ void BaseTextDocument::modified(Core::IFile::ReloadBehavior *behavior) #ifndef TEXTEDITOR_STANDALONE - switch (Core::Utils::reloadPrompt(m_fileName, isModified(), QApplication::activeWindow())) { - case Core::Utils::ReloadCurrent: + switch (Utils::reloadPrompt(m_fileName, isModified(), QApplication::activeWindow())) { + case Utils::ReloadCurrent: reload(); break; - case Core::Utils::ReloadAll: + case Utils::ReloadAll: reload(); *behavior = Core::IFile::ReloadAll; break; - case Core::Utils::ReloadSkipCurrent: + case Utils::ReloadSkipCurrent: break; - case Core::Utils::ReloadNone: + case Utils::ReloadNone: *behavior = Core::IFile::ReloadNone; break; } diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 0386cec46313ab268ac9ce24217e7b9cbb94820b..5de9b1c38c5cf19a72dfbf32e9949491eb4c973f 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -962,6 +962,23 @@ void BaseTextEditor::keyPressEvent(QKeyEvent *e) return; } } + } else if (!ro + && e == QKeySequence::DeleteStartOfWord + && d->m_document->tabSettings().m_autoIndent + && !textCursor().hasSelection()){ + e->accept(); + QTextCursor c = textCursor(); + int pos = c.position(); + c.movePosition(QTextCursor::PreviousWord); + int targetpos = c.position(); + forever { + handleBackspaceKey(); + int cpos = textCursor().position(); + if (cpos == pos || cpos <= targetpos) + break; + pos = cpos; + } + return; } else switch (e->key()) { @@ -2165,6 +2182,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e) block = doc->findBlockByLineNumber(block.firstLineNumber()); } } + painter.setPen(context.palette.text().color()); if (backgroundVisible() && !block.isValid() && offset.y() <= er.bottom() && (centerOnScroll() || verticalScrollBar()->maximum() == verticalScrollBar()->minimum())) { @@ -2191,9 +2209,14 @@ void BaseTextEditor::paintEvent(QPaintEvent *e) QTextBlock nextBlock = block.next(); QTextBlock nextVisibleBlock = nextBlock; - if (!nextVisibleBlock.isVisible()) + if (!nextVisibleBlock.isVisible()) { // invisible blocks do have zero line count nextVisibleBlock = doc->findBlockByLineNumber(nextVisibleBlock.firstLineNumber()); + // paranoia in case our code somewhere did not set the line count + // of the invisible block to 0 + while (nextVisibleBlock.isValid() && !nextVisibleBlock.isVisible()) + nextVisibleBlock = nextVisibleBlock.next(); + } if (block.isVisible() && bottom >= e->rect().top()) { if (d->m_displaySettings.m_visualizeWhitespace) { QTextLayout *layout = block.layout(); @@ -2312,6 +2335,7 @@ void BaseTextEditor::paintEvent(QPaintEvent *e) blockHeight += r.height(); b.setVisible(false); // restore previous state + b.setLineCount(0); // restore 0 line count for invisible block b = b.next(); } @@ -2427,7 +2451,7 @@ static void drawRectBox(QPainter *painter, const QRect &rect, bool start, bool e QRgb b = pal.base().color().rgb(); QRgb h = pal.highlight().color().rgb(); - QColor c = StyleHelper::mergedColors(b,h, 50); + QColor c = Utils::StyleHelper::mergedColors(b,h, 50); QLinearGradient grad(rect.topLeft(), rect.topRight()); grad.setColorAt(0, c.lighter(110)); @@ -3289,7 +3313,7 @@ void BaseTextEditor::handleBackspaceKey() const TextEditor::TabSettings &tabSettings = d->m_document->tabSettings(); - if (autoBackspace(cursor)) + if (tabSettings.m_autoIndent && autoBackspace(cursor)) return; if (!tabSettings.m_smartBackspace) { @@ -4678,7 +4702,7 @@ BaseTextEditorEditable::BaseTextEditorEditable(BaseTextEditor *editor) aggregate->add(editor); #endif - m_cursorPositionLabel = new Core::Utils::LineColumnLabel; + m_cursorPositionLabel = new Utils::LineColumnLabel; QHBoxLayout *l = new QHBoxLayout; QWidget *w = new QWidget; diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index f899072c39d0c0d0c4fe35fddc50cbb27ddc5fdd..0bfa24bfa23e471fbd4bf0a3f8fdbc287fb7471f 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -44,10 +44,8 @@ class QToolBar; class QTimeLine; QT_END_NAMESPACE -namespace Core { - namespace Utils { - class LineColumnLabel; - } +namespace Utils { + class LineColumnLabel; } namespace TextEditor { @@ -135,9 +133,11 @@ public: TextBlockUserData *data = static_cast<TextBlockUserData*>(block.userData()); if (!data || data->collapseMode() != CollapseAfter) { data = static_cast<TextBlockUserData*>(block.next().userData()); - if (!data || data->collapseMode() != TextBlockUserData::CollapseThis || data->m_ifdefedOut) + if (!data || data->collapseMode() != TextBlockUserData::CollapseThis) data = 0; } + if (data && data->m_ifdefedOut) + data = 0; return data; } @@ -673,7 +673,7 @@ private: BaseTextEditor *e; mutable QString m_contextHelpId; QToolBar *m_toolBar; - Core::Utils::LineColumnLabel *m_cursorPositionLabel; + Utils::LineColumnLabel *m_cursorPositionLabel; }; } // namespace TextEditor diff --git a/src/plugins/texteditor/completionsupport.cpp b/src/plugins/texteditor/completionsupport.cpp index 640e8f7bf4e460bcd03c4e71600b3ce0bc241a6c..5657650c46f3ca767ccd58f612f68d2c6dae5516 100644 --- a/src/plugins/texteditor/completionsupport.cpp +++ b/src/plugins/texteditor/completionsupport.cpp @@ -67,7 +67,7 @@ CompletionSupport::CompletionSupport() void CompletionSupport::performCompletion(const CompletionItem &item) { - item.m_collector->complete(item); + item.collector->complete(item); m_checkCompletionTrigger = true; } @@ -189,10 +189,10 @@ static bool lessThan(const QString &l, const QString &r) static bool completionItemLessThan(const CompletionItem &i1, const CompletionItem &i2) { // The order is case-insensitive in principle, but case-sensitive when this would otherwise mean equality - const QString lower1 = i1.m_text.toLower(); - const QString lower2 = i2.m_text.toLower(); + const QString lower1 = i1.text.toLower(); + const QString lower2 = i2.text.toLower(); if (lower1 == lower2) - return lessThan(i1.m_text, i2.m_text); + return lessThan(i1.text, i2.text); else return lessThan(lower1, lower2); } @@ -210,11 +210,11 @@ QList<CompletionItem> CompletionSupport::getCompletions() const QList<CompletionItem> uniquelist; foreach (const CompletionItem &item, completionItems) { - if (item.m_text != lastKey) { + if (item.text != lastKey) { uniquelist.append(item); - lastKey = item.m_text; + lastKey = item.text; } else { - uniquelist.last().m_duplicateCount++; + uniquelist.last().duplicateCount++; } } diff --git a/src/plugins/texteditor/completionwidget.cpp b/src/plugins/texteditor/completionwidget.cpp index c656500f0724e6084f4f835285bb4c6fa4059801..e4f7c97b80e0f5c0e5a9afec88f5f325a12173a4 100644 --- a/src/plugins/texteditor/completionwidget.cpp +++ b/src/plugins/texteditor/completionwidget.cpp @@ -87,11 +87,11 @@ QVariant AutoCompletionModel::data(const QModelIndex &index, int role) const return QVariant(); if (role == Qt::DisplayRole) { - return itemAt(index).m_text; + return itemAt(index).text; } else if (role == Qt::DecorationRole) { - return itemAt(index).m_icon; + return itemAt(index).icon; } else if (role == Qt::ToolTipRole) { - return itemAt(index).m_details; + return itemAt(index).details; } return QVariant(); @@ -231,8 +231,8 @@ void CompletionWidget::setCompletionItems(const QList<TextEditor::CompletionItem int mostRelevantIndex = 0; for (int i = 0; i < completionItems.size(); ++i) { const CompletionItem &item = completionItems.at(i); - if (item.m_relevance > relevance) { - relevance = item.m_relevance; + if (item.relevance > relevance) { + relevance = item.relevance; mostRelevantIndex = i; } } diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp index 5812a6df8f79967d0631e8ef27b709262e6310ca..54224bb49882ba80866401dfe2c1206757f76c38 100644 --- a/src/plugins/texteditor/fontsettingspage.cpp +++ b/src/plugins/texteditor/fontsettingspage.cpp @@ -177,7 +177,7 @@ FontSettingsPagePrivate::FontSettingsPagePrivate(const TextEditor::FormatDescrip const QString &category, const QString &trCategory) : m_name(name), - m_settingsGroup(Core::Utils::settingsKey(category)), + m_settingsGroup(Utils::settingsKey(category)), m_category(category), m_trCategory(trCategory), m_descriptions(fd), diff --git a/src/plugins/texteditor/icompletioncollector.h b/src/plugins/texteditor/icompletioncollector.h index 18cba3e61985b2866983f800028b98ab28bc6a22..da5373d035fcb13148f71db9a9b22254fb54cf8b 100644 --- a/src/plugins/texteditor/icompletioncollector.h +++ b/src/plugins/texteditor/icompletioncollector.h @@ -44,24 +44,24 @@ class ITextEditable; struct CompletionItem { CompletionItem(ICompletionCollector *collector = 0) - : m_relevance(0), - m_duplicateCount(0), - m_collector(collector) + : relevance(0), + duplicateCount(0), + collector(collector) { } bool isValid() const - { return m_collector != 0; } + { return collector != 0; } operator bool() const - { return m_collector != 0; } - - QString m_text; - QString m_details; - QIcon m_icon; - QVariant m_data; - int m_relevance; - int m_duplicateCount; - ICompletionCollector *m_collector; + { return collector != 0; } + + QString text; + QString details; + QIcon icon; + QVariant data; + int relevance; + int duplicateCount; + ICompletionCollector *collector; }; /* Defines the interface to completion collectors. A completion collector tells diff --git a/src/plugins/vcsbase/basecheckoutwizardpage.cpp b/src/plugins/vcsbase/basecheckoutwizardpage.cpp index 16c03107a95b457f18c30a5054150e4f25a43579..96b2bfce703a0b05967d95f4b3a5e1881f690434 100644 --- a/src/plugins/vcsbase/basecheckoutwizardpage.cpp +++ b/src/plugins/vcsbase/basecheckoutwizardpage.cpp @@ -45,7 +45,7 @@ BaseCheckoutWizardPage::BaseCheckoutWizardPage(QWidget *parent) : d(new BaseCheckoutWizardPagePrivate) { d->ui.setupUi(this); - d->ui.pathChooser->setExpectedKind(Core::Utils::PathChooser::Directory); + d->ui.pathChooser->setExpectedKind(Utils::PathChooser::Directory); connect(d->ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotChanged())); connect(d->ui.checkoutDirectoryLineEdit, SIGNAL(validChanged()), this, SLOT(slotChanged())); diff --git a/src/plugins/vcsbase/basecheckoutwizardpage.ui b/src/plugins/vcsbase/basecheckoutwizardpage.ui index 75ac881df2827892a8cb4fc2e061b41965afb882..7be84e63cb90832461ab5f3c7c680f3d2121a74b 100644 --- a/src/plugins/vcsbase/basecheckoutwizardpage.ui +++ b/src/plugins/vcsbase/basecheckoutwizardpage.ui @@ -37,10 +37,10 @@ </widget> </item> <item row="2" column="1"> - <widget class="Core::Utils::PathChooser" name="pathChooser"/> + <widget class="Utils::PathChooser" name="pathChooser"/> </item> <item row="1" column="1"> - <widget class="Core::Utils::ProjectNameValidatingLineEdit" name="checkoutDirectoryLineEdit"/> + <widget class="Utils::ProjectNameValidatingLineEdit" name="checkoutDirectoryLineEdit"/> </item> </layout> </item> @@ -48,12 +48,12 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::ProjectNameValidatingLineEdit</class> + <class>Utils::ProjectNameValidatingLineEdit</class> <extends>QLineEdit</extends> <header location="global">utils/projectnamevalidatinglineedit.h</header> </customwidget> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/vcsbase/vcsbasesettingspage.cpp b/src/plugins/vcsbase/vcsbasesettingspage.cpp index b74dc7c2c338c3ceaea8ed34f7d2cb9d7a8979f7..baa088a7adaaeb50006456b4760f0941cb5fd85d 100644 --- a/src/plugins/vcsbase/vcsbasesettingspage.cpp +++ b/src/plugins/vcsbase/vcsbasesettingspage.cpp @@ -50,9 +50,9 @@ VCSBaseSettingsWidget::VCSBaseSettingsWidget(QWidget *parent) : m_ui(new Ui::VCSBaseSettingsPage) { m_ui->setupUi(this); - m_ui->submitMessageCheckScriptChooser->setExpectedKind(Core::Utils::PathChooser::Command); - m_ui->nickNameFieldsFileChooser->setExpectedKind(Core::Utils::PathChooser::File); - m_ui->nickNameMailMapChooser->setExpectedKind(Core::Utils::PathChooser::File); + m_ui->submitMessageCheckScriptChooser->setExpectedKind(Utils::PathChooser::Command); + m_ui->nickNameFieldsFileChooser->setExpectedKind(Utils::PathChooser::File); + m_ui->nickNameMailMapChooser->setExpectedKind(Utils::PathChooser::File); } VCSBaseSettingsWidget::~VCSBaseSettingsWidget() diff --git a/src/plugins/vcsbase/vcsbasesettingspage.ui b/src/plugins/vcsbase/vcsbasesettingspage.ui index b4c7e2331602e9171934ba534dbf34aa99c0bf33..78a1326291cde949836eae4a2dd39daa7e770f11 100644 --- a/src/plugins/vcsbase/vcsbasesettingspage.ui +++ b/src/plugins/vcsbase/vcsbasesettingspage.ui @@ -76,7 +76,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="Core::Utils::PathChooser" name="submitMessageCheckScriptChooser" native="true"/> + <widget class="Utils::PathChooser" name="submitMessageCheckScriptChooser" native="true"/> </item> <item row="1" column="0"> <widget class="QLabel" name="nickNameMailMapLabel"> @@ -90,7 +90,7 @@ name <email> alias <email></string> </widget> </item> <item row="1" column="1"> - <widget class="Core::Utils::PathChooser" name="nickNameMailMapChooser" native="true"/> + <widget class="Utils::PathChooser" name="nickNameMailMapChooser" native="true"/> </item> <item row="2" column="0"> <widget class="QLabel" name="nickNameFieldsFileLabel"> @@ -103,7 +103,7 @@ name <email> alias <email></string> </widget> </item> <item row="2" column="1"> - <widget class="Core::Utils::PathChooser" name="nickNameFieldsFileChooser" native="true"/> + <widget class="Utils::PathChooser" name="nickNameFieldsFileChooser" native="true"/> </item> </layout> </item> @@ -142,7 +142,7 @@ name <email> alias <email></string> </widget> <customwidgets> <customwidget> - <class>Core::Utils::PathChooser</class> + <class>Utils::PathChooser</class> <extends>QWidget</extends> <header location="global">utils/pathchooser.h</header> <container>1</container> diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 93cbf344ffa495375c46880ec02a7c3796876cb2..82efcb537b528c898924c014756a3d3e36753a3b 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -81,10 +81,10 @@ static inline QString submitMessageCheckScript() struct VCSBaseSubmitEditorPrivate { VCSBaseSubmitEditorPrivate(const VCSBaseSubmitEditorParameters *parameters, - Core::Utils::SubmitEditorWidget *editorWidget, + Utils::SubmitEditorWidget *editorWidget, QObject *q); - Core::Utils::SubmitEditorWidget *m_widget; + Utils::SubmitEditorWidget *m_widget; QToolBar *m_toolWidget; const VCSBaseSubmitEditorParameters *m_parameters; QString m_displayName; @@ -98,7 +98,7 @@ struct VCSBaseSubmitEditorPrivate }; VCSBaseSubmitEditorPrivate::VCSBaseSubmitEditorPrivate(const VCSBaseSubmitEditorParameters *parameters, - Core::Utils::SubmitEditorWidget *editorWidget, + Utils::SubmitEditorWidget *editorWidget, QObject *q) : m_widget(editorWidget), m_toolWidget(0), @@ -110,7 +110,7 @@ VCSBaseSubmitEditorPrivate::VCSBaseSubmitEditorPrivate(const VCSBaseSubmitEditor } VCSBaseSubmitEditor::VCSBaseSubmitEditor(const VCSBaseSubmitEditorParameters *parameters, - Core::Utils::SubmitEditorWidget *editorWidget) : + Utils::SubmitEditorWidget *editorWidget) : m_d(new VCSBaseSubmitEditorPrivate(parameters, editorWidget, this)) { // Message font according to settings @@ -202,7 +202,7 @@ void VCSBaseSubmitEditor::createUserFields(const QString &fieldConfigFile) const QStandardItemModel *nickNameModel = Internal::VCSBasePlugin::instance()->nickNameModel(); QCompleter *completer = new QCompleter(Internal::NickNameDialog::nickNameList(nickNameModel), this); - Core::Utils::SubmitFieldWidget *fieldWidget = new Core::Utils::SubmitFieldWidget; + Utils::SubmitFieldWidget *fieldWidget = new Utils::SubmitFieldWidget; connect(fieldWidget, SIGNAL(browseButtonClicked(int,QString)), this, SLOT(slotSetFieldNickName(int))); fieldWidget->setCompleter(completer); @@ -453,11 +453,11 @@ VCSBaseSubmitEditor::PromptSubmitResult // Provide check box to turn off prompt ONLY if it was not forced if (*promptSetting && !forcePrompt) { const QDialogButtonBox::StandardButton danswer = - Core::Utils::CheckableMessageBox::question(parent, title, question, + Utils::CheckableMessageBox::question(parent, title, question, tr("Prompt to submit"), promptSetting, QDialogButtonBox::Yes|QDialogButtonBox::No|QDialogButtonBox::Cancel, QDialogButtonBox::Yes); - answer = Core::Utils::CheckableMessageBox::dialogButtonBoxToMessageBoxButton(danswer); + answer = Utils::CheckableMessageBox::dialogButtonBoxToMessageBoxButton(danswer); } else { answer = QMessageBox::question(parent, title, question, QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, @@ -502,7 +502,7 @@ void VCSBaseSubmitEditor::slotInsertNickName() void VCSBaseSubmitEditor::slotSetFieldNickName(int i) { - if (Core::Utils::SubmitFieldWidget *sfw =m_d->m_widget->submitFieldWidgets().front()) { + if (Utils::SubmitFieldWidget *sfw =m_d->m_widget->submitFieldWidgets().front()) { const QString nick = promptForNickName(); if (!nick.isEmpty()) sfw->setFieldValue(i, nick); diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.h b/src/plugins/vcsbase/vcsbasesubmiteditor.h index 8859e5f1f322d9293a32e123df3b4a3a38423089..fea9e469a228fd3e647c24990e4793707223414c 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.h +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.h @@ -43,10 +43,8 @@ class QAbstractItemModel; class QAction; QT_END_NAMESPACE -namespace Core { - namespace Utils { - class SubmitEditorWidget; - } +namespace Utils { + class SubmitEditorWidget; } namespace VCSBase { @@ -62,7 +60,7 @@ struct VCSBASE_EXPORT VCSBaseSubmitEditorParameters { const char *context; }; -/* Base class for a submit editor based on the Core::Utils::SubmitEditorWidget +/* Base class for a submit editor based on the Utils::SubmitEditorWidget * that presents the commit message in a text editor and an * checkable list of modified files in a list window. The user can delete * files from the list by pressing unchecking them or diff the selection @@ -97,7 +95,7 @@ public: protected: explicit VCSBaseSubmitEditor(const VCSBaseSubmitEditorParameters *parameters, - Core::Utils::SubmitEditorWidget *editorWidget); + Utils::SubmitEditorWidget *editorWidget); public: // Register the actions with the submit editor widget. diff --git a/src/plugins/welcome/communitywelcomepagewidget.ui b/src/plugins/welcome/communitywelcomepagewidget.ui index 7d05f30d70d6206caef42bbc319aca3783a23fe5..8bba317f79e76223b24b2c2bb046e488d9c144ef 100644 --- a/src/plugins/welcome/communitywelcomepagewidget.ui +++ b/src/plugins/welcome/communitywelcomepagewidget.ui @@ -24,7 +24,7 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="Core::Utils::WelcomeModeLabel" name="labsTitleLabel"> + <widget class="Utils::WelcomeModeLabel" name="labsTitleLabel"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <horstretch>0</horstretch> @@ -37,7 +37,7 @@ </widget> </item> <item> - <widget class="Core::Utils::WelcomeModeTreeWidget" name="newsTreeWidget"> + <widget class="Utils::WelcomeModeTreeWidget" name="newsTreeWidget"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -108,7 +108,7 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_3"> <item> - <widget class="Core::Utils::WelcomeModeLabel" name="sitesTitleLabel"> + <widget class="Utils::WelcomeModeLabel" name="sitesTitleLabel"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> <horstretch>0</horstretch> @@ -121,7 +121,7 @@ </widget> </item> <item> - <widget class="Core::Utils::WelcomeModeTreeWidget" name="sitesTreeWidget"> + <widget class="Utils::WelcomeModeTreeWidget" name="sitesTreeWidget"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -180,12 +180,12 @@ </widget> <customwidgets> <customwidget> - <class>Core::Utils::WelcomeModeTreeWidget</class> + <class>Utils::WelcomeModeTreeWidget</class> <extends>QTreeWidget</extends> <header>utils/welcomemodetreewidget.h</header> </customwidget> <customwidget> - <class>Core::Utils::WelcomeModeLabel</class> + <class>Utils::WelcomeModeLabel</class> <extends>QLabel</extends> <header>utils/welcomemodetreewidget.h</header> </customwidget> diff --git a/src/plugins/welcome/welcomemode.cpp b/src/plugins/welcome/welcomemode.cpp index c3812c0d10ff72da5b976e7c2cf5663c006cca20..9da0ad90d4e03cf865df0cd7f914bd163cabb858 100644 --- a/src/plugins/welcome/welcomemode.cpp +++ b/src/plugins/welcome/welcomemode.cpp @@ -83,7 +83,7 @@ WelcomeMode::WelcomeMode() : QVBoxLayout *l = new QVBoxLayout(m_d->m_widget); l->setMargin(0); l->setSpacing(0); - l->addWidget(new Core::Utils::StyledBar(m_d->m_widget)); + l->addWidget(new Utils::StyledBar(m_d->m_widget)); m_d->m_welcomePage = new QWidget(m_d->m_widget); m_d->ui.setupUi(m_d->m_welcomePage); m_d->ui.helpUsLabel->setAttribute(Qt::WA_LayoutUsesWidgetRect); diff --git a/src/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp index 148cad3b956b67c90d6e0d4af07bb9c4fabfc6e8..21e8a1504c014fe5e27de1fc12d9eacc895c77ec 100644 --- a/src/shared/cplusplus/AST.cpp +++ b/src/shared/cplusplus/AST.cpp @@ -2359,6 +2359,8 @@ unsigned ObjCMethodPrototypeAST::lastToken() const { if (attributes) return attributes->lastToken(); + else if (dot_dot_dot_token) + return dot_dot_dot_token + 1; else if (arguments) return arguments->lastToken(); else if (type_name) diff --git a/src/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h index b118a1dd169d7d88a5efbc425fd10f753292e945..4af1971e2ee357522755d2dfcb0e087ad155c068 100644 --- a/src/shared/cplusplus/AST.h +++ b/src/shared/cplusplus/AST.h @@ -2994,6 +2994,7 @@ public: ObjCTypeNameAST *type_name; ObjCSelectorAST *selector; ObjCMessageArgumentDeclarationListAST *arguments; + unsigned dot_dot_dot_token; SpecifierAST *attributes; public: // annotations diff --git a/src/shared/cplusplus/CPlusPlusForwardDeclarations.h b/src/shared/cplusplus/CPlusPlusForwardDeclarations.h index eaa49eb173e06170b4ba3efc1551e35e688f0174..2467d4c56b0479d63e2a0699e71ff478a98a32ae 100644 --- a/src/shared/cplusplus/CPlusPlusForwardDeclarations.h +++ b/src/shared/cplusplus/CPlusPlusForwardDeclarations.h @@ -137,6 +137,8 @@ class ForwardClassDeclaration; class Token; // Objective-C symbols +class ObjCBaseClass; +class ObjCBaseProtocol; class ObjCClass; class ObjCForwardClassDeclaration; class ObjCProtocol; diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp index 69e645b1be981c3f5815fe8b5e5a49ca0d44253f..4b2604de407ef54f7b671f5007c8b00cf1ca6530 100644 --- a/src/shared/cplusplus/CheckDeclaration.cpp +++ b/src/shared/cplusplus/CheckDeclaration.cpp @@ -57,6 +57,7 @@ #include "Control.h" #include "Literals.h" #include <cassert> +#include <QtCore/QByteArray> CPLUSPLUS_BEGIN_NAMESPACE @@ -506,11 +507,25 @@ bool CheckDeclaration::visit(ObjCProtocolDeclarationAST *ast) ObjCProtocol *protocol = control()->newObjCProtocol(sourceLocation, protocolName); protocol->setStartOffset(tokenAt(ast->firstToken()).offset); protocol->setEndOffset(tokenAt(ast->lastToken()).offset); - ast->symbol = protocol; + if (ast->protocol_refs && ast->protocol_refs->identifier_list) { + for (IdentifierListAST *iter = ast->protocol_refs->identifier_list; iter; iter = iter->next) { + NameAST* name = iter->name; + Name *protocolName = semantic()->check(name, _scope); + ObjCBaseProtocol *baseProtocol = control()->newObjCBaseProtocol(name->firstToken(), protocolName); + protocol->addProtocol(baseProtocol); + } + } + + int previousObjCVisibility = semantic()->switchObjCVisibility(Function::Public); + for (DeclarationListAST *it = ast->member_declarations; it; it = it->next) { + semantic()->check(it->declaration, protocol->members()); + } + (void) semantic()->switchObjCVisibility(previousObjCVisibility); + + ast->symbol = protocol; _scope->enterSymbol(protocol); - // TODO EV: walk protocols and method prototypes return false; } @@ -562,7 +577,21 @@ bool CheckDeclaration::visit(ObjCClassDeclarationAST *ast) klass->setCategoryName(categoryName); } - // TODO: super-class, and protocols (EV) + if (ast->superclass) { + Name *superClassName = semantic()->check(ast->superclass, _scope); + ObjCBaseClass *superKlass = control()->newObjCBaseClass(ast->superclass->firstToken(), superClassName); + klass->setBaseClass(superKlass); + } + + if (ast->protocol_refs && ast->protocol_refs->identifier_list) { + for (IdentifierListAST *iter = ast->protocol_refs->identifier_list; iter; iter = iter->next) { + NameAST* name = iter->name; + Name *protocolName = semantic()->check(name, _scope); + ObjCBaseProtocol *baseProtocol = control()->newObjCBaseProtocol(name->firstToken(), protocolName); + klass->addProtocol(baseProtocol); + } + } + _scope->enterSymbol(klass); int previousObjCVisibility = semantic()->switchObjCVisibility(Function::Protected); @@ -627,4 +656,86 @@ bool CheckDeclaration::visit(ObjCVisibilityDeclarationAST *ast) return false; } +enum PropertyAttributes { + None = 0, + Assign = 1 << 0, + Retain = 1 << 1, + Copy = 1 << 2, + ReadOnly = 1 << 3, + ReadWrite = 1 << 4, + Getter = 1 << 5, + Setter = 1 << 6, + NonAtomic = 1 << 7, + + WritabilityMask = ReadOnly | ReadWrite, + SetterSemanticsMask = Assign | Retain | Copy, +}; + +bool CheckDeclaration::checkPropertyAttribute(ObjCPropertyAttributeAST *attrAst, + int &flags, + int attr) +{ + if (flags & attr) { + translationUnit()->warning(attrAst->attribute_identifier_token, + "duplicate property attribute \"%s\"", + spell(attrAst->attribute_identifier_token)); + return false; + } else { + flags |= attr; + return true; + } +} + +bool CheckDeclaration::visit(ObjCPropertyDeclarationAST *ast) +{ + int propAttrs = None; + + for (ObjCPropertyAttributeListAST *iter= ast->property_attributes; iter; iter = iter->next) { + ObjCPropertyAttributeAST *attrAst = iter->attr; + if (!attrAst) + continue; + + const char *attrName = spell(attrAst->attribute_identifier_token); + if (!qstrcmp("getter", attrName)) { + if (checkPropertyAttribute(attrAst, propAttrs, Getter)) { + // TODO: find method declaration for getter + } + } else if (!qstrcmp("setter", attrName)) { + if (checkPropertyAttribute(attrAst, propAttrs, Setter)) { + // TODO: find method declaration for setter + } + } else if (!qstrcmp("readwrite", attrName)) { + checkPropertyAttribute(attrAst, propAttrs, ReadWrite); + } else if (!qstrcmp("readonly", attrName)) { + checkPropertyAttribute(attrAst, propAttrs, ReadOnly); + } else if (!qstrcmp("assign", attrName)) { + checkPropertyAttribute(attrAst, propAttrs, Assign); + } else if (!qstrcmp("retain", attrName)) { + checkPropertyAttribute(attrAst, propAttrs, Retain); + } else if (!qstrcmp("copy", attrName)) { + checkPropertyAttribute(attrAst, propAttrs, Copy); + } else if (!qstrcmp("nonatomic", attrName)) { + checkPropertyAttribute(attrAst, propAttrs, NonAtomic); + } + } + + if (propAttrs & ReadOnly && propAttrs & ReadWrite) + // Should this be an error instead of only a warning? + translationUnit()->warning(ast->property_token, + "property can have at most one attribute \"readonly\" or \"readwrite\" specified"); + int setterSemAttrs = propAttrs & SetterSemanticsMask; + if (setterSemAttrs + && setterSemAttrs != Assign + && setterSemAttrs != Retain + && setterSemAttrs != Copy) { + // Should this be an error instead of only a warning? + translationUnit()->warning(ast->property_token, + "property can have at most one attribute \"assign\", \"retain\", or \"copy\" specified"); + } + + // TODO: Check if the next line is correct (EV) + semantic()->check(ast->simple_declaration, _scope); + return false; +} + CPLUSPLUS_END_NAMESPACE diff --git a/src/shared/cplusplus/CheckDeclaration.h b/src/shared/cplusplus/CheckDeclaration.h index 27869c75ca3147cf34c8643686cd6aee66218afb..93ef59f941fbb4a313c13a8c2f4686cbce8f61c6 100644 --- a/src/shared/cplusplus/CheckDeclaration.h +++ b/src/shared/cplusplus/CheckDeclaration.h @@ -97,7 +97,12 @@ protected: virtual bool visit(ObjCClassForwardDeclarationAST *ast); virtual bool visit(ObjCMethodDeclarationAST *ast); virtual bool visit(ObjCVisibilityDeclarationAST *ast); + virtual bool visit(ObjCPropertyDeclarationAST *ast); +private: + bool checkPropertyAttribute(ObjCPropertyAttributeAST *attrAst, + int &flags, + int attr); private: DeclarationAST *_declaration; Scope *_scope; diff --git a/src/shared/cplusplus/CheckDeclarator.cpp b/src/shared/cplusplus/CheckDeclarator.cpp index 5186055bca9b0f160539df659269d0ebd62ed247..5867d6180aa8a254af1f2952c0a13828cf62da12 100644 --- a/src/shared/cplusplus/CheckDeclarator.cpp +++ b/src/shared/cplusplus/CheckDeclarator.cpp @@ -265,14 +265,15 @@ bool CheckDeclarator::visit(ObjCMethodPrototypeAST *ast) method->setReturnType(returnType); if (ast->selector && ast->selector->asObjCSelectorWithArguments()) { - // TODO: check the parameters (EV) - // fun->setVariadic(...); // TODO: add arguments (EV) for (ObjCMessageArgumentDeclarationListAST *it = ast->arguments; it; it = it->next) { ObjCMessageArgumentDeclarationAST *argDecl = it->argument_declaration; semantic()->check(argDecl, method->arguments()); } + + if (ast->dot_dot_dot_token) + method->setVariadic(true); } _fullySpecifiedType = FullySpecifiedType(method); diff --git a/src/shared/cplusplus/CheckName.cpp b/src/shared/cplusplus/CheckName.cpp index 84d6762cb9c6ef92c617c8d37aca78c1e661c45e..4a3e884a4727f971bf20cd974ea21da741901989 100644 --- a/src/shared/cplusplus/CheckName.cpp +++ b/src/shared/cplusplus/CheckName.cpp @@ -394,8 +394,11 @@ bool CheckName::visit(ObjCSelectorWithArgumentsAST *ast) names.push_back(name); } - _name = control()->selectorNameId(&names[0], names.size(), true); - ast->selector_name = _name; + + if (!names.empty()) { + _name = control()->selectorNameId(&names[0], names.size(), true); + ast->selector_name = _name; + } return false; } diff --git a/src/shared/cplusplus/CheckSpecifier.cpp b/src/shared/cplusplus/CheckSpecifier.cpp index 9cbef353775cfebc9dc7d24b106d4928bf08626f..d4de2c55176d6fb570c949e2e31f036d52e5d13a 100644 --- a/src/shared/cplusplus/CheckSpecifier.cpp +++ b/src/shared/cplusplus/CheckSpecifier.cpp @@ -416,8 +416,8 @@ bool CheckSpecifier::visit(AttributeSpecifierAST *ast) bool CheckSpecifier::visit(ObjCTypeNameAST * /*ast*/) { // TODO: implement this (EV) - _fullySpecifiedType = FullySpecifiedType(); - return false; +// _fullySpecifiedType = FullySpecifiedType(); + return true; } CPLUSPLUS_END_NAMESPACE diff --git a/src/shared/cplusplus/Control.cpp b/src/shared/cplusplus/Control.cpp index 07e46fd1ae234e1ddf798050cd82cffcff64fc1f..6338d99fd2251d595379ac2a2f4a3e0ae7b31340 100644 --- a/src/shared/cplusplus/Control.cpp +++ b/src/shared/cplusplus/Control.cpp @@ -128,6 +128,8 @@ public: delete_array_entries(enums); delete_array_entries(usingDeclarations); delete_array_entries(classForwardDeclarations); + delete_array_entries(objcBaseClasses); + delete_array_entries(objcBaseProtocols); delete_array_entries(objcClasses); delete_array_entries(objcProtocols); delete_array_entries(objcForwardClassDeclarations); @@ -348,6 +350,20 @@ public: return c; } + ObjCBaseClass *newObjCBaseClass(unsigned sourceLocation, Name *name) + { + ObjCBaseClass *c = new ObjCBaseClass(translationUnit, sourceLocation, name); + objcBaseClasses.push_back(c); + return c; + } + + ObjCBaseProtocol *newObjCBaseProtocol(unsigned sourceLocation, Name *name) + { + ObjCBaseProtocol *p = new ObjCBaseProtocol(translationUnit, sourceLocation, name); + objcBaseProtocols.push_back(p); + return p; + } + ObjCClass *newObjCClass(unsigned sourceLocation, Name *name) { ObjCClass *c = new ObjCClass(translationUnit, sourceLocation, name); @@ -561,6 +577,8 @@ public: std::vector<Enum *> enums; std::vector<UsingDeclaration *> usingDeclarations; std::vector<ForwardClassDeclaration *> classForwardDeclarations; + std::vector<ObjCBaseClass *> objcBaseClasses; + std::vector<ObjCBaseProtocol *> objcBaseProtocols; std::vector<ObjCClass *> objcClasses; std::vector<ObjCProtocol *> objcProtocols; std::vector<ObjCForwardClassDeclaration *> objcForwardClassDeclarations; @@ -740,6 +758,12 @@ ForwardClassDeclaration *Control::newForwardClassDeclaration(unsigned sourceLoca Name *name) { return d->newForwardClassDeclaration(sourceLocation, name); } +ObjCBaseClass *Control::newObjCBaseClass(unsigned sourceLocation, Name *name) +{ return d->newObjCBaseClass(sourceLocation, name); } + +ObjCBaseProtocol *Control::newObjCBaseProtocol(unsigned sourceLocation, Name *name) +{ return d->newObjCBaseProtocol(sourceLocation, name); } + ObjCClass *Control::newObjCClass(unsigned sourceLocation, Name *name) { return d->newObjCClass(sourceLocation, name); } diff --git a/src/shared/cplusplus/Control.h b/src/shared/cplusplus/Control.h index 323740b742288d17112679bf91e9874c4f41e4a8..060be182b685c12e924b25bbd1562c40a479aa7b 100644 --- a/src/shared/cplusplus/Control.h +++ b/src/shared/cplusplus/Control.h @@ -166,6 +166,9 @@ public: /// Creates a new ForwardClassDeclaration symbol. ForwardClassDeclaration *newForwardClassDeclaration(unsigned sourceLocation, Name *name = 0); + ObjCBaseClass *newObjCBaseClass(unsigned sourceLocation, Name *name); + ObjCBaseProtocol *newObjCBaseProtocol(unsigned sourceLocation, Name *name); + /// Creates a new Objective-C class symbol. ObjCClass *newObjCClass(unsigned sourceLocation, Name *name = 0); diff --git a/src/shared/cplusplus/ObjectiveCTypeQualifiers.cpp b/src/shared/cplusplus/ObjectiveCTypeQualifiers.cpp index fa2b7d331420422fdbc6e4fec876f04e60b44377..d12d7c322c169a938fad92c9206ac3a16ba2ffc4 100644 --- a/src/shared/cplusplus/ObjectiveCTypeQualifiers.cpp +++ b/src/shared/cplusplus/ObjectiveCTypeQualifiers.cpp @@ -51,6 +51,19 @@ static inline int classify3(const char *s) { return Token_identifier; } +static inline int classify4(const char *s) { + if (s[0] == 'c') { + if (s[1] == 'o') { + if (s[2] == 'p') { + if (s[3] == 'y') { + return Token_copy; + } + } + } + } + return Token_identifier; +} + static inline int classify5(const char *s) { if (s[0] == 'b') { if (s[1] == 'y') { @@ -78,7 +91,20 @@ static inline int classify5(const char *s) { } static inline int classify6(const char *s) { - if (s[0] == 'b') { + if (s[0] == 'a') { + if (s[1] == 's') { + if (s[2] == 's') { + if (s[3] == 'i') { + if (s[4] == 'g') { + if (s[5] == 'n') { + return Token_assign; + } + } + } + } + } + } + else if (s[0] == 'b') { if (s[1] == 'y') { if (s[2] == 'c') { if (s[3] == 'o') { @@ -91,6 +117,32 @@ static inline int classify6(const char *s) { } } } + else if (s[0] == 'g') { + if (s[1] == 'e') { + if (s[2] == 't') { + if (s[3] == 't') { + if (s[4] == 'e') { + if (s[5] == 'r') { + return Token_getter; + } + } + } + } + } + } + else if (s[0] == 's') { + if (s[1] == 'e') { + if (s[2] == 't') { + if (s[3] == 't') { + if (s[4] == 'e') { + if (s[5] == 'r') { + return Token_setter; + } + } + } + } + } + } else if (s[0] == 'o') { if (s[1] == 'n') { if (s[2] == 'e') { @@ -104,15 +156,93 @@ static inline int classify6(const char *s) { } } } + else if (s[0] == 'r') { + if (s[1] == 'e') { + if (s[2] == 't') { + if (s[3] == 'a') { + if (s[4] == 'i') { + if (s[5] == 'n') { + return Token_retain; + } + } + } + } + } + } return Token_identifier; } +static inline int classify8(const char *s) { + if (s[0] == 'r') { + if (s[1] == 'e') { + if (s[2] == 'a') { + if (s[3] == 'd') { + if (s[4] == 'o') { + if (s[5] == 'n') { + if (s[6] == 'l') { + if (s[7] == 'y') { + return Token_readonly; + } + } + } + } + } + } + } + } + return Token_identifier; +} + +static inline int classify9(const char *s) { + if (s[0] == 'n') { + if (s[1] == 'o') { + if (s[2] == 'n') { + if (s[3] == 'a') { + if (s[4] == 't') { + if (s[5] == 'o') { + if (s[6] == 'm') { + if (s[7] == 'i') { + if (s[8] == 'c') { + return Token_nonatomic; + } + } + } + } + } + } + } + } + } else if (s[0] == 'r') { + if (s[1] == 'e') { + if (s[2] == 'a') { + if (s[3] == 'd') { + if (s[4] == 'w') { + if (s[5] == 'r') { + if (s[6] == 'i') { + if (s[7] == 't') { + if (s[8] == 'e') { + return Token_readwrite; + } + } + } + } + } + } + } + } + } + return Token_identifier; +} + int classifyObjectiveCTypeQualifiers(const char *s, int n) { switch (n) { case 2: return classify2(s); case 3: return classify3(s); + case 4: return classify4(s); case 5: return classify5(s); case 6: return classify6(s); + case 8: return classify8(s); + case 9: return classify9(s); default: return Token_identifier; } // switch } diff --git a/src/shared/cplusplus/ObjectiveCTypeQualifiers.h b/src/shared/cplusplus/ObjectiveCTypeQualifiers.h index 35a69e9299d407019b771b7990001b36ecf00805..0f9cdfd6774ab75fe4e8ef8665e06f97271cfff6 100644 --- a/src/shared/cplusplus/ObjectiveCTypeQualifiers.h +++ b/src/shared/cplusplus/ObjectiveCTypeQualifiers.h @@ -37,10 +37,18 @@ CPLUSPLUS_BEGIN_NAMESPACE enum { Token_in, Token_out, + Token_copy, Token_byref, Token_inout, + Token_assign, Token_bycopy, + Token_getter, + Token_retain, + Token_setter, Token_oneway, + Token_readonly, + Token_nonatomic, + Token_readwrite, Token_identifier }; diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp index 45905829fc11948fcf8154864f9058f433f6be96..d335b5ebfff5cbc73eb6174857d6a6cce78ec245 100644 --- a/src/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -4544,7 +4544,13 @@ bool Parser::parseObjCPropertyDeclaration(DeclarationAST *&node, SpecifierAST *a last->comma_token = consumeToken(); last->next = new (_pool) ObjCPropertyAttributeListAST; last = last->next; - parseObjCPropertyAttribute(last->attr); + if (!parseObjCPropertyAttribute(last->attr)) { + _translationUnit->error(_tokenIndex, "expected token `%s' got `%s'", + Token::name(T_IDENTIFIER), tok().spell()); + while (LA() != T_RPAREN) + consumeToken(); + break; + } } } @@ -4597,15 +4603,15 @@ bool Parser::parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node) lastArg->argument_declaration = declaration; } - // TODO EV: get this in the ast while (LA() == T_COMMA) { consumeToken(); if (LA() == T_DOT_DOT_DOT) { - consumeToken(); + ast->dot_dot_dot_token = consumeToken(); break; } + // TODO: Is this still valid, and if so, should it be stored in the AST? (EV) DeclarationAST *parameter_declaration = 0; parseParameterDeclaration(parameter_declaration); } @@ -4639,28 +4645,43 @@ bool Parser::parseObjCPropertyAttribute(ObjCPropertyAttributeAST *&node) return false; node = new (_pool) ObjCPropertyAttributeAST; - match(T_IDENTIFIER, &(node->attribute_identifier_token)); - if (LA() == T_EQUAL) { - node->equals_token = consumeToken(); - unsigned identifier_token = 0; - match(T_IDENTIFIER, &identifier_token); + Identifier *id = tok().identifier; + const int k = classifyObjectiveCTypeQualifiers(id->chars(), id->size()); + switch (k) { + case Token_copy: + case Token_assign: + case Token_retain: + case Token_readonly: + case Token_readwrite: + case Token_nonatomic: + node->attribute_identifier_token = consumeToken(); + return true; - if (LA() == T_COLON) { - ObjCSelectorWithArgumentsAST *selector = new (_pool) ObjCSelectorWithArgumentsAST; - selector->selector_arguments = new (_pool) ObjCSelectorArgumentListAST; - selector->selector_arguments->argument = new (_pool) ObjCSelectorArgumentAST; - selector->selector_arguments->argument->name_token = identifier_token; - selector->selector_arguments->argument->colon_token = consumeToken(); - node->method_selector = selector; - } else { - ObjCSelectorWithoutArgumentsAST *selector = new (_pool) ObjCSelectorWithoutArgumentsAST; - selector->name_token = identifier_token; - node->method_selector = selector; - } + case Token_getter: { + node->attribute_identifier_token = consumeToken(); + match(T_EQUAL, &(node->equals_token)); + ObjCSelectorWithoutArgumentsAST *selector = new (_pool) ObjCSelectorWithoutArgumentsAST; + match(T_IDENTIFIER, &(selector->name_token)); + node->method_selector = selector; + return true; } - return true; + case Token_setter: { + node->attribute_identifier_token = consumeToken(); + match(T_EQUAL, &(node->equals_token)); + ObjCSelectorWithArgumentsAST *selector = new (_pool) ObjCSelectorWithArgumentsAST; + selector->selector_arguments = new (_pool) ObjCSelectorArgumentListAST; + selector->selector_arguments->argument = new (_pool) ObjCSelectorArgumentAST; + match(T_IDENTIFIER, &(selector->selector_arguments->argument->name_token)); + match(T_COLON, &(selector->selector_arguments->argument->colon_token)); + node->method_selector = selector; + return true; + } + + default: + return false; + } } // objc-type-name ::= T_LPAREN objc-type-qualifiers-opt type-id T_RPAREN diff --git a/src/shared/cplusplus/Symbol.h b/src/shared/cplusplus/Symbol.h index d0de211a52399e8b67b2cffff2f82fc5481c7108..511e14c9f21def5bc3aa94af5869c6b19a70440b 100644 --- a/src/shared/cplusplus/Symbol.h +++ b/src/shared/cplusplus/Symbol.h @@ -210,6 +210,9 @@ public: /// Returns true if this Symbol is a ForwardClassDeclaration. bool isForwardClassDeclaration() const; + bool isObjCBaseClass() const; + bool isObjCBaseProtocol() const; + /// Returns true if this Symbol is an Objective-C Class declaration. bool isObjCClass() const; @@ -237,6 +240,8 @@ public: virtual const Argument *asArgument() const { return 0; } virtual const BaseClass *asBaseClass() const { return 0; } virtual const ForwardClassDeclaration *asForwardClassDeclaration() const { return 0; } + virtual const ObjCBaseClass *asObjCBaseClass() const { return 0; } + virtual const ObjCBaseProtocol *asObjCBaseProtocol() const { return 0; } virtual const ObjCClass *asObjCClass() const { return 0; } virtual const ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() const { return 0; } virtual const ObjCProtocol *asObjCProtocol() const { return 0; } @@ -255,6 +260,8 @@ public: virtual Argument *asArgument() { return 0; } virtual BaseClass *asBaseClass() { return 0; } virtual ForwardClassDeclaration *asForwardClassDeclaration() { return 0; } + virtual ObjCBaseClass *asObjCBaseClass() { return 0; } + virtual ObjCBaseProtocol *asObjCBaseProtocol() { return 0; } virtual ObjCClass *asObjCClass() { return 0; } virtual ObjCForwardClassDeclaration *asObjCForwardClassDeclaration() { return 0; } virtual ObjCProtocol *asObjCProtocol() { return 0; } diff --git a/src/shared/cplusplus/SymbolVisitor.h b/src/shared/cplusplus/SymbolVisitor.h index 939dad9068681723c531c84039ca6a1b75a5d58f..8708ab03212ea7c5a08f80a09441078e875e564c 100644 --- a/src/shared/cplusplus/SymbolVisitor.h +++ b/src/shared/cplusplus/SymbolVisitor.h @@ -81,6 +81,8 @@ public: virtual bool visit(ForwardClassDeclaration *) { return true; } // Objective-C + virtual bool visit(ObjCBaseClass *) { return true; } + virtual bool visit(ObjCBaseProtocol *) { return true; } virtual bool visit(ObjCClass *) { return true; } virtual bool visit(ObjCForwardClassDeclaration *) { return true; } virtual bool visit(ObjCProtocol *) { return true; } diff --git a/src/shared/cplusplus/Symbols.cpp b/src/shared/cplusplus/Symbols.cpp index c5259c9fe8396482400bcbea87a1e4fb0b44a631..d5fa07a99b9b103d09d7a5944b34a743de196ea2 100644 --- a/src/shared/cplusplus/Symbols.cpp +++ b/src/shared/cplusplus/Symbols.cpp @@ -561,6 +561,32 @@ void Class::visitSymbol0(SymbolVisitor *visitor) } } +ObjCBaseClass::ObjCBaseClass(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name) + : Symbol(translationUnit, sourceLocation, name) +{ } + +ObjCBaseClass::~ObjCBaseClass() +{ } + +FullySpecifiedType ObjCBaseClass::type() const +{ return FullySpecifiedType(); } + +void ObjCBaseClass::visitSymbol0(SymbolVisitor *visitor) +{ visitor->visit(this); } + +ObjCBaseProtocol::ObjCBaseProtocol(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name) + : Symbol(translationUnit, sourceLocation, name) +{ } + +ObjCBaseProtocol::~ObjCBaseProtocol() +{ } + +FullySpecifiedType ObjCBaseProtocol::type() const +{ return FullySpecifiedType(); } + +void ObjCBaseProtocol::visitSymbol0(SymbolVisitor *visitor) +{ visitor->visit(this); } + ObjCClass::ObjCClass(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name): ScopedSymbol(translationUnit, sourceLocation, name), _categoryName(0), diff --git a/src/shared/cplusplus/Symbols.h b/src/shared/cplusplus/Symbols.h index 3ac7182c9a0e1f200e3294a343bd925fe126fbb1..10eb0366bffce04386977009c63551c182c9ec69 100644 --- a/src/shared/cplusplus/Symbols.h +++ b/src/shared/cplusplus/Symbols.h @@ -476,6 +476,48 @@ private: Array<BaseClass *> _baseClasses; }; +class CPLUSPLUS_EXPORT ObjCBaseClass: public Symbol +{ +public: + ObjCBaseClass(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name); + virtual ~ObjCBaseClass(); + + // Symbol's interface + virtual FullySpecifiedType type() const; + + virtual const ObjCBaseClass *asObjCBaseClass() const + { return this; } + + virtual ObjCBaseClass *asObjCBaseClass() + { return this; } + +protected: + virtual void visitSymbol0(SymbolVisitor *visitor); + +private: +}; + +class CPLUSPLUS_EXPORT ObjCBaseProtocol: public Symbol +{ +public: + ObjCBaseProtocol(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name); + virtual ~ObjCBaseProtocol(); + + // Symbol's interface + virtual FullySpecifiedType type() const; + + virtual const ObjCBaseProtocol *asObjCBaseProtocol() const + { return this; } + + virtual ObjCBaseProtocol *asObjCBaseProtocol() + { return this; } + +protected: + virtual void visitSymbol0(SymbolVisitor *visitor); + +private: +}; + class CPLUSPLUS_EXPORT ObjCForwardProtocolDeclaration: public Symbol, public Type { public: @@ -511,6 +553,15 @@ public: ObjCProtocol(TranslationUnit *translationUnit, unsigned sourceLocation, Name *name); virtual ~ObjCProtocol(); + unsigned protocolCount() const + { return _protocols.count(); } + + ObjCBaseProtocol *protocolAt(unsigned index) const + { return _protocols.at(index); } + + void addProtocol(ObjCBaseProtocol *protocol) + { _protocols.push_back(protocol); } + // Symbol's interface virtual FullySpecifiedType type() const; @@ -534,7 +585,7 @@ protected: virtual void accept0(TypeVisitor *visitor); private: - Array<ObjCProtocol *> _protocols; + Array<ObjCBaseProtocol *> _protocols; }; class CPLUSPLUS_EXPORT ObjCForwardClassDeclaration: public Symbol, public Type @@ -579,18 +630,18 @@ public: Name *categoryName() const { return _categoryName; } void setCategoryName(Name *categoryName) { _categoryName = categoryName; } - ObjCClass *baseClass() const + ObjCBaseClass *baseClass() const { return _baseClass; } - void setBaseClass(ObjCClass *baseClass) + void setBaseClass(ObjCBaseClass *baseClass) { _baseClass = baseClass; } unsigned protocolCount() const { return _protocols.count(); } - ObjCProtocol *protocolAt(unsigned index) const + ObjCBaseProtocol *protocolAt(unsigned index) const { return _protocols.at(index); } - void addProtocol(ObjCProtocol *protocol) + void addProtocol(ObjCBaseProtocol *protocol) { _protocols.push_back(protocol); } // Symbol's interface @@ -618,8 +669,8 @@ protected: private: bool _isInterface; Name *_categoryName; - ObjCClass * _baseClass; - Array<ObjCProtocol *> _protocols; + ObjCBaseClass * _baseClass; + Array<ObjCBaseProtocol *> _protocols; }; class CPLUSPLUS_EXPORT ObjCMethod: public ScopedSymbol, public Type diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 45fb093df23d4f928ea5e46113501c572c881384..6834cb2a074c739d01e3318ef892442b99a8e986 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -139,8 +139,8 @@ public: /////////////// Reading pro file bool read(ProFile *pro); - bool read(ProFile *pro, const QString &content); - bool read(ProFile *pro, QTextStream *ts); + bool read(ProBlock *pro, const QString &content); + bool read(ProBlock *pro, QTextStream *ts); ProBlock *currentBlock(); void updateItem(ushort *ptr); @@ -288,22 +288,23 @@ bool ProFileEvaluator::Private::read(ProFile *pro) } QTextStream ts(&file); + m_lineNo = 1; return read(pro, &ts); } -bool ProFileEvaluator::Private::read(ProFile *pro, const QString &content) +bool ProFileEvaluator::Private::read(ProBlock *pro, const QString &content) { QString str(content); QTextStream ts(&str, QIODevice::ReadOnly | QIODevice::Text); + m_lineNo = 1; return read(pro, &ts); } -bool ProFileEvaluator::Private::read(ProFile *pro, QTextStream *ts) +bool ProFileEvaluator::Private::read(ProBlock *pro, QTextStream *ts) { // Parser state m_block = 0; m_commentItem = 0; - m_lineNo = 1; m_blockstack.clear(); m_blockstack.push(pro); @@ -2253,8 +2254,17 @@ ProItem::ProItemReturn ProFileEvaluator::Private::evaluateConditionalFunction( return ProItem::ReturnFalse; #if 0 case T_REQUIRES: - case T_EVAL: #endif + case T_EVAL: { + ProBlock *pro = new ProBlock(0); + if (!read(pro, args.join(QLatin1String(" ")))) { + delete pro; + return ProItem::ReturnFalse; + } + bool ret = pro->Accept(this); + pro->deref(); + return returnBool(ret); + } case T_FOR: { if (m_cumulative) // This is a no-win situation, so just pretend it's no loop return ProItem::ReturnTrue; diff --git a/src/shared/trk/launcher.cpp b/src/shared/trk/launcher.cpp index 70c8ba95652586b59585feaf9fe1cebb54647a77..936d740f941ee1d5d7c0eac987af9a1c7f1850a1 100644 --- a/src/shared/trk/launcher.cpp +++ b/src/shared/trk/launcher.cpp @@ -63,6 +63,7 @@ struct LauncherPrivate { QString m_fileName; QString m_installFileName; int m_verbose; + Launcher::Actions m_startupActions; }; LauncherPrivate::LauncherPrivate() : @@ -70,9 +71,10 @@ LauncherPrivate::LauncherPrivate() : { } -Launcher::Launcher() : +Launcher::Launcher(Actions startupActions) : d(new LauncherPrivate) { + d->m_startupActions = startupActions; connect(&d->m_device, SIGNAL(messageReceived(trk::TrkResult)), this, SLOT(handleResult(trk::TrkResult))); } @@ -82,6 +84,11 @@ Launcher::~Launcher() delete d; } +void Launcher::addStartupActions(trk::Launcher::Actions startupActions) +{ + d->m_startupActions = Actions(d->m_startupActions | startupActions); +} + void Launcher::setTrkServerName(const QString &name) { d->m_trkServerName = name; @@ -120,6 +127,23 @@ bool Launcher::startServer(QString *errorMessage) .arg(d->m_trkServerName, d->m_fileName, d->m_copyState.sourceFileName, d->m_copyState.destinationFileName, d->m_installFileName); logMessage(msg); } + if (d->m_startupActions & ActionCopy) { + if (d->m_copyState.sourceFileName.isEmpty()) { + qWarning("No local filename given for copying package."); + return false; + } else if (d->m_copyState.destinationFileName.isEmpty()) { + qWarning("No remote filename given for copying package."); + return false; + } + } + if (d->m_startupActions & ActionInstall && d->m_installFileName.isEmpty()) { + qWarning("No package name given for installing."); + return false; + } + if (d->m_startupActions & ActionRun && d->m_fileName.isEmpty()) { + qWarning("No remote executable given for running."); + return false; + } if (!d->m_device.open(d->m_trkServerName, errorMessage)) return false; d->m_device.sendTrkInitialPing(); @@ -127,12 +151,13 @@ bool Launcher::startServer(QString *errorMessage) d->m_device.sendTrkMessage(TrkSupported, TrkCallback(this, &Launcher::handleSupportMask)); d->m_device.sendTrkMessage(TrkCpuType, TrkCallback(this, &Launcher::handleCpuType)); d->m_device.sendTrkMessage(TrkVersions, TrkCallback(this, &Launcher::handleTrkVersion)); - if (d->m_fileName.isEmpty()) - return true; - if (d->m_copyState.sourceFileName.isEmpty() || d->m_copyState.destinationFileName.isEmpty()) - installAndRun(); - else + + if (d->m_startupActions & ActionCopy) copyFileToRemote(); + else if (d->m_startupActions & ActionInstall) + installRemotePackageSilently(); + else if (d->m_startupActions & ActionRun) + startInferiorIfNeeded(); return true; } @@ -142,14 +167,6 @@ void Launcher::setVerbose(int v) d->m_device.setVerbose(v); } -void Launcher::installAndRun() -{ - if (!d->m_installFileName.isEmpty()) { - installRemotePackageSilently(d->m_installFileName); - } else { - startInferiorIfNeeded(); - } -} void Launcher::logMessage(const QString &msg) { if (d->m_verbose) @@ -287,7 +304,7 @@ void Launcher::handleTrkVersion(const TrkResult &result) const int protocolMajor = result.data.at(3); const int protocolMinor = result.data.at(4); // Ping mode: Log & Terminate - if (d->m_fileName.isEmpty()) { + if (d->m_startupActions == ActionPingOnly) { QString msg; QTextStream(&msg) << "CPU: " << d->m_session.cpuMajor << '.' << d->m_session.cpuMinor << ' ' << (d->m_session.bigEndian ? "big endian" : "little endian") @@ -295,14 +312,14 @@ void Launcher::handleTrkVersion(const TrkResult &result) << " float size: " << d->m_session.fpTypeSize << " Trk: v" << trkMajor << '.' << trkMinor << " Protocol: " << protocolMajor << '.' << protocolMinor; qWarning("%s", qPrintable(msg)); - d->m_device.sendTrkMessage(TrkPing, TrkCallback(this, &Launcher::waitForTrkFinished)); + emit finished(); } } void Launcher::handleFileCreation(const TrkResult &result) { if (result.errorCode() || result.data.size() < 6) { - emit canNotCreateFile(d->m_copyState.destinationFileName, errorMessage(result.errorCode())); + emit canNotCreateFile(d->m_copyState.destinationFileName, result.errorString()); emit finished(); return; } @@ -318,15 +335,19 @@ void Launcher::handleFileCreation(const TrkResult &result) void Launcher::handleCopy(const TrkResult &result) { - Q_UNUSED(result) - - continueCopying(); + if (result.errorCode() || result.data.size() < 4) { + closeRemoteFile(true); + emit canNotWriteFile(d->m_copyState.destinationFileName, result.errorString()); + emit finished(); + } else { + continueCopying(extractShort(result.data.data() + 2)); + } } -void Launcher::continueCopying() +void Launcher::continueCopying(uint lastCopiedBlockSize) { - static const int BLOCKSIZE = 1024; int size = d->m_copyState.data->length(); + d->m_copyState.position += lastCopiedBlockSize; if (size == 0) emit copyProgress(100); else { @@ -336,22 +357,33 @@ void Launcher::continueCopying() if (d->m_copyState.position < size) { QByteArray ba; appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder); - appendString(&ba, d->m_copyState.data->mid(d->m_copyState.position, BLOCKSIZE), TargetByteOrder, false); - d->m_copyState.position += BLOCKSIZE; + appendString(&ba, d->m_copyState.data->mid(d->m_copyState.position, 2048), TargetByteOrder, false); d->m_device.sendTrkMessage(TrkWriteFile, TrkCallback(this, &Launcher::handleCopy), ba); } else { - QByteArray ba; - appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder); - appendInt(&ba, QDateTime::currentDateTime().toTime_t(), TargetByteOrder); - d->m_device.sendTrkMessage(TrkCloseFile, TrkCallback(this, &Launcher::handleFileCopied), ba); - d->m_copyState.data.reset(); + closeRemoteFile(); } } +void Launcher::closeRemoteFile(bool failed) +{ + QByteArray ba; + appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder); + appendInt(&ba, QDateTime::currentDateTime().toTime_t(), TargetByteOrder); + d->m_device.sendTrkMessage(TrkCloseFile, + failed ? TrkCallback() : TrkCallback(this, &Launcher::handleFileCopied), + ba); + d->m_copyState.data.reset(); +} + void Launcher::handleFileCopied(const TrkResult &result) { Q_UNUSED(result) - installAndRun(); + if (d->m_startupActions & ActionInstall) + installRemotePackageSilently(); + else if (d->m_startupActions & ActionRun) + startInferiorIfNeeded(); + else + emit finished(); } void Launcher::handleCpuType(const TrkResult &result) @@ -375,7 +407,7 @@ void Launcher::handleCpuType(const TrkResult &result) void Launcher::handleCreateProcess(const TrkResult &result) { if (result.errorCode()) { - emit canNotRun(errorMessage(result.errorCode())); + emit canNotRun(result.errorString()); emit finished(); return; } @@ -486,21 +518,24 @@ void Launcher::copyFileToRemote() d->m_device.sendTrkMessage(TrkOpenFile, TrkCallback(this, &Launcher::handleFileCreation), ba); } -void Launcher::installRemotePackageSilently(const QString &fileName) +void Launcher::installRemotePackageSilently() { emit installingStarted(); QByteArray ba; appendByte(&ba, 'C'); - appendString(&ba, fileName.toLocal8Bit(), TargetByteOrder, false); + appendString(&ba, d->m_installFileName.toLocal8Bit(), TargetByteOrder, false); d->m_device.sendTrkMessage(TrkInstallFile, TrkCallback(this, &Launcher::handleInstallPackageFinished), ba); } -void Launcher::handleInstallPackageFinished(const TrkResult &) +void Launcher::handleInstallPackageFinished(const TrkResult &result) { - if (d->m_fileName.isEmpty()) { + if (result.errorCode()) { + emit canNotInstall(d->m_installFileName, result.errorString()); emit finished(); - } else { + } else if (d->m_startupActions & ActionRun) { startInferiorIfNeeded(); + } else { + emit finished(); } } diff --git a/src/shared/trk/launcher.h b/src/shared/trk/launcher.h index ec1048885caff804aac1635600df44bcfabe28d7..3c84e6f9d90d544524eb9d2589f0f5ed00f70e00 100644 --- a/src/shared/trk/launcher.h +++ b/src/shared/trk/launcher.h @@ -44,8 +44,20 @@ class Launcher : public QObject public: typedef void (Launcher::*TrkCallBack)(const TrkResult &); - Launcher(); + enum Actions { + ActionPingOnly = 0x0, + ActionCopy = 0x1, + ActionInstall = 0x2, + ActionCopyInstall = ActionCopy | ActionInstall, + ActionRun = 0x4, + ActionCopyRun = ActionCopy | ActionRun, + ActionInstallRun = ActionInstall | ActionRun, + ActionCopyInstallRun = ActionCopy | ActionInstall | ActionRun + }; + + Launcher(trk::Launcher::Actions startupActions = trk::Launcher::ActionPingOnly); ~Launcher(); + void addStartupActions(trk::Launcher::Actions startupActions); void setTrkServerName(const QString &name); void setFileName(const QString &name); void setCopyFileName(const QString &srcName, const QString &dstName); @@ -58,7 +70,9 @@ public: signals: void copyingStarted(); void canNotCreateFile(const QString &filename, const QString &errorMessage); + void canNotWriteFile(const QString &filename, const QString &errorMessage); void installingStarted(); + void canNotInstall(const QString &packageFilename, const QString &errorMessage); void startingApplication(); void applicationRunning(uint pid); void canNotRun(const QString &errorMessage); @@ -78,7 +92,8 @@ private: void handleFileCreation(const TrkResult &result); void handleCopy(const TrkResult &result); - void continueCopying(); + void continueCopying(uint lastCopiedBlockSize = 0); + void closeRemoteFile(bool failed = false); void handleFileCopied(const TrkResult &result); void handleInstallPackageFinished(const TrkResult &result); void handleCpuType(const TrkResult &result); @@ -90,8 +105,7 @@ private: void waitForTrkFinished(const TrkResult &data); void copyFileToRemote(); - void installRemotePackageSilently(const QString &filename); - void installAndRun(); + void installRemotePackageSilently(); void startInferiorIfNeeded(); void logMessage(const QString &msg); diff --git a/src/shared/trk/trkdevice.cpp b/src/shared/trk/trkdevice.cpp index a227e0c3a522c0e5fe571c043abf032786e6849f..c7ebe792b7bc203dd92656bdf26f38ada5deab79 100644 --- a/src/shared/trk/trkdevice.cpp +++ b/src/shared/trk/trkdevice.cpp @@ -836,6 +836,8 @@ TrkDevice::~TrkDevice() bool TrkDevice::open(const QString &port, QString *errorMessage) { + if (d->verbose) + qDebug() << "Opening" << port << "is open: " << isOpen(); close(); #ifdef Q_OS_WIN d->deviceContext->device = CreateFile(port.toStdWString().c_str(), @@ -908,6 +910,8 @@ void TrkDevice::close() { if (!isOpen()) return; + d->readerThread->terminate(); + d->writerThread->terminate(); #ifdef Q_OS_WIN CloseHandle(d->deviceContext->device); d->deviceContext->device = INVALID_HANDLE_VALUE; @@ -917,8 +921,6 @@ void TrkDevice::close() #else d->deviceContext->file.close(); #endif - d->readerThread->terminate(); - d->writerThread->terminate(); if (d->verbose) emitLogMessage("Close"); } diff --git a/src/shared/trk/trkutils.cpp b/src/shared/trk/trkutils.cpp index e40944a66cff3f7c23647ad8816b33d1513bd7e1..7d31f586ff431e869b4f6de7bdf5c8e0b13f92a5 100644 --- a/src/shared/trk/trkutils.cpp +++ b/src/shared/trk/trkutils.cpp @@ -36,6 +36,32 @@ namespace trk { +// FIXME: Use the QByteArray based version below? +QString stringFromByte(byte c) +{ + return QString("%1 ").arg(c, 2, 16, QChar('0')); +} + +QString stringFromArray(const QByteArray &ba, int maxLen) +{ + QString str; + QString ascii; + const int size = maxLen == -1 ? ba.size() : qMin(ba.size(), maxLen); + for (int i = 0; i < size; ++i) { + //if (i == 5 || i == ba.size() - 2) + // str += " "; + int c = byte(ba.at(i)); + str += QString("%1 ").arg(c, 2, 16, QChar('0')); + if (i >= 8 && i < ba.size() - 2) + ascii += QChar(c).isPrint() ? QChar(c) : QChar('.'); + } + if (size != ba.size()) { + str += "..."; + ascii += "..."; + } + return str + " " + ascii; +} + QByteArray hexNumber(uint n, int digits) { QByteArray ba = QByteArray::number(n, 16); @@ -235,32 +261,6 @@ QByteArray encode7d(const QByteArray &ba) return res; } -// FIXME: Use the QByteArray based version below? -QString stringFromByte(byte c) -{ - return QString("%1 ").arg(c, 2, 16, QChar('0')); -} - -QString stringFromArray(const QByteArray &ba, int maxLen) -{ - QString str; - QString ascii; - const int size = maxLen == -1 ? ba.size() : qMin(ba.size(), maxLen); - for (int i = 0; i < size; ++i) { - //if (i == 5 || i == ba.size() - 2) - // str += " "; - int c = byte(ba.at(i)); - str += QString("%1 ").arg(c, 2, 16, QChar('0')); - if (i >= 8 && i < ba.size() - 2) - ascii += QChar(c).isPrint() ? QChar(c) : QChar('.'); - } - if (size != ba.size()) { - str += "..."; - ascii += "..."; - } - return str + " " + ascii; -} - void appendByte(QByteArray *ba, byte b) { ba->append(b); @@ -362,12 +362,5 @@ QString TrkResult::errorString() const return errorMessage(data.at(0)); } -void Snapshot::reset() -{ - memory.clear(); - for (int i = 0; i < RegisterCount; ++i) - registers[i] = 0; -} - } // namespace trk diff --git a/src/shared/trk/trkutils.h b/src/shared/trk/trkutils.h index 36bff80c4db3f0324b92eed8ab5321f2fb2fcf3f..e8388356c533f47cf7766b28ee72374478643137 100644 --- a/src/shared/trk/trkutils.h +++ b/src/shared/trk/trkutils.h @@ -78,8 +78,6 @@ uint extractInt(const char *data); QString quoteUnprintableLatin1(const QByteArray &ba); -// produces "xx " -QString stringFromByte(byte c); // produces "xx xx xx " QString stringFromArray(const QByteArray &ba, int maxLen = - 1); @@ -95,25 +93,6 @@ void appendShort(QByteArray *ba, ushort s, Endianness = TargetByteOrder); void appendInt(QByteArray *ba, uint i, Endianness = TargetByteOrder); void appendString(QByteArray *ba, const QByteArray &str, Endianness = TargetByteOrder, bool appendNullTerminator = true); -enum CodeMode -{ - ArmMode = 0, - ThumbMode, -}; - -enum TargetConstants -{ - - RegisterCount = 17, - RegisterSP = 13, // Stack Pointer - RegisterLR = 14, // Return address - RegisterPC = 15, // Program counter - RegisterPSGdb = 25, // gdb's view of the world - RegisterPSTrk = 16, // TRK's view of the world - - MemoryChunkSize = 256 -}; - struct Library { Library() {} @@ -166,29 +145,6 @@ struct Session QStringList modules; }; -struct Snapshot -{ - void reset(); - - uint registers[RegisterCount]; - typedef QHash<uint, QByteArray> Memory; - Memory memory; -}; - - -struct Breakpoint -{ - Breakpoint(uint offset_ = 0) - { - number = 0; - offset = offset_; - mode = ArmMode; - } - uint offset; - ushort number; - CodeMode mode; -}; - struct TrkResult { TrkResult(); diff --git a/src/tools/qtcreatorwidgets/customwidgets.cpp b/src/tools/qtcreatorwidgets/customwidgets.cpp index e8867a59fab2f736577d34fd71cd55475ba9d1ba..011e8199084a14d52ccea1f8240cc499c57efaaa 100644 --- a/src/tools/qtcreatorwidgets/customwidgets.cpp +++ b/src/tools/qtcreatorwidgets/customwidgets.cpp @@ -38,7 +38,7 @@ static const char *groupC = "QtCreator"; NewClassCustomWidget::NewClassCustomWidget(QObject *parent) : QObject(parent), - CustomWidget<Core::Utils::NewClassWidget> + CustomWidget<Utils::NewClassWidget> (QLatin1String("<utils/newclasswidget.h>"), false, QLatin1String(groupC), @@ -49,7 +49,7 @@ NewClassCustomWidget::NewClassCustomWidget(QObject *parent) : ClassNameValidatingLineEdit_CW::ClassNameValidatingLineEdit_CW(QObject *parent) : QObject(parent), - CustomWidget<Core::Utils::ClassNameValidatingLineEdit> + CustomWidget<Utils::ClassNameValidatingLineEdit> (QLatin1String("<utils/classnamevalidatinglineedit.h>"), false, QLatin1String(groupC), @@ -60,7 +60,7 @@ ClassNameValidatingLineEdit_CW::ClassNameValidatingLineEdit_CW(QObject *parent) FileNameValidatingLineEdit_CW::FileNameValidatingLineEdit_CW(QObject *parent) : QObject(parent), - CustomWidget<Core::Utils::FileNameValidatingLineEdit> + CustomWidget<Utils::FileNameValidatingLineEdit> (QLatin1String("<utils/filenamevalidatinglineedit.h>"), false, QLatin1String(groupC), @@ -71,7 +71,7 @@ FileNameValidatingLineEdit_CW::FileNameValidatingLineEdit_CW(QObject *parent) : ProjectNameValidatingLineEdit_CW::ProjectNameValidatingLineEdit_CW(QObject *parent) : QObject(parent), - CustomWidget<Core::Utils::ProjectNameValidatingLineEdit> + CustomWidget<Utils::ProjectNameValidatingLineEdit> (QLatin1String("<utils/projectnamevalidatinglineedit.h>"), false, QLatin1String(groupC), @@ -82,7 +82,7 @@ ProjectNameValidatingLineEdit_CW::ProjectNameValidatingLineEdit_CW(QObject *pare LineColumnLabel_CW::LineColumnLabel_CW(QObject *parent) : QObject(parent), - CustomWidget<Core::Utils::LineColumnLabel> + CustomWidget<Utils::LineColumnLabel> (QLatin1String("<utils/linecolumnlabel.h>"), false, QLatin1String(groupC), @@ -94,7 +94,7 @@ LineColumnLabel_CW::LineColumnLabel_CW(QObject *parent) : PathChooser_CW::PathChooser_CW(QObject *parent) : QObject(parent), - CustomWidget<Core::Utils::PathChooser> + CustomWidget<Utils::PathChooser> (QLatin1String("<utils/pathchooser.h>"), false, QLatin1String(groupC), @@ -105,7 +105,7 @@ PathChooser_CW::PathChooser_CW(QObject *parent) : FancyLineEdit_CW::FancyLineEdit_CW(QObject *parent) : QObject(parent), - CustomWidget<Core::Utils::FancyLineEdit> + CustomWidget<Utils::FancyLineEdit> (QLatin1String("<utils/fancylineedit.h>"), false, QLatin1String(groupC), @@ -116,7 +116,7 @@ FancyLineEdit_CW::FancyLineEdit_CW(QObject *parent) : QtColorButton_CW::QtColorButton_CW(QObject *parent) : QObject(parent), - CustomWidget<Core::Utils::QtColorButton> + CustomWidget<Utils::QtColorButton> (QLatin1String("<utils/qtcolorbutton.h>"), false, QLatin1String(groupC), @@ -127,7 +127,7 @@ QtColorButton_CW::QtColorButton_CW(QObject *parent) : QWidget *FancyLineEdit_CW::createWidget(QWidget *parent) { - Core::Utils::FancyLineEdit *fle = new Core::Utils::FancyLineEdit(parent); + Utils::FancyLineEdit *fle = new Utils::FancyLineEdit(parent); QMenu *menu = new QMenu(fle); menu->addAction("Test"); fle->setMenu(menu); @@ -136,7 +136,7 @@ QWidget *FancyLineEdit_CW::createWidget(QWidget *parent) SubmitEditorWidget_CW::SubmitEditorWidget_CW(QObject *parent) : QObject(parent), - CustomWidget<Core::Utils::SubmitEditorWidget> + CustomWidget<Utils::SubmitEditorWidget> (QLatin1String("<utils/submiteditorwidget.h>"), false, QLatin1String(groupC), @@ -147,7 +147,7 @@ SubmitEditorWidget_CW::SubmitEditorWidget_CW(QObject *parent) : SubmitFieldWidget_CW::SubmitFieldWidget_CW(QObject *parent) : QObject(parent), - CustomWidget<Core::Utils::SubmitFieldWidget> + CustomWidget<Utils::SubmitFieldWidget> (QLatin1String("<utils/submitfieldwidget.h>"), false, QLatin1String(groupC), @@ -158,7 +158,7 @@ SubmitFieldWidget_CW::SubmitFieldWidget_CW(QObject *parent) : PathListEditor_CW::PathListEditor_CW(QObject *parent) : QObject(parent), - CustomWidget<Core::Utils::PathListEditor> + CustomWidget<Utils::PathListEditor> (QLatin1String("<utils/pathlisteditor.h>"), false, QLatin1String(groupC), diff --git a/src/tools/qtcreatorwidgets/customwidgets.h b/src/tools/qtcreatorwidgets/customwidgets.h index f9999d203072a2ad179728b721a81d25aff9c024..0543c78764b5097e8f6a4d54582945372824a850 100644 --- a/src/tools/qtcreatorwidgets/customwidgets.h +++ b/src/tools/qtcreatorwidgets/customwidgets.h @@ -61,7 +61,7 @@ QT_END_NAMESPACE class NewClassCustomWidget : public QObject, - public CustomWidget<Core::Utils::NewClassWidget> + public CustomWidget<Utils::NewClassWidget> { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) @@ -71,7 +71,7 @@ public: class ClassNameValidatingLineEdit_CW : public QObject, - public CustomWidget<Core::Utils::ClassNameValidatingLineEdit> + public CustomWidget<Utils::ClassNameValidatingLineEdit> { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) @@ -81,7 +81,7 @@ public: class FileNameValidatingLineEdit_CW : public QObject, - public CustomWidget<Core::Utils::FileNameValidatingLineEdit> + public CustomWidget<Utils::FileNameValidatingLineEdit> { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) @@ -91,7 +91,7 @@ public: class ProjectNameValidatingLineEdit_CW : public QObject, - public CustomWidget<Core::Utils::ProjectNameValidatingLineEdit> + public CustomWidget<Utils::ProjectNameValidatingLineEdit> { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) @@ -101,7 +101,7 @@ public: class LineColumnLabel_CW : public QObject, - public CustomWidget<Core::Utils::LineColumnLabel> + public CustomWidget<Utils::LineColumnLabel> { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) @@ -111,7 +111,7 @@ public: class PathChooser_CW : public QObject, - public CustomWidget<Core::Utils::PathChooser> + public CustomWidget<Utils::PathChooser> { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) @@ -121,7 +121,7 @@ public: class FancyLineEdit_CW : public QObject, - public CustomWidget<Core::Utils::FancyLineEdit> + public CustomWidget<Utils::FancyLineEdit> { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) @@ -133,7 +133,7 @@ public: class QtColorButton_CW : public QObject, - public CustomWidget<Core::Utils::QtColorButton> + public CustomWidget<Utils::QtColorButton> { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) @@ -143,7 +143,7 @@ public: class SubmitEditorWidget_CW : public QObject, - public CustomWidget<Core::Utils::SubmitEditorWidget> + public CustomWidget<Utils::SubmitEditorWidget> { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) @@ -153,7 +153,7 @@ public: class SubmitFieldWidget_CW : public QObject, - public CustomWidget<Core::Utils::SubmitFieldWidget> + public CustomWidget<Utils::SubmitFieldWidget> { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) @@ -163,7 +163,7 @@ public: class PathListEditor_CW : public QObject, - public CustomWidget<Core::Utils::PathListEditor> + public CustomWidget<Utils::PathListEditor> { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) diff --git a/tests/manual/trklauncher/main.cpp b/tests/manual/trklauncher/main.cpp index b888e6bf25fc0029e8a29ae43fb5eff6bdc87e7b..65031e7cc5aab100945db92aa3708553f0f11a6f 100644 --- a/tests/manual/trklauncher/main.cpp +++ b/tests/manual/trklauncher/main.cpp @@ -50,9 +50,11 @@ static bool parseArguments(const QStringList &arguments, trk::Launcher &launcher break;verbosity++; case 'i': install = true; + launcher.addStartupActions(trk::Launcher::ActionInstall); break; case 'I': customInstall = true; + launcher.addStartupActions(trk::Launcher::ActionCopyInstall); break; default: return false; @@ -68,23 +70,28 @@ static bool parseArguments(const QStringList &arguments, trk::Launcher &launcher } if (remainingArgsCount == 2 && !install && !customInstall) { // remote exec - launcher.setTrkServerName(arguments.at(a)); // ping + launcher.addStartupActions(trk::Launcher::ActionRun); + launcher.setTrkServerName(arguments.at(a)); launcher.setFileName(arguments.at(a + 1)); return true; } if ((remainingArgsCount == 3 || remainingArgsCount == 2) && install && !customInstall) { launcher.setTrkServerName(arguments.at(a)); // ping launcher.setInstallFileName(arguments.at(a + 1)); - if (remainingArgsCount == 3) + if (remainingArgsCount == 3) { + launcher.addStartupActions(trk::Launcher::ActionRun); launcher.setFileName(arguments.at(a + 2)); + } return true; } if ((remainingArgsCount == 4 || remainingArgsCount == 3) && !install && customInstall) { launcher.setTrkServerName(arguments.at(a)); // ping launcher.setCopyFileName(arguments.at(a + 1), arguments.at(a + 2)); launcher.setInstallFileName(arguments.at(a + 2)); - if (remainingArgsCount == 4) + if (remainingArgsCount == 4) { + launcher.addStartupActions(trk::Launcher::ActionRun); launcher.setFileName(arguments.at(a + 3)); + } return true; } return false;