diff --git a/bin/gdbmacros/gdbmacros.cpp b/bin/gdbmacros/gdbmacros.cpp index 7a304607b6ccbeb506ed3d9096733bf5cf8f8b4e..5b9b36d1282cec5e5bbc943e1d72f52b8f19b621 100644 --- a/bin/gdbmacros/gdbmacros.cpp +++ b/bin/gdbmacros/gdbmacros.cpp @@ -36,24 +36,42 @@ // this relies on contents copied from qobject_p.h #define PRIVATE_OBJECT_ALLOWED 1 -#include <QDateTime> -#include <QDebug> -#include <QDir> -#include <QFile> -#include <QFileInfo> -#include <QHash> -#include <QLinkedList> -#include <QLocale> -#include <QMap> -#include <QMetaObject> -#include <QMetaProperty> -#include <QModelIndex> -#include <QObject> -#include <QPointer> -#include <QString> -#include <QTextCodec> -#include <QVector> +#include <QtCore/QDateTime> +#include <QtCore/QDebug> +#include <QtCore/QDir> +#include <QtCore/QFile> +#include <QtCore/QFileInfo> +#include <QtCore/QHash> +#include <QtCore/QLinkedList> +#include <QtCore/QLocale> +#include <QtCore/QMap> +#include <QtCore/QMetaObject> +#include <QtCore/QMetaProperty> +#include <QtCore/QModelIndex> +#include <QtCore/QObject> +#include <QtCore/QPointer> +#include <QtCore/QString> +#include <QtCore/QTextCodec> +#include <QtCore/QVector> +int qtGhVersion = QT_VERSION; + +#ifdef QT_GUI_LIB +# include <QtGui/QPixmap> +# include <QtGui/QImage> +#endif + +#include <list> +#include <map> +#include <string> +#include <vector> + +#include <ctype.h> +#include <stdio.h> + +#ifdef Q_OS_WIN +# include <windows.h> +#endif /*! \class QDumper @@ -91,7 +109,7 @@ 'P(d, name, value)' roughly expands to: - d << (name) << "=\"" << value << "\""; + d << (name) << "='" << value << "'"; Useful (i.e. understood by the IDE) names include: @@ -117,25 +135,6 @@ */ -int qtGhVersion = QT_VERSION; - -#ifdef QT_GUI_LIB -# include <QPixmap> -# include <QImage> -#endif - -#include <list> -#include <map> -#include <string> -#include <vector> - -#include <ctype.h> -#include <stdio.h> - -#ifdef Q_OS_WIN -# include <windows.h> -#endif - #undef NS #ifdef QT_NAMESPACE # define STRINGIFY0(s) #s @@ -216,7 +215,8 @@ QT_END_NAMESPACE // this can be mangled typenames of nested templates, each char-by-char // comma-separated integer list static char qDumpInBuffer[10000]; -static char qDumpBuffer[1000]; +static char qDumpOutBuffer[100000]; +static char qDumpSize[20]; namespace { @@ -385,7 +385,6 @@ struct QDumper { explicit QDumper(); ~QDumper(); - void flush(); void checkFill(); QDumper &operator<<(long c); QDumper &operator<<(int i); @@ -407,8 +406,6 @@ struct QDumper void beginHash(); // start of data hash output void endHash(); // start of data hash output - void write(const void *buf, int len); // raw write to stdout - // the dumper arguments int protocolVersion; // dumper protocol version int token; // some token to show on success @@ -427,6 +424,7 @@ struct QDumper // internal state bool success; // are we finished? + bool full; int pos; int extraInt[4]; @@ -436,34 +434,16 @@ struct QDumper QDumper::QDumper() { success = false; - pos = 0; + full = false; + qDumpOutBuffer[0] = 'f'; // marks output as 'wrong' + pos = 1; } QDumper::~QDumper() { - flush(); - - char buf[30]; - int len = qsnprintf(buf, sizeof(buf) - 1, "%d^done\n", token); - write(buf, len); -} - -void QDumper::write(const void *buf, int len) -{ - ::fwrite(buf, len, 1, stdout); - ::fflush(stdout); -} - -void QDumper::flush() -{ - if (pos != 0) { - char buf[30]; - int len = qsnprintf(buf, sizeof(buf) - 1, "%d#%d,", token, pos); - write(buf, len); - write(qDumpBuffer, pos); - write("\n", 1); - pos = 0; - } + qDumpOutBuffer[pos++] = '\0'; + if (success) + qDumpOutBuffer[0] = (full ? '+' : 't'); } void QDumper::setupTemplateParameters() @@ -489,49 +469,49 @@ void QDumper::setupTemplateParameters() QDumper &QDumper::operator<<(unsigned long long c) { checkFill(); - pos += sprintf(qDumpBuffer + pos, "%llu", c); + pos += sprintf(qDumpOutBuffer + pos, "%llu", c); return *this; } QDumper &QDumper::operator<<(unsigned long c) { checkFill(); - pos += sprintf(qDumpBuffer + pos, "%lu", c); + pos += sprintf(qDumpOutBuffer + pos, "%lu", c); return *this; } QDumper &QDumper::operator<<(float d) { checkFill(); - pos += sprintf(qDumpBuffer + pos, "%f", d); + pos += sprintf(qDumpOutBuffer + pos, "%f", d); return *this; } QDumper &QDumper::operator<<(double d) { checkFill(); - pos += sprintf(qDumpBuffer + pos, "%f", d); + pos += sprintf(qDumpOutBuffer + pos, "%f", d); return *this; } QDumper &QDumper::operator<<(unsigned int i) { checkFill(); - pos += sprintf(qDumpBuffer + pos, "%u", i); + pos += sprintf(qDumpOutBuffer + pos, "%u", i); return *this; } QDumper &QDumper::operator<<(long c) { checkFill(); - pos += sprintf(qDumpBuffer + pos, "%ld", c); + pos += sprintf(qDumpOutBuffer + pos, "%ld", c); return *this; } QDumper &QDumper::operator<<(int i) { checkFill(); - pos += sprintf(qDumpBuffer + pos, "%d", i); + pos += sprintf(qDumpOutBuffer + pos, "%d", i); return *this; } @@ -555,22 +535,23 @@ QDumper &QDumper::operator<<(const void *p) void QDumper::checkFill() { - if (pos >= int(sizeof(qDumpBuffer)) - 100) - flush(); + if (pos >= int(sizeof(qDumpOutBuffer)) - 100) + full = true; } void QDumper::put(char c) { checkFill(); - qDumpBuffer[pos++] = c; + if (!full) + qDumpOutBuffer[pos++] = c; } void QDumper::addCommaIfNeeded() { if (pos == 0) return; - char c = qDumpBuffer[pos - 1]; - if (c == '}' || c == '"' || c == ']') + char c = qDumpOutBuffer[pos - 1]; + if (c == '}' || c == '\'' || c == ']') put(','); } @@ -632,7 +613,6 @@ QDumper &QDumper::operator<<(const QString &str) void QDumper::disarm() { - flush(); success = true; } @@ -650,7 +630,7 @@ void QDumper::endHash() void QDumper::putEllipsis() { addCommaIfNeeded(); - *this << "{name=\"<incomplete>\",value=\"\",type=\"" << innertype << "\"}"; + *this << "{name='<incomplete>',value='',type='" << innertype << "'}"; } // @@ -662,7 +642,7 @@ void QDumper::putEllipsis() #define P(dumper,name,value) \ do { \ dumper.addCommaIfNeeded(); \ - dumper << (name) << "=\"" << value << "\""; \ + dumper << (name) << "='" << value << "'"; \ } while (0) // simple string property @@ -760,7 +740,7 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr return; case 'B': if (isEqual(type, "QByteArray")) { - d << key << "encoded=\"1\","; + d << key << "encoded='1',"; P(d, key, *(QByteArray*)addr); } return; @@ -789,7 +769,7 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr return; case 'S': if (isEqual(type, "QString")) { - d << key << "encoded=\"1\","; + d << key << "encoded='1',"; P(d, key, *(QString*)addr); } return; @@ -856,7 +836,7 @@ static void qDumpQByteArray(QDumper &d) char buf[20]; for (int i = 0; i != ba.size(); ++i) { unsigned char c = ba.at(i); - unsigned char u = isprint(c) && c != '"' ? c : '?'; + unsigned char u = (isprint(c) && c != '\'' && c != '"') ? c : '?'; sprintf(buf, "%02x (%u '%c')", c, c, u); d.beginHash(); P(d, "name", "[" << i << "]"); @@ -2028,7 +2008,7 @@ static void qDumpQVariantHelper(const void *data, QString *value, *numchild = 0; break; case QVariant::String: - *value = QLatin1Char('"') + v.toString() + QLatin1Char('"'); + *value = QLatin1Char('\'') + v.toString() + QLatin1Char('\''); *numchild = 0; break; case QVariant::StringList: @@ -2260,9 +2240,9 @@ static void qDumpStdString(QDumper &d) qCheckAccess(str.c_str() + str.size() - 1); } - d << ",value=\""; + d << ",value='"; d.putBase64Encoded(str.c_str(), str.size()); - d << "\""; + d << "'"; P(d, "valueencoded", "1"); P(d, "type", "std::string"); P(d, "numchild", "0"); @@ -2279,9 +2259,9 @@ static void qDumpStdWString(QDumper &d) qCheckAccess(str.c_str() + str.size() - 1); } - d << "value=\""; + d << "value='"; d.putBase64Encoded((const char *)str.c_str(), str.size() * sizeof(wchar_t)); - d << "\""; + d << "'"; P(d, "valueencoded", (sizeof(wchar_t) == 2 ? "2" : "3")); P(d, "type", "std::wstring"); P(d, "numchild", "0"); @@ -2502,54 +2482,54 @@ void qDumpObjectData440( // They are mentioned here nevertheless. For types that not listed // here, dumpers won't be used. d << "dumpers=[" - "\""NS"QByteArray\"," - "\""NS"QDateTime\"," - "\""NS"QDir\"," - "\""NS"QFile\"," - "\""NS"QFileInfo\"," - "\""NS"QHash\"," - "\""NS"QHashNode\"," - "\""NS"QImage\"," - "\""NS"QLinkedList\"," - "\""NS"QList\"," - "\""NS"QLocale\"," - "\""NS"QMap\"," - "\""NS"QMapNode\"," - "\""NS"QModelIndex\"," + "'"NS"QByteArray'," + "'"NS"QDateTime'," + "'"NS"QDir'," + "'"NS"QFile'," + "'"NS"QFileInfo'," + "'"NS"QHash'," + "'"NS"QHashNode'," + "'"NS"QImage'," + "'"NS"QLinkedList'," + "'"NS"QList'," + "'"NS"QLocale'," + "'"NS"QMap'," + "'"NS"QMapNode'," + "'"NS"QModelIndex'," #if QT_VERSION >= 0x040500 - "\""NS"QMultiMap\"," + "'"NS"QMultiMap'," #endif - "\""NS"QObject\"," - "\""NS"QObjectMethodList\"," // hack to get nested properties display - "\""NS"QObjectPropertyList\"," + "'"NS"QObject'," + "'"NS"QObjectMethodList'," // hack to get nested properties display + "'"NS"QObjectPropertyList'," #if PRIVATE_OBJECT_ALLOWED - "\""NS"QObjectSignal\"," - "\""NS"QObjectSignalList\"," - "\""NS"QObjectSlot\"," - "\""NS"QObjectSlotList\"," + "'"NS"QObjectSignal'," + "'"NS"QObjectSignalList'," + "'"NS"QObjectSlot'," + "'"NS"QObjectSlotList'," #endif // PRIVATE_OBJECT_ALLOWED - // << "\""NS"QRegion\"," - "\""NS"QSet\"," - "\""NS"QString\"," - "\""NS"QStringList\"," - "\""NS"QTextCodec\"," - "\""NS"QVariant\"," - "\""NS"QVector\"," - "\""NS"QWidget\"," - "\"string\"," - "\"wstring\"," - "\"std::basic_string\"," - "\"std::list\"," - "\"std::map\"," - "\"std::string\"," - "\"std::vector\"," - "\"std::wstring\"," + // << "'"NS"QRegion'," + "'"NS"QSet'," + "'"NS"QString'," + "'"NS"QStringList'," + "'"NS"QTextCodec'," + "'"NS"QVariant'," + "'"NS"QVector'," + "'"NS"QWidget'," + "'string'," + "'wstring'," + "'std::basic_string'," + "'std::list'," + "'std::map'," + "'std::string'," + "'std::vector'," + "'std::wstring'," "]"; d << ",qtversion=[" - "\"" << ((QT_VERSION >> 16) & 255) << "\"," - "\"" << ((QT_VERSION >> 8) & 255) << "\"," - "\"" << ((QT_VERSION) & 255) << "\"]"; - d << ",namespace=\""NS"\""; + "'" << ((QT_VERSION >> 16) & 255) << "'," + "'" << ((QT_VERSION >> 8) & 255) << "'," + "'" << ((QT_VERSION) & 255) << "']"; + d << ",namespace='"NS"'"; d.disarm(); } diff --git a/doc/coding-style.qdoc b/doc/coding-style.qdoc index c2e886c85b3fb355e5b568cc741672f63725598d..fff5a4bd0fd308693c15b040cdda0493d0182689 100644 --- a/doc/coding-style.qdoc +++ b/doc/coding-style.qdoc @@ -265,6 +265,7 @@ Whitespace Always use only one blank line Always use a single space after a keyword, and before a curly brace. +\code // Wrong if(foo){ } @@ -272,18 +273,24 @@ Whitespace // Correct if (foo) { } +\endcode For pointers or references, always use a single space before '*' or '&', but never after. Avoid C-style casts when possible. +\code // Wrong char* blockOfMemory = (char* ) malloc(data.size()); // Correct char *blockOfMemory = (char *)malloc(data.size()); char *blockOfMemory = reinterpret_cast<char *>(malloc(data.size())); +\endcode + Of course, in this particulare case, using \c new might be an even better + option. Braces As a base rule, the left curly brace goes on the same line as the start of the statement: +\code // Wrong if (codec) { @@ -292,8 +299,10 @@ Braces // Correct if (codec) { } +\endcode Exception: Function implementations and class declarations always have the left brace on the start of a line: +\code static void foo(int g) { qDebug("foo: %i", g); @@ -302,8 +311,10 @@ Braces class Moo { }; +\endcode Use curly braces when the body of a conditional statement contains more than one line, and also if a single line statement is somewhat complex. +\code // Wrong if (address.isEmpty()) { return false; @@ -319,15 +330,19 @@ Braces for (int i = 0; i < 10; ++i) qDebug("%i", i); +\endcode Exception 1: Use braces also if the parent statement covers several lines / wraps +\code // Correct if (address.isEmpty() || !isValid() || !codec) { return false; } +\endcode Exception 2: Use braces also in if-then-else blocks where either the if-code or the else-code covers several lines +\code // Wrong if (address.isEmpty()) --it; @@ -358,16 +373,20 @@ Braces else ... } +\endcode Use curly braces when the body of a conditional statement is empty +\code // Wrong while (a); // Correct while (a) {} +\endcode Parentheses Use parentheses to group expressions: +\code // Wrong if (a && b || c) @@ -379,10 +398,12 @@ Parentheses // Correct (a + b) & c +\endcode Line breaks Keep lines shorter than 100 characters; insert line breaks if necessary. Commas go at the end of a broken line; operators start at the beginning of the new line. The operator is at the end of the line to avoid having to scroll if your editor is too narrow. +\code // Wrong if (longExpression + otherLongExpression + @@ -394,10 +415,7 @@ Line breaks + otherLongExpression + otherOtherLongExpression) { } - - - - +\endcode \section2 Declarations @@ -424,6 +442,32 @@ Line breaks If you create a new file, the top of the file should include a header comment equal to the one found in other source files of Qt Creator. +\section2 Include order + + Always go from less general to more general. In a typical implementation + file that would look like +\code + #include "myownheader.h" + ... + #include "other_headers_from_my_own_plugin.h" + ... + #include <other_plugin/headers_from_other_plugin.h> + ... + #include <QtCore/QSomeCoreClass> + ... + #include <QtGui/QSomeGuiClass> + ... + #include <some_system_C++_header> + ... + #include <some_system_C_header> +\endcode + This order ensures that the headers are self-contained. + + Using <...> instead of "..." for headers from other plugins helps + spotting plugin-external dependencies in the sources. + + Using empty lines between blocks of "peer" headers are encouraged. + \section2 Documentation The documentation is generated from source and header files. diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index 7e3d15dc4c18a2330aa5707da716e9a28311c54d..8a4198b4bf0dbc1a96c64d4ad6dd7ca48cb0545e 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -276,10 +276,10 @@ public: void setDisplayName(const QString &title) { m_displayName = title; emit changed(); } bool duplicateSupported() const { return false; } - IEditor *duplicate(QWidget */*parent*/) { return 0; } + IEditor *duplicate(QWidget * /* parent */) { return 0; } - QByteArray saveState() const { return QByteArray();} // TODO - bool restoreState(const QByteArray &/*state*/) {return false;} // TODO + QByteArray saveState() const { return QByteArray(); } // TODO + bool restoreState(const QByteArray & /* state */) { return false; } // TODO QToolBar *toolBar() { return m_toolBar; } diff --git a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp index bf2d49826c0189fdd28503f94b0279118dcb9c69..d8c7a1930c41e06b849327a3ca4e81d276efcfdc 100644 --- a/src/plugins/coreplugin/actionmanager/actioncontainer.cpp +++ b/src/plugins/coreplugin/actionmanager/actioncontainer.cpp @@ -35,7 +35,6 @@ #include "actionmanager_p.h" #include "command_p.h" -#include "coreimpl.h" #include "coreconstants.h" #include "uniqueidmanager.h" @@ -150,15 +149,13 @@ bool ActionContainerPrivate::hasState(ContainerState state) const void ActionContainerPrivate::appendGroup(const QString &group) { - UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager(); - int gid = idmanager->uniqueIdentifier(group); + int gid = UniqueIDManager::instance()->uniqueIdentifier(group); m_groups << gid; } QAction *ActionContainerPrivate::insertLocation(const QString &group) const { - UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager(); - int grpid = idmanager->uniqueIdentifier(group); + int grpid = UniqueIDManager::instance()->uniqueIdentifier(group); int prevKey = 0; int pos = ((grpid << 16) | 0xFFFF); return beforeAction(pos, &prevKey); @@ -181,7 +178,7 @@ void ActionContainerPrivate::addAction(Command *action, const QString &group) } a->setStateFlags(a->stateFlags() | CommandPrivate::CS_Initialized); } else { - UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager(); + UniqueIDManager *idmanager = UniqueIDManager::instance(); int grpid = idmanager->uniqueIdentifier(Constants::G_DEFAULT_TWO); if (!group.isEmpty()) grpid = idmanager->uniqueIdentifier(group); @@ -208,7 +205,7 @@ void ActionContainerPrivate::addMenu(ActionContainer *menu, const QString &group } mc->setState(ActionContainerPrivate::CS_Initialized); } else { - UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager(); + UniqueIDManager *idmanager = UniqueIDManager::instance(); int grpid = idmanager->uniqueIdentifier(Constants::G_DEFAULT_TWO); if (!group.isEmpty()) grpid = idmanager->uniqueIdentifier(group); diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp index 9101801ac735804376aa8b81c536ce0e03e52d6d..b5a1e5cc0c6c76520189008116db3625701ae9bb 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp +++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp @@ -222,7 +222,7 @@ ActionManagerPrivate::~ActionManagerPrivate() qDeleteAll(m_idContainerMap.values()); } -ActionManagerPrivate* ActionManagerPrivate::instance() +ActionManagerPrivate *ActionManagerPrivate::instance() { return m_instance; } diff --git a/src/plugins/coreplugin/actionmanager/actionmanager_p.h b/src/plugins/coreplugin/actionmanager/actionmanager_p.h index 31513276ec1368e873249f79939bf64f21e81911..f1e106c4bf743702b98e8fa2d26ed6e38e99b142 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager_p.h +++ b/src/plugins/coreplugin/actionmanager/actionmanager_p.h @@ -69,7 +69,7 @@ public: ~ActionManagerPrivate(); void setContext(const QList<int> &context); - static ActionManagerPrivate* instance(); + static ActionManagerPrivate *instance(); void saveSettings(QSettings *settings); QList<int> defaultGroups() const; diff --git a/src/plugins/coreplugin/actionmanager/commandsfile.cpp b/src/plugins/coreplugin/actionmanager/commandsfile.cpp index abdecf43660d9c8be14d4a9b67c72e22789d5b48..85d7d172a1dc65732b4c26ce74f3a4350a6d134a 100644 --- a/src/plugins/coreplugin/actionmanager/commandsfile.cpp +++ b/src/plugins/coreplugin/actionmanager/commandsfile.cpp @@ -31,7 +31,6 @@ ** ***************************************************************************/ -#include "coreimpl.h" #include "commandsfile.h" #include "shortcutsettings.h" #include "command_p.h" @@ -100,7 +99,7 @@ QMap<QString, QKeySequence> CommandsFile::importCommands() const */ bool CommandsFile::exportCommands(const QList<ShortcutItem *> &items) { - UniqueIDManager *idmanager = CoreImpl::instance()->uniqueIDManager(); + UniqueIDManager *idmanager = UniqueIDManager::instance(); QFile file(m_filename); if (!file.open(QIODevice::WriteOnly)) @@ -110,7 +109,7 @@ bool CommandsFile::exportCommands(const QList<ShortcutItem *> &items) QDomElement root = doc.createElement("mapping"); doc.appendChild(root); - for (int i=0; i<items.count(); ++i) { + for (int i = 0; i < items.count(); ++i) { ShortcutItem *item = items.at(i); QDomElement ctag = doc.createElement("shortcut"); ctag.setAttribute(QLatin1String("id"), idmanager->stringForUniqueIdentifier(item->m_cmd->id())); diff --git a/src/plugins/coreplugin/dialogs/settingsdialog.cpp b/src/plugins/coreplugin/dialogs/settingsdialog.cpp index 547c0f2d40dbf9dedf2f828be9f271689a1d0913..7e48417d2ce0df5391e519e188ec8fbd8ef6ad31 100644 --- a/src/plugins/coreplugin/dialogs/settingsdialog.cpp +++ b/src/plugins/coreplugin/dialogs/settingsdialog.cpp @@ -32,7 +32,6 @@ ***************************************************************************/ #include "settingsdialog.h" -#include "coreimpl.h" #include <extensionsystem/pluginmanager.h> diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp index 3d51e00b874ce2c6b0b02edde29a83b277e37377..b245d5ced5962ebf9d22578d9ea5d330fa6677ff 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.cpp +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.cpp @@ -34,14 +34,13 @@ #include "shortcutsettings.h" #include "ui_shortcutsettings.h" #include "actionmanager_p.h" +#include "actionmanager/command.h" #include "command_p.h" -#include "coreconstants.h" -#include "coreimpl.h" #include "commandsfile.h" +#include "coreconstants.h" #include "filemanager.h" - -#include <coreplugin/uniqueidmanager.h> -#include <coreplugin/actionmanager/command.h> +#include "icore.h" +#include "uniqueidmanager.h" #include <QtGui/QKeyEvent> #include <QtGui/QShortcut> @@ -232,11 +231,10 @@ void ShortcutSettings::removeKeySequence() void ShortcutSettings::importAction() { - UniqueIDManager *uidm = - CoreImpl::instance()->uniqueIDManager(); + UniqueIDManager *uidm = UniqueIDManager::instance(); QString fileName = QFileDialog::getOpenFileName(0, tr("Import Keyboard Mapping Scheme"), - CoreImpl::instance()->resourcePath() + "/schemes/", + ICore::instance()->resourcePath() + "/schemes/", tr("Keyboard Mapping Scheme (*.kms)")); if (!fileName.isEmpty()) { CommandsFile cf(fileName); @@ -266,9 +264,9 @@ void ShortcutSettings::defaultAction() void ShortcutSettings::exportAction() { - QString fileName = CoreImpl::instance()->fileManager()->getSaveFileNameWithExtension( + QString fileName = ICore::instance()->fileManager()->getSaveFileNameWithExtension( tr("Export Keyboard Mapping Scheme"), - CoreImpl::instance()->resourcePath() + "/schemes/", + ICore::instance()->resourcePath() + "/schemes/", tr("Keyboard Mapping Scheme (*.kms)"), ".kms"); if (!fileName.isEmpty()) { @@ -279,16 +277,11 @@ void ShortcutSettings::exportAction() void ShortcutSettings::initialize() { - QMap<QString, QTreeWidgetItem *> categories; - m_am = ActionManagerPrivate::instance(); - UniqueIDManager *uidm = - CoreImpl::instance()->uniqueIDManager(); + UniqueIDManager *uidm = UniqueIDManager::instance(); - QList<CommandPrivate *> cmds = m_am->commands(); - for (int i = 0; i < cmds.size(); ++i) { - CommandPrivate *c = cmds.at(i); - if (c->hasAttribute(CommandPrivate::CA_NonConfigureable)) + foreach (Command *c, m_am->commands()) { + if (c->hasAttribute(Command::CA_NonConfigureable)) continue; if (c->action() && c->action()->isSeparator()) continue; @@ -296,24 +289,15 @@ void ShortcutSettings::initialize() QTreeWidgetItem *item = 0; ShortcutItem *s = new ShortcutItem; m_scitems << s; - if (c->category().isEmpty()) { - item = new QTreeWidgetItem(m_page->commandList); - } else { - if (!categories.contains(c->category())) { - QTreeWidgetItem *cat = new QTreeWidgetItem(m_page->commandList); - cat->setText(0, c->category()); - categories.insert(c->category(), cat); - cat->setExpanded(true); - } - item = new QTreeWidgetItem(categories.value(c->category())); - } + item = new QTreeWidgetItem(m_page->commandList); s->m_cmd = c; s->m_item = item; item->setText(0, uidm->stringForUniqueIdentifier(c->id())); if (c->action()) { - QString text = c->hasAttribute(CommandPrivate::CA_UpdateText) && !c->defaultText().isNull() ? c->defaultText() : c->action()->text(); + QString text = c->hasAttribute(Command::CA_UpdateText) && !c->defaultText().isNull() ? c->defaultText() : c->action()->text(); + text.remove(QRegExp("&(?!&)")); s->m_key = c->action()->shortcut(); item->setText(1, text); } else { diff --git a/src/plugins/coreplugin/dialogs/shortcutsettings.ui b/src/plugins/coreplugin/dialogs/shortcutsettings.ui index f1cc3f795a5e17d3e6a2fa89f8c75bf46a957166..867b021f94ea5e882d12e6034dfbe68e32ca122f 100644 --- a/src/plugins/coreplugin/dialogs/shortcutsettings.ui +++ b/src/plugins/coreplugin/dialogs/shortcutsettings.ui @@ -36,6 +36,9 @@ </item> <item> <widget class="QTreeWidget" name="commandList"> + <property name="rootIsDecorated"> + <bool>false</bool> + </property> <property name="uniformRowHeights"> <bool>true</bool> </property> diff --git a/src/plugins/coreplugin/editmode.cpp b/src/plugins/coreplugin/editmode.cpp index dacb31e355c74fa66da52cdb6124d52fce8e9b66..e5de7124485d1be0ed65f464107256d0dc2aa3e5 100644 --- a/src/plugins/coreplugin/editmode.cpp +++ b/src/plugins/coreplugin/editmode.cpp @@ -34,7 +34,6 @@ #include "editmode.h" #include "editormanager.h" #include "coreconstants.h" -#include "coreimpl.h" #include "modemanager.h" #include "uniqueidmanager.h" #include "minisplitter.h" @@ -122,9 +121,9 @@ const char* EditMode::uniqueModeName() const QList<int> EditMode::context() const { static QList<int> contexts = QList<int>() << - CoreImpl::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_EDIT_MODE) << - CoreImpl::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_EDITORMANAGER) << - CoreImpl::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_NAVIGATION_PANE); + UniqueIDManager::instance()->uniqueIdentifier(Constants::C_EDIT_MODE) << + UniqueIDManager::instance()->uniqueIdentifier(Constants::C_EDITORMANAGER) << + UniqueIDManager::instance()->uniqueIdentifier(Constants::C_NAVIGATION_PANE); return contexts; } diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index babc38c5d622bac92f556b928fbc6e6bc3288553..352fae6802cd92dbda468c7a571d4e4366695e0f 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -36,15 +36,13 @@ #include "openeditorswindow.h" #include "openwithdialog.h" #include "filemanager.h" -#include "tabpositionindicator.h" -#include "saveitemsdialog.h" -#include "vcsmanager.h" +#include "icore.h" #include "iversioncontrol.h" -#include "openeditorsview.h" -#include "editorgroup.h" #include "mimedatabase.h" +#include "saveitemsdialog.h" +#include "tabpositionindicator.h" +#include "vcsmanager.h" -#include <coreplugin/coreimpl.h> #include <coreplugin/coreconstants.h> #include <coreplugin/modemanager.h> #include <coreplugin/uniqueidmanager.h> @@ -68,6 +66,7 @@ #include <QtGui/QApplication> #include <QtGui/QFileDialog> #include <QtGui/QLayout> +#include <QtGui/QMainWindow> #include <QtGui/QMenu> #include <QtGui/QMessageBox> #include <QtGui/QPushButton> @@ -627,7 +626,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askA //ask whether to save modified files if (askAboutModifiedEditors) { bool cancelled = false; - QList<IFile*> list = CoreImpl::instance()->fileManager()-> + QList<IFile*> list = ICore::instance()->fileManager()-> saveModifiedFiles(filesForEditors(acceptedEditors), &cancelled); if (cancelled) return false; @@ -1444,7 +1443,7 @@ void EditorManager::openInExternalEditor() return; if (editor->file()->isModified()) { bool cancelled = false; - QList<IFile*> list = CoreImpl::instance()->fileManager()-> + QList<IFile*> list = ICore::instance()->fileManager()-> saveModifiedFiles(QList<IFile*>() << editor->file(), &cancelled); if (cancelled) return; diff --git a/src/plugins/coreplugin/editormanager/openeditorsview.cpp b/src/plugins/coreplugin/editormanager/openeditorsview.cpp index 2716d978f07fe5c14736674165e4fff86690da81..e58b1566befb3c61c57e6cdbb929801147d03ba1 100644 --- a/src/plugins/coreplugin/editormanager/openeditorsview.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorsview.cpp @@ -34,7 +34,7 @@ #include "openeditorsview.h" #include "editormanager.h" #include "editorview.h" -#include "coreimpl.h" +#include "icore.h" #include <coreplugin/coreconstants.h> #include <coreplugin/filemanager.h> @@ -115,7 +115,7 @@ void OpenEditorsWidget::closeEditors() selectedEditors.append(item->data(0, Qt::UserRole).value<IEditor *>()); selectedFiles.append(item->data(0, Qt::UserRole).value<IEditor *>()->file()); } - ICore *core = CoreImpl::instance(); + ICore *core = ICore::instance(); bool cancelled = false; core->fileManager()->saveModifiedFiles(selectedFiles, &cancelled); if (cancelled) diff --git a/src/plugins/coreplugin/editormanager/stackededitorgroup.cpp b/src/plugins/coreplugin/editormanager/stackededitorgroup.cpp index 7d27b72e73729613156045fd5cd29e2e02d4a040..2d36105d3450d110962779cef68f2ea712e1e617 100644 --- a/src/plugins/coreplugin/editormanager/stackededitorgroup.cpp +++ b/src/plugins/coreplugin/editormanager/stackededitorgroup.cpp @@ -34,7 +34,6 @@ #include "stackededitorgroup.h" #include "editormanager.h" #include "editorview.h" -#include "coreimpl.h" #include <utils/qtcassert.h> @@ -356,7 +355,7 @@ QList<IEditor *> StackedEditorGroup::editorsInNaturalOrder() const void StackedEditorGroup::makeEditorWritable() { - CoreImpl::instance()->editorManager()->makeEditorWritable(currentEditor()); + EditorManager::instance()->makeEditorWritable(currentEditor()); } void StackedEditorGroup::listSelectionChanged(int index) diff --git a/src/plugins/coreplugin/filemanager.cpp b/src/plugins/coreplugin/filemanager.cpp index c4f515547a11bb6017068b3cdb9d7ab1b0401464..d94649cba5a989ef811ad0b7642123590274cf65 100644 --- a/src/plugins/coreplugin/filemanager.cpp +++ b/src/plugins/coreplugin/filemanager.cpp @@ -85,18 +85,17 @@ using namespace Core::Internal; static const char *settingsGroup = "RecentFiles"; static const char *filesKey = "Files"; -FileManager::FileManager(Core::ICore *core, MainWindow *mw) : - QObject(mw), - m_core(core), +FileManager::FileManager(MainWindow *mw) + : QObject(mw), m_mainWindow(mw), m_fileWatcher(new QFileSystemWatcher(this)), m_blockActivated(false) { - connect(m_fileWatcher, SIGNAL(fileChanged(const QString&)), - this, SLOT(changedFile(const QString&))); + connect(m_fileWatcher, SIGNAL(fileChanged(QString)), + this, SLOT(changedFile(QString))); connect(m_mainWindow, SIGNAL(windowActivated()), this, SLOT(mainWindowActivated())); - connect(m_core, SIGNAL(contextChanged(Core::IContext*)), + connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext*)), this, SLOT(syncWithEditor(Core::IContext*))); QSettings *s = m_mainWindow->settings(); @@ -440,7 +439,7 @@ QString FileManager::getSaveAsFileName(IFile *file) } QString filterString; QString preferredSuffix; - if (const MimeType mt = m_core->mimeDatabase()->findByFile(fi)) { + if (const MimeType mt = Core::ICore::instance()->mimeDatabase()->findByFile(fi)) { filterString = mt.filterString(); preferredSuffix = mt.preferredSuffix(); } @@ -510,7 +509,7 @@ void FileManager::syncWithEditor(Core::IContext *context) if (!context) return; - Core::IEditor *editor = m_core->editorManager()->currentEditor(); + Core::IEditor *editor = Core::ICore::instance()->editorManager()->currentEditor(); if (editor && (editor->widget() == context->widget())) setCurrentFile(editor->file()->fileName()); } diff --git a/src/plugins/coreplugin/filemanager.h b/src/plugins/coreplugin/filemanager.h index bffbb088355ad422a79450f0b40f9e3b20733c6f..5b6b861b4a4eb6aa1f2764d4458cfa53995dfe1f 100644 --- a/src/plugins/coreplugin/filemanager.h +++ b/src/plugins/coreplugin/filemanager.h @@ -69,7 +69,7 @@ class CORE_EXPORT FileManager : public QObject }; public: - FileManager(Core::ICore *core, Internal::MainWindow *ew); + explicit FileManager(Internal::MainWindow *ew); // file pool to monitor bool addFiles(const QList<IFile *> &files); @@ -99,10 +99,9 @@ public: QString getSaveAsFileName(IFile *file); QList<IFile *> saveModifiedFilesSilently(const QList<IFile *> &files); - QList<IFile *> saveModifiedFiles( - const QList<IFile *> &files, - bool *cancelled = 0, - const QString &message = QString()); + QList<IFile *> saveModifiedFiles(const QList<IFile *> &files, + bool *cancelled = 0, + const QString &message = QString()); signals: void currentFileChanged(const QString &filePath); @@ -130,7 +129,6 @@ private: QString m_currentFile; - Core::ICore *m_core; Internal::MainWindow *m_mainWindow; QFileSystemWatcher *m_fileWatcher; QList<QPointer<IFile> > m_changedFiles; diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index c1347c3ef703f9fa321f99f8a6ed47a212182726..86e7582b8cc1215bc23a3395d6da1012d958f186 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -94,7 +94,7 @@ extern "C" void handleSigInt(int sig) { Q_UNUSED(sig); - Core::Internal::CoreImpl::instance()->exit(); + Core::ICore::instance()->exit(); qDebug() << "SIGINT caught. Shutting down."; } #endif @@ -118,7 +118,7 @@ MainWindow::MainWindow() : m_printer(0), m_actionManager(new ActionManagerPrivate(this, m_uniqueIDManager)), m_editorManager(0), - m_fileManager(new FileManager(m_coreImpl, this)), + m_fileManager(new FileManager(this)), m_progressManager(new ProgressManagerPrivate()), m_scriptManager(new ScriptManagerPrivate(this, m_coreImpl)), m_variableManager(new VariableManager(this)), @@ -217,9 +217,8 @@ void MainWindow::setSidebarVisible(bool visible) void MainWindow::setSuppressNavigationWidget(bool suppress) { - if (NavigationWidgetPlaceHolder::current()) { + if (NavigationWidgetPlaceHolder::current()) m_navigationWidget->setSuppressed(suppress); - } } MainWindow::~MainWindow() @@ -319,7 +318,7 @@ void MainWindow::extensionsInitialized() m_viewManager->extensionsInitalized(); m_messageManager->init(m_pluginManager); - m_outputPane->init(m_coreImpl, m_pluginManager); + m_outputPane->init(m_pluginManager); m_actionManager->initialize(); readSettings(); diff --git a/src/plugins/coreplugin/modemanager.cpp b/src/plugins/coreplugin/modemanager.cpp index 24a0b6eac3783d2935639cf77b6e326cdcecc2a4..64006ff723609143d507643a2c9a7ba01c965ac4 100644 --- a/src/plugins/coreplugin/modemanager.cpp +++ b/src/plugins/coreplugin/modemanager.cpp @@ -42,7 +42,6 @@ #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/command.h> #include <coreplugin/coreconstants.h> -#include <coreplugin/coreimpl.h> #include <coreplugin/imode.h> #include <coreplugin/uniqueidmanager.h> diff --git a/src/plugins/coreplugin/outputpane.cpp b/src/plugins/coreplugin/outputpane.cpp index 7169249cfaa8d4a94fd1e8e8c19dcf2a093ee4cd..1e4411ba7c5fc581aff7c98a55d419425e58cd6b 100644 --- a/src/plugins/coreplugin/outputpane.cpp +++ b/src/plugins/coreplugin/outputpane.cpp @@ -156,7 +156,6 @@ OutputPane::OutputPane(const QList<int> &context, QWidget *parent) : m_closeButton(new QToolButton), m_closeAction(0), m_pluginManager(0), - m_core(0), m_lastIndex(-1), m_outputWidgetPane(new QStackedWidget), m_opToolBarWidgets(new QStackedWidget) @@ -206,12 +205,11 @@ QWidget *OutputPane::buttonsWidget() return m_buttonsWidget; } -void OutputPane::init(ICore *core, ExtensionSystem::PluginManager *pm) +void OutputPane::init(ExtensionSystem::PluginManager *pm) { m_pluginManager = pm; - m_core = core; - ActionManager *am = m_core->actionManager(); + ActionManager *am = Core::ICore::instance()->actionManager(); ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); // Window->Output Panes diff --git a/src/plugins/coreplugin/outputpane.h b/src/plugins/coreplugin/outputpane.h index 5a7c928a5467e56c6d249308c32c818d68adccc4..8505b34bfa8981b6f22e74fa1ad2c2a282ec8cf3 100644 --- a/src/plugins/coreplugin/outputpane.h +++ b/src/plugins/coreplugin/outputpane.h @@ -51,7 +51,6 @@ namespace ExtensionSystem { class PluginManager; } namespace Core { -class ICore; class IMode; class IOutputPane; @@ -89,7 +88,7 @@ class OutputPane public: OutputPane(const QList<int> &context, QWidget *parent = 0); ~OutputPane(); - void init(Core::ICore *core, ExtensionSystem::PluginManager *pm); + void init(ExtensionSystem::PluginManager *pm); static OutputPane *instance(); const QList<int> &context() const { return m_context; } void setCloseable(bool b); @@ -123,7 +122,6 @@ private: QAction *m_closeAction; ExtensionSystem::PluginManager *m_pluginManager; - Core::ICore *m_core; QMap<int, Core::IOutputPane*> m_pageMap; int m_lastIndex; diff --git a/src/plugins/coreplugin/progressmanager/progressmanager.cpp b/src/plugins/coreplugin/progressmanager/progressmanager.cpp index 968d2bb9fc8774a230fcd5fad33ac34b6f271494..392e8aafa8d951ac5d011d66953a2440808ce7d4 100644 --- a/src/plugins/coreplugin/progressmanager/progressmanager.cpp +++ b/src/plugins/coreplugin/progressmanager/progressmanager.cpp @@ -33,10 +33,9 @@ #include "progressmanager_p.h" #include "progressview.h" -#include "coreimpl.h" #include "baseview.h" - #include "coreconstants.h" +#include "icore.h" #include "uniqueidmanager.h" #include <utils/qtcassert.h> @@ -48,7 +47,7 @@ ProgressManagerPrivate::ProgressManagerPrivate(QObject *parent) : ProgressManager(parent) { m_progressView = new ProgressView; - ICore *core = CoreImpl::instance(); + ICore *core = ICore::instance(); connect(core, SIGNAL(coreAboutToClose()), this, SLOT(cancelAllRunningTasks())); } diff --git a/src/plugins/coreplugin/uniqueidmanager.h b/src/plugins/coreplugin/uniqueidmanager.h index 0a8ed6fcd07febed01adae9713d18773e45fea48..eff119762d749b6f4c1ef0be6390deb126f0c7f4 100644 --- a/src/plugins/coreplugin/uniqueidmanager.h +++ b/src/plugins/coreplugin/uniqueidmanager.h @@ -47,7 +47,7 @@ public: UniqueIDManager(); ~UniqueIDManager(); - static UniqueIDManager* instance() { return m_instance; } + static UniqueIDManager *instance() { return m_instance; } bool hasUniqueIdentifier(const QString &id) const; int uniqueIdentifier(const QString &id); diff --git a/src/plugins/coreplugin/versiondialog.cpp b/src/plugins/coreplugin/versiondialog.cpp index a61e29e50d7c193bbc2e922e2aaec0e06b1ad084..5ce821a8147573bfd728231a17c596fe773f7617 100644 --- a/src/plugins/coreplugin/versiondialog.cpp +++ b/src/plugins/coreplugin/versiondialog.cpp @@ -34,7 +34,7 @@ #include "versiondialog.h" #include "coreconstants.h" -#include "coreimpl.h" +#include "icore.h" #include <utils/qtcassert.h> @@ -121,7 +121,7 @@ void VersionDialog::popupLicense() layout->addWidget(buttonBox); // Read file into string - ICore * core = CoreImpl::instance(); + ICore *core = ICore::instance(); QTC_ASSERT(core, return); QString fileName = core->resourcePath() + "/license.txt"; QFile file(fileName); diff --git a/src/plugins/coreplugin/welcomemode.cpp b/src/plugins/coreplugin/welcomemode.cpp index ee66ac7f33c2add780914a40d774df0d1f2ee1da..7cd17e3ddcd627a3c1d150e588890f0a343e0ecb 100644 --- a/src/plugins/coreplugin/welcomemode.cpp +++ b/src/plugins/coreplugin/welcomemode.cpp @@ -34,7 +34,6 @@ #include "welcomemode.h" #include "coreconstants.h" #include "uniqueidmanager.h" -#include "coreimpl.h" #include "modemanager.h" #if !defined(QT_NO_WEBKIT) @@ -193,7 +192,7 @@ const char* WelcomeMode::uniqueModeName() const QList<int> WelcomeMode::context() const { static QList<int> contexts = QList<int>() - << CoreImpl::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_WELCOME_MODE); + << UniqueIDManager::instance()->uniqueIdentifier(Constants::C_WELCOME_MODE); return contexts; } @@ -250,7 +249,7 @@ void WelcomeMode::updateWelcomePage(const WelcomePageData &welcomePageData) void WelcomeMode::linkClicked(const QUrl &url) { QString scheme = url.scheme(); - Core::ModeManager *modeManager = CoreImpl::instance()->modeManager(); + Core::ModeManager *modeManager = ModeManager::instance(); if (scheme.startsWith(QLatin1String("gh"))) { QString s = url.toString(QUrl::RemoveScheme); if (scheme == QLatin1String("gh")) { diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 093c39611bbcb89c02e97d86564c2cfa6846696e..0a9cf3958b21e7fdb7aa01a537cdb752f75111c6 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -334,10 +334,10 @@ void CPPEditor::jumpToMethod(int) if (! symbol) return; - m_core->editorManager()->addCurrentPositionToNavigationHistory(true); + Core::ICore::instance()->editorManager()->addCurrentPositionToNavigationHistory(true); int line = symbol->line(); gotoLine(line); - m_core->editorManager()->addCurrentPositionToNavigationHistory(); + Core::ICore::instance()->editorManager()->addCurrentPositionToNavigationHistory(); setFocus(); } @@ -655,7 +655,7 @@ void CPPEditor::contextMenuEvent(QContextMenuEvent *e) menu->removeAction(lastAction); Core::ActionContainer *mcontext = - m_core->actionManager()->actionContainer(CppEditor::Constants::M_CONTEXT); + Core::ICore::instance()->actionManager()->actionContainer(CppEditor::Constants::M_CONTEXT); QMenu *contextMenu = mcontext->menu(); foreach (QAction *action, contextMenu->actions()) diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h index 6773a5308ae783b50a6593dec0ef0a0af6a0ab9b..4f324b683406cb8178a24bc47a67fd67dcb97708 100644 --- a/src/plugins/cppeditor/cppeditor.h +++ b/src/plugins/cppeditor/cppeditor.h @@ -35,20 +35,14 @@ #define CPPEDITOR_H #include "cppeditorenums.h" + #include <cplusplus/CppDocument.h> #include <texteditor/basetexteditor.h> -#include <QtCore/QObject> QT_BEGIN_NAMESPACE -class QAction; class QComboBox; -class QStringListModel; QT_END_NAMESPACE -namespace Core { -class ICore; -} - namespace CPlusPlus { class OverviewModel; class Symbol; @@ -136,7 +130,6 @@ private: bool openEditorAt(CPlusPlus::Symbol *symbol); - Core::ICore *m_core; CppTools::CppModelManagerInterface *m_modelManager; QList<int> m_contexts; diff --git a/src/plugins/cppeditor/cppplugin.h b/src/plugins/cppeditor/cppplugin.h index c653866e27128217d8c1c8ac5ab2bbf9dec0dec5..629a29e505c31aed8d2d8b02865822b2430decf9 100644 --- a/src/plugins/cppeditor/cppplugin.h +++ b/src/plugins/cppeditor/cppplugin.h @@ -34,17 +34,12 @@ #ifndef CPPPLUGIN_H #define CPPPLUGIN_H -#include <QtCore/qplugin.h> +#include <QtCore/QtPlugin> #include <QtCore/QStringList> #include <extensionsystem/iplugin.h> #include <coreplugin/editormanager/ieditorfactory.h> -namespace Core { -class ICore; -class IWizard; -} - namespace TextEditor { class TextEditorActionHandler; } // namespace TextEditor @@ -82,7 +77,6 @@ private: static CppPlugin *m_instance; - Core::ICore *m_core; CPPEditorActionHandler *m_actionHandler; CppPluginEditorFactory *m_factory; }; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 7fd564a3a0546f22019ad110bcd7e539132c24d3..a42c10382048fcd677b1fbe86dc8e0a521d882f9 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -611,7 +611,6 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes splitter->setOrientation(Qt::Vertical); MiniSplitter *splitter2 = new MiniSplitter; - splitter2 = new MiniSplitter; splitter2->addWidget(new NavigationWidgetPlaceHolder(m_debugMode)); splitter2->addWidget(splitter); splitter2->setStretchFactor(0, 0); @@ -929,7 +928,7 @@ void DebuggerPlugin::readSettings() m->m_skipKnownFrames = s->value("SkipKnownFrames", false).toBool(); m->m_debugDumpers = s->value("DebugDumpers", false).toBool(); - m->m_useCustomDumpers = s->value("UseCustomDupers", false).toBool(); + m->m_useCustomDumpers = s->value("UseCustomDumpers", true).toBool(); m->m_useFastStart = s->value("UseFastStart", false).toBool(); m->m_useToolTips = s->value("UseToolTips", false).toBool(); m->m_useTerminal = s->value("UseTerminal", false).toBool(); diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index a6d426d21da96c0d0e29d0ed8fff85eeea6d6a6b..4b84c88cb7f239946978bbff2db487de492a2cd0 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -467,20 +467,6 @@ void GdbEngine::handleResponse() break; } - case '#': { - //qDebug() << "CUSTOM OUTPUT, TOKEN" << token; - QString str; - for (; from != to && *from >= '0' && *from <= '9'; ++from) - str += QLatin1Char(*from); - ++from; // skip the ' ' - int len = str.toInt(); - QByteArray ba(from, len); - from += len; - m_inbuffer = QByteArray(from, to - from); - m_customOutputForToken[token] += QString(ba); - break; - } - case '^': { GdbResultRecord record; @@ -1562,6 +1548,7 @@ bool GdbEngine::startDebugger() //sendCommand("set confirm off"); //sendCommand("set pagination off"); sendCommand("set breakpoint pending on", BreakEnablePending); + sendCommand("set print elements 10000"); // one of the following is needed to prevent crashes in gdb on code like: // template <class T> T foo() { return T(0); } @@ -3078,14 +3065,11 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren) q->showStatusMessage( tr("Retrieving data for watch view (%1 requests pending)...") .arg(m_pendingRequests + 1), 10000); - // create response slot for socket data + + // retrieve response QVariant var; var.setValue(data); - sendSynchronizedCommand(QString(), WatchDumpCustomValue2, var); - - // this increases the probability that gdb spits out output it - // has collected so far - //sendCommand("p qDumpInBuffer"); + sendSynchronizedCommand("p (char*)qDumpOutBuffer", WatchDumpCustomValue2, var); } void GdbEngine::createGdbVariable(const WatchData &data) @@ -3318,14 +3302,17 @@ void GdbEngine::handleQueryDataDumper1(const GdbResultRecord &record) void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record) { - // is this the official gdb response. However, it won't contain - // interesting data other than the information that 'real' data - // either already arrived or is still in the pipe. So we do - // _not_ register this result for counting purposes, this will - // be done by the 'real' result (with resultClass == GdbResultCustomDone) //qDebug() << "DATA DUMPER TRIAL:" << record.toString(); - GdbMi output = record.data.findChild("customvaluecontents"); - GdbMi contents(output.data()); + GdbMi output = record.data.findChild("consolestreamoutput"); + QByteArray out = output.data(); + out = out.mid(out.indexOf('"') + 2); // + 1 is success marker + out = out.left(out.lastIndexOf('"')); + out = out.replace('\'', '"'); + out = "dummy={" + out + "}"; + //qDebug() << "OUTPUT: " << out; + + GdbMi contents; + contents.fromString(out); GdbMi simple = contents.findChild("dumpers"); m_namespace = contents.findChild("namespace").data(); GdbMi qtversion = contents.findChild("qtversion"); @@ -3337,8 +3324,7 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record) } else { m_qtVersion = 0; } - - //qDebug() << "OUTPUT: " << output.toString(); + //qDebug() << "CONTENTS: " << contents.toString(); //qDebug() << "SIMPLE DUMPERS: " << simple.toString(); m_availableSimpleDumpers.clear(); @@ -3479,7 +3465,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record, QString msg = record.data.findChild("msg").data(); //qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg; #ifdef QT_DEBUG - // Make debugging of dumers easier + // Make debugging of dumpers easier if (q->settings()->m_debugDumpers && msg.startsWith("The program being debugged stopped while") && msg.contains("qDumpObjectData440")) { @@ -3507,10 +3493,20 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record, //qDebug() << "CUSTOM VALUE RESULT: " << record.toString(); //qDebug() << "FOR DATA: " << data.toString() << record.resultClass; if (record.resultClass == GdbResultDone) { - GdbMi output = record.data.findChild("customvaluecontents"); - //qDebug() << "HANDLE VALUE CONTENTS: " << output.toString(true); - if (!output.isValid()) { - //qDebug() << "INVALID"; + GdbMi output = record.data.findChild("consolestreamoutput"); + QByteArray out = output.data(); + out = out.mid(out.indexOf('"') + 2); // + 1 is the 'success marker' + out = out.left(out.lastIndexOf('"')); + out = out.replace('\'', '"'); + out = "dummy={" + out + "}"; + //qDebug() << "OUTPUT: " << out; + + GdbMi contents; + contents.fromString(out); + //qDebug() << "CONTENTS" << contents.toString(true); + + if (!contents.isValid()) { + qDebug() << "INVALID"; // custom dumper produced no output if (data.isValueNeeded()) data.setValue("<unknown>"); @@ -3523,10 +3519,6 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record, data.setValueToolTip("<custom dumper produced no output>"); insertData(data); } else { - GdbMi contents; - //qDebug() << "OUTPUT" << output.toString(true); - contents.fromString(output.data()); - //qDebug() << "CONTENTS" << contents.toString(true); setWatchDataType(data, contents.findChild("type")); setWatchDataValue(data, contents.findChild("value"), contents.findChild("valueencoded").data().toInt()); @@ -4020,8 +4012,7 @@ void GdbEngine::tryLoadCustomDumpers() // retreive list of dumpable classes sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)", GdbQueryDataDumper1); - // create response slot for socket data - sendCommand(QString(), GdbQueryDataDumper2); + sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper2); } diff --git a/src/plugins/debugger/gdbmi.cpp b/src/plugins/debugger/gdbmi.cpp index 88060d7b350fe4cea36e805ff69faf5a8ce45dca..d3fbeb4428123dd52aaea65a12e3080c98588b66 100644 --- a/src/plugins/debugger/gdbmi.cpp +++ b/src/plugins/debugger/gdbmi.cpp @@ -46,20 +46,20 @@ QTextStream & operator<<(QTextStream & os, const GdbMi & mi) return os << mi.toString(); } -//static void skipSpaces(const GdbMi::Char *&from, const GdbMi::Char *to) +//static void skipSpaces(const char *&from, const char *to) //{ // while (from != to && QChar(*from).isSpace()) // ++from; //} -void GdbMi::parseResultOrValue(const Char *&from, const Char *to) +void GdbMi::parseResultOrValue(const char *&from, const char *to) { //skipSpaces(from, to); while (from != to && QChar(*from).isSpace()) ++from; - //qDebug() << "parseResultOrValue: " << QByteArray::fromLatin1(from, to - from); + //qDebug() << "parseResultOrValue: " << QByteArray(from, to - from); parseValue(from, to); if (isValid()) { //qDebug() << "no valid result in " << QByteArray::fromLatin1(from, to - from); @@ -67,7 +67,7 @@ void GdbMi::parseResultOrValue(const Char *&from, const Char *to) } if (from == to || *from == '(') return; - const Char *ptr = from; + const char *ptr = from; while (ptr < to && *ptr != '=') { //qDebug() << "adding" << QChar(*ptr) << "to name"; ++ptr; @@ -80,7 +80,7 @@ void GdbMi::parseResultOrValue(const Char *&from, const Char *to) } } -QByteArray GdbMi::parseCString(const Char *&from, const Char *to) +QByteArray GdbMi::parseCString(const char *&from, const char *to) { QByteArray result; //qDebug() << "parseCString: " << QByteArray::fromUtf16(from, to - from); @@ -88,7 +88,7 @@ QByteArray GdbMi::parseCString(const Char *&from, const Char *to) qDebug() << "MI Parse Error, double quote expected"; return QByteArray(); } - const Char *ptr = from; + const char *ptr = from; ++ptr; while (ptr < to) { if (*ptr == '"') { @@ -115,7 +115,7 @@ QByteArray GdbMi::parseCString(const Char *&from, const Char *to) return result; } -void GdbMi::parseValue(const Char *&from, const Char *to) +void GdbMi::parseValue(const char *&from, const char *to) { //qDebug() << "parseValue: " << QByteArray::fromUtf16(from, to - from); switch (*from) { @@ -135,7 +135,7 @@ void GdbMi::parseValue(const Char *&from, const Char *to) } -void GdbMi::parseTuple(const Char *&from, const Char *to) +void GdbMi::parseTuple(const char *&from, const char *to) { //qDebug() << "parseTuple: " << QByteArray::fromUtf16(from, to - from); QTC_ASSERT(*from == '{', /**/); @@ -143,7 +143,7 @@ void GdbMi::parseTuple(const Char *&from, const Char *to) parseTuple_helper(from, to); } -void GdbMi::parseTuple_helper(const Char *&from, const Char *to) +void GdbMi::parseTuple_helper(const char *&from, const char *to) { //qDebug() << "parseTuple_helper: " << QByteArray::fromUtf16(from, to - from); m_type = Tuple; @@ -163,7 +163,7 @@ void GdbMi::parseTuple_helper(const Char *&from, const Char *to) } } -void GdbMi::parseList(const Char *&from, const Char *to) +void GdbMi::parseList(const char *&from, const char *to) { //qDebug() << "parseList: " << QByteArray::fromUtf16(from, to - from); QTC_ASSERT(*from == '[', /**/); @@ -267,8 +267,8 @@ QByteArray GdbMi::toString(bool multiline, int indent) const void GdbMi::fromString(const QByteArray &ba) { - const Char *from = ba.constBegin(); - const Char *to = ba.constEnd(); + const char *from = ba.constBegin(); + const char *to = ba.constEnd(); parseResultOrValue(from, to); } @@ -449,16 +449,16 @@ static struct Tester { } for (int i = from; i < to; ++i) { if (str[i] == '{') - result += "{\n" + QByteArray(2*++indent + 1, QChar(' ')); + result += "{\n" + QByteArray(2*++indent + 1, ' '); else if (str[i] == '}') { if (!result.isEmpty() && result[result.size() - 1] != '\n') result += "\n"; - result += QByteArray(2*--indent + 1, QChar(' ')) + "}\n"; + result += QByteArray(2*--indent + 1, ' ') + "}\n"; } else if (str[i] == ',') { if (true || !result.isEmpty() && result[result.size() - 1] != '\n') result += "\n"; - result += QByteArray(2*indent, QChar(' ')); + result += QByteArray(2*indent, ' '); } else result += str[i]; diff --git a/src/plugins/debugger/gdbmi.h b/src/plugins/debugger/gdbmi.h index 0e6c36e9756af2ee04dcf00a41234f5529130e15..21810eed40ea026e5d6e3ae9e0ce36e35a99e07b 100644 --- a/src/plugins/debugger/gdbmi.h +++ b/src/plugins/debugger/gdbmi.h @@ -34,8 +34,6 @@ #ifndef DEBUGGER_GDBMI_H #define DEBUGGER_GDBMI_H -#include <qglobal.h> - #include <QtCore/QByteArray> #include <QtCore/QList> @@ -125,8 +123,8 @@ public: inline const QList<GdbMi> &children() const { return m_children; } inline int childCount() const { return m_children.size(); } - const GdbMi & childAt(int index) const { return m_children[index]; } - GdbMi & childAt(int index) { return m_children[index]; } + const GdbMi &childAt(int index) const { return m_children[index]; } + GdbMi &childAt(int index) { return m_children[index]; } GdbMi findChild(const QByteArray &name) const; GdbMi findChild(const QByteArray &name, const QByteArray &defaultString) const; @@ -138,14 +136,12 @@ private: friend class GdbResultRecord; friend class GdbEngine; - //typedef ushort Char; - typedef char Char; - static QByteArray parseCString(const Char *&from, const Char *to); - void parseResultOrValue(const Char *&from, const Char *to); - void parseValue(const Char *&from, const Char *to); - void parseTuple(const Char *&from, const Char *to); - void parseTuple_helper(const Char *&from, const Char *to); - void parseList(const Char *&from, const Char *to); + static QByteArray parseCString(const char *&from, const char *to); + void parseResultOrValue(const char *&from, const char *to); + void parseValue(const char *&from, const char *to); + void parseTuple(const char *&from, const char *to); + void parseTuple_helper(const char *&from, const char *to); + void parseList(const char *&from, const char *to); void dumpChildren(QByteArray *str, bool multiline, int indent) const; }; @@ -171,8 +167,6 @@ public: int token; GdbResultClass resultClass; GdbMi data; -private: - friend class GdbMi; }; } // namespace Internal diff --git a/src/plugins/designer/cpp/formclasswizard.cpp b/src/plugins/designer/cpp/formclasswizard.cpp index 77d002f2d723008bab2825ada3bfab45f1db1348..c480fc059fcf2dc0ab59f1f9b38d963bf913a63a 100644 --- a/src/plugins/designer/cpp/formclasswizard.cpp +++ b/src/plugins/designer/cpp/formclasswizard.cpp @@ -43,8 +43,6 @@ #include <QtCore/QDir> #include <QtCore/QDebug> -enum { debugFormClassWizard = 0 }; - using namespace Designer; using namespace Designer::Internal; @@ -111,7 +109,7 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e sourceFile.setContents(source); headerFile.setContents(header); - if (debugFormClassWizard) + if (Designer::Constants::Internal::debug) qDebug() << Q_FUNC_INFO << '\n' << header << '\n' << source; return Core::GeneratedFiles() << headerFile << sourceFile << uiFile; diff --git a/src/plugins/designer/designerconstants.h b/src/plugins/designer/designerconstants.h index 0f4024f2b9a00caa6b4a303d4e36e06a58ce6fec..f403f6322f2e238492e0207799e3587b8bf04909 100644 --- a/src/plugins/designer/designerconstants.h +++ b/src/plugins/designer/designerconstants.h @@ -67,6 +67,9 @@ enum EditModes NumEditModes }; +namespace Internal { + enum { debug = 0 }; +} } // Constants } // Designer diff --git a/src/plugins/designer/formeditorfactory.cpp b/src/plugins/designer/formeditorfactory.cpp index 81d910ee9df2cd0b7db0dfa385b3247674449039..b07140eff61491eb0530579ea418dbb3da995689 100644 --- a/src/plugins/designer/formeditorfactory.cpp +++ b/src/plugins/designer/formeditorfactory.cpp @@ -46,11 +46,10 @@ using namespace Designer::Internal; using namespace Designer::Constants; -FormEditorFactory::FormEditorFactory(Core::ICore *core) : - Core::IEditorFactory(core), +FormEditorFactory::FormEditorFactory() + : Core::IEditorFactory(Core::ICore::instance()), m_kind(QLatin1String(C_FORMEDITOR)), - m_mimeTypes(QLatin1String(FORM_MIMETYPE)), - m_core(core) + m_mimeTypes(QLatin1String(FORM_MIMETYPE)) { Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance(); iconProvider->registerIconForSuffix(QIcon(":/formeditor/images/qt_ui.png"), @@ -64,7 +63,7 @@ QString FormEditorFactory::kind() const Core::IFile *FormEditorFactory::open(const QString &fileName) { - Core::IEditor *iface = m_core->editorManager()->openEditor(fileName, kind()); + Core::IEditor *iface = Core::ICore::instance()->editorManager()->openEditor(fileName, kind()); return iface ? iface->file() : 0; } diff --git a/src/plugins/designer/formeditorfactory.h b/src/plugins/designer/formeditorfactory.h index 5d13e45080a4fda240261dba166dd24d590389d5..4db6e3f8b12193d8631479cda2200eacf8725c1b 100644 --- a/src/plugins/designer/formeditorfactory.h +++ b/src/plugins/designer/formeditorfactory.h @@ -39,7 +39,6 @@ #include <QtCore/QStringList> namespace Core { -class ICore; class IEditor; class IFile; } @@ -52,10 +51,11 @@ class FormEditorFactory : public Core::IEditorFactory Q_OBJECT public: - FormEditorFactory(Core::ICore *core); + FormEditorFactory(); virtual QStringList mimeTypes() const; - //EditorFactory + + // IEditorFactory virtual QString kind() const; Core::IFile *open(const QString &fileName); Core::IEditor *createEditor(QWidget *parent); @@ -63,7 +63,6 @@ public: private: const QString m_kind; const QStringList m_mimeTypes; - Core::ICore *m_core; }; } // namespace Internal diff --git a/src/plugins/designer/formeditorplugin.cpp b/src/plugins/designer/formeditorplugin.cpp index efd9a3b64effce4cc695806680a023d22a70fabf..823efb590d19d1be3a1ad12f6cf58247aad510e5 100644 --- a/src/plugins/designer/formeditorplugin.cpp +++ b/src/plugins/designer/formeditorplugin.cpp @@ -104,7 +104,7 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error) const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR)); const QList<int> context = QList<int>() << uid; - m_factory = new FormEditorFactory(core); + m_factory = new FormEditorFactory; addObject(m_factory); // Make sure settings pages and action shortcuts are registered diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp index 05a4001effb71fb436d067c218c08c8ce4038301..da8374091d5f17e6506570b6a7f122e725524287 100644 --- a/src/plugins/designer/formeditorw.cpp +++ b/src/plugins/designer/formeditorw.cpp @@ -83,7 +83,6 @@ #include <QtCore/QDebug> #include <QtCore/QSettings> -enum { debugFormEditor = 0 }; enum { wantCodeGenerationAction = 0 }; static const char *editorWidgetStateKeyC = "editorWidgetState"; @@ -169,7 +168,7 @@ FormEditorW::FormEditorW() : m_actionPrint(0), m_actionGenerateCode(0) { - if (debugFormEditor) + if (Designer::Constants::Internal::debug) qDebug() << Q_FUNC_INFO; QTC_ASSERT(!m_self, return); m_self = this; @@ -220,7 +219,7 @@ void FormEditorW::fullInit() { QTC_ASSERT(m_initStage == RegisterPlugins, return); QTime *initTime = 0; - if (debugFormEditor) { + if (Designer::Constants::Internal::debug) { initTime = new QTime; initTime->start(); } @@ -244,7 +243,7 @@ void FormEditorW::fullInit() } } - if (debugFormEditor) { + if (Designer::Constants::Internal::debug) { qDebug() << Q_FUNC_INFO << initTime->elapsed() << "ms"; delete initTime; } @@ -282,7 +281,7 @@ void FormEditorW::initDesignerSubWindows() void FormEditorW::ensureInitStage(InitializationStage s) { - if (debugFormEditor) + if (Designer::Constants::Internal::debug) qDebug() << Q_FUNC_INFO << s; if (!m_self) m_self = new FormEditorW; @@ -561,8 +560,9 @@ FormWindowEditor *FormEditorW::createFormWindowEditor(QWidget* parentWidget) QDesignerFormWindowInterface *form = m_fwm->createFormWindow(0); connect(form, SIGNAL(toolChanged(int)), this, SLOT(toolChanged(int))); qdesigner_internal::FormWindowBase::setupDefaultAction(form); - FormWindowEditor *fww = new FormWindowEditor(m_core, m_context, form, parentWidget); - // Store a pointer to all form windows so we can unselect all other formwindows except the active one. + FormWindowEditor *fww = new FormWindowEditor(m_context, form, parentWidget); + // Store a pointer to all form windows so we can unselect + // all other formwindows except the active one. m_formWindows.append(fww); connect(fww, SIGNAL(destroyed()), this, SLOT(editorDestroyed())); return fww; @@ -572,8 +572,8 @@ void FormEditorW::editorDestroyed() { QObject *source = sender(); - if (debugFormEditor) - qDebug() << "FormEditorW::editorDestroyed()" << source; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << source; for (EditorList::iterator it = m_formWindows.begin(); it != m_formWindows.end(); ) { if (*it == source) { @@ -587,8 +587,8 @@ void FormEditorW::editorDestroyed() void FormEditorW::currentEditorChanged(Core::IEditor *editor) { - if (debugFormEditor) - qDebug() << "FormEditorW::currentEditorChanged" << editor << " of " << m_fwm->formWindowCount(); + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << editor << " of " << m_fwm->formWindowCount(); // Deactivate Designer if a non-form is being edited if (editor && !qstrcmp(editor->kind(), Constants::C_FORMWINDOW)) { @@ -603,8 +603,8 @@ void FormEditorW::currentEditorChanged(Core::IEditor *editor) void FormEditorW::activeFormWindowChanged(QDesignerFormWindowInterface *afw) { - if (debugFormEditor) - qDebug() << "FormEditorW::activeFormWindowChanged" << afw << " of " << m_fwm->formWindowCount() << m_formWindows; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << afw << " of " << m_fwm->formWindowCount() << m_formWindows; m_fwm->closeAllPreviews(); @@ -716,7 +716,6 @@ void FormEditorW::print() painter.drawPixmap(0, 0, pixmap); m_core->mainWindow()->setCursor(oldCursor); -// m_core->statusBar()->showMessage(tr("Printed %1...").arg(QFileInfo(fw->fileName()).fileName())); } while (false); m_core->printer()->setFullPage(oldFullPage); m_core->printer()->setOrientation(oldOrientation); diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp index 1c142c483e0b086fc37c7dbbe19649c932d1ffe3..be6b763e61cdbbc0c9e13c764f4fcd05a074e26f 100644 --- a/src/plugins/designer/formwindoweditor.cpp +++ b/src/plugins/designer/formwindoweditor.cpp @@ -64,8 +64,6 @@ using ProjectExplorer::ProjectNode; using ProjectExplorer::FolderNode; using ProjectExplorer::FileNode; -enum { debugFormWindowEditor = 0 }; - class QrcFilesVisitor : public NodesVisitor { public: @@ -96,22 +94,21 @@ void QrcFilesVisitor::visitFolderNode(FolderNode *folderNode) } -FormWindowEditor::FormWindowEditor(Core::ICore *core, - const QList<int> &context, +FormWindowEditor::FormWindowEditor(const QList<int> &context, QDesignerFormWindowInterface *form, - QObject *parent) : - Core::IEditor(parent), + QObject *parent) + : Core::IEditor(parent), m_context(context), m_formWindow(form), - m_file(new FormWindowFile(core, form, this)), + m_file(new FormWindowFile(form, this)), m_host(new FormWindowHost(form)), m_editorWidget(new EditorWidget(m_host)), m_toolBar(0), m_sessionNode(0), m_sessionWatcher(0) { - if (debugFormWindowEditor) - qDebug() << "FormWindowEditor::FormWindowEditor" << form << parent; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << form << parent; connect(m_file, SIGNAL(reload(QString)), this, SLOT(slotOpen(QString))); connect(m_file, SIGNAL(setDisplayName(QString)), this, SLOT(slotSetDisplayName(QString))); @@ -131,8 +128,8 @@ FormWindowEditor::~FormWindowEditor() delete m_toolBar; delete m_host; delete m_editorWidget; - if (debugFormWindowEditor) - qDebug() << "FormWindowEditor::~FormWindowEditor" << m_displayName; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << m_displayName; if (m_sessionNode && m_sessionWatcher) { m_sessionNode->unregisterWatcher(m_sessionWatcher); delete m_sessionWatcher; @@ -141,8 +138,8 @@ FormWindowEditor::~FormWindowEditor() bool FormWindowEditor::createNew(const QString &contents) { - if (debugFormWindowEditor) - qDebug() << "FormWindowEditor::createNew()" << contents.size() << "chars"; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << contents.size() << "chars"; if (!m_formWindow) return false; @@ -158,8 +155,8 @@ bool FormWindowEditor::createNew(const QString &contents) bool FormWindowEditor::open(const QString &fileName /*= QString()*/) { - if (debugFormWindowEditor) - qDebug() << "FormWindowEditor::open" << fileName; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << fileName; if (fileName.isEmpty()) { setDisplayName(tr("untitled")); @@ -241,8 +238,8 @@ void FormWindowEditor::slotOpen(const QString &fileName) void FormWindowEditor::slotSetDisplayName(const QString &title) { - if (debugFormWindowEditor) - qDebug() << "FormWindowEditor::slotSetDisplayName" << title; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << title; setDisplayName(title); } @@ -305,8 +302,8 @@ QWidget *FormWindowEditor::widget() bool FormWindowEditor::generateCode(QByteArray &header, QString &errorMessage) const { - if (debugFormWindowEditor) - qDebug() << "FormWindowEditor::generateCode"; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO; QString tempPattern = QDir::tempPath(); if (!tempPattern.endsWith(QDir::separator())) // platform-dependant diff --git a/src/plugins/designer/formwindoweditor.h b/src/plugins/designer/formwindoweditor.h index e448d8a6514367c1b54101e67040b03f3af36b69..6a449aeb96f2c444e9860d147504fb520b364b25 100644 --- a/src/plugins/designer/formwindoweditor.h +++ b/src/plugins/designer/formwindoweditor.h @@ -45,10 +45,6 @@ class QDesignerFormWindowManagerInterface; class QFile; QT_END_NAMESPACE -namespace Core { -class ICore; -} - namespace ProjectExplorer { class SessionNode; class NodesWatcher; @@ -60,6 +56,7 @@ namespace Internal { class FormWindowFile; class FormWindowHost; class EditorWidget; + // Master class maintaining a form window editor, // containing file and widget host @@ -68,8 +65,7 @@ class FormWindowEditor : public Core::IEditor Q_OBJECT public: - FormWindowEditor(Core::ICore *core, - const QList<int> &context, + FormWindowEditor(const QList<int> &context, QDesignerFormWindowInterface *form, QObject *parent = 0); ~FormWindowEditor(); @@ -85,7 +81,7 @@ public: void setDisplayName(const QString &title); QToolBar *toolBar(); QByteArray saveState() const; - bool restoreState(const QByteArray &/*state*/); + bool restoreState(const QByteArray &state); // ContextInterface QList<int> context() const; diff --git a/src/plugins/designer/formwindowfile.cpp b/src/plugins/designer/formwindowfile.cpp index 49387adb45b2448f99c13bb637c57ff6b7f925e9..f2d833642a40b9c668abbfe12e17fef7ad410bf5 100644 --- a/src/plugins/designer/formwindowfile.cpp +++ b/src/plugins/designer/formwindowfile.cpp @@ -53,20 +53,10 @@ using namespace Designer::Internal; using namespace Designer::Constants; using namespace SharedTools; -enum { debugFormWindowFile = 0 }; - - -FormWindowFile::FormWindowFile(Core::ICore *core, - QDesignerFormWindowInterface *form, - QObject *parent) : - Core::IFile(parent), +FormWindowFile::FormWindowFile(QDesignerFormWindowInterface *form, QObject *parent) + : Core::IFile(parent), m_mimeType(QLatin1String(FORM_MIMETYPE)), - m_formWindow(form), - m_core(core) -{ -} - -FormWindowFile::~FormWindowFile() + m_formWindow(form) { } @@ -74,8 +64,8 @@ bool FormWindowFile::save(const QString &name /*= QString()*/) { const QString actualName = name.isEmpty() ? fileName() : name; - if (debugFormWindowFile) - qDebug() << "FormWindowFile::save" << name << "->" << actualName; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << name << "->" << actualName; if (actualName.isEmpty()) return false; @@ -125,8 +115,8 @@ bool FormWindowFile::isSaveAsAllowed() const void FormWindowFile::modified(Core::IFile::ReloadBehavior *behavior) { - if (debugFormWindowFile) - qDebug() << "FormWindowFile::modified" << m_fileName << *behavior; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << m_fileName << *behavior; switch (*behavior) { case Core::IFile::ReloadNone: @@ -141,7 +131,7 @@ void FormWindowFile::modified(Core::IFile::ReloadBehavior *behavior) break; } - switch (Core::Utils::reloadPrompt(m_fileName, m_core->mainWindow())) { + switch (Core::Utils::reloadPrompt(m_fileName, Core::ICore::instance()->mainWindow())) { case Core::Utils::ReloadCurrent: emit reload(m_fileName); break; @@ -164,8 +154,8 @@ QString FormWindowFile::defaultPath() const void FormWindowFile::setSuggestedFileName(const QString &fileName) { - if (debugFormWindowFile) - qDebug() << "FormWindowFile:setSuggestedFileName" << m_fileName << fileName; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << m_fileName << fileName; m_suggestedName = fileName; } @@ -182,8 +172,8 @@ QString FormWindowFile::mimeType() const bool FormWindowFile::writeFile(const QString &fileName, QString &errorString) const { - if (debugFormWindowFile) - qDebug() << "FormWindowFile::writeFile" << m_fileName << fileName; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << m_fileName << fileName; QFile file(fileName); if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { diff --git a/src/plugins/designer/formwindowfile.h b/src/plugins/designer/formwindowfile.h index c94e25da5b787db9f73faeba832aee5141d97759..6079cdf3251dcccd8a91fd351ca7c08c3781eb4d 100644 --- a/src/plugins/designer/formwindowfile.h +++ b/src/plugins/designer/formwindowfile.h @@ -41,31 +41,22 @@ QT_BEGIN_NAMESPACE class QDesignerFormWindowInterface; -class QDesignerFormWindowManagerInterface; class QFile; QT_END_NAMESPACE -namespace Core { -class ICore; -} - namespace Designer { namespace Internal { class FormWindowSelection; -class FormWindowFile - : public Core::IFile +class FormWindowFile : public Core::IFile { Q_OBJECT public: - FormWindowFile(Core::ICore *core, - QDesignerFormWindowInterface *form, - QObject *parent = 0); - ~FormWindowFile(); + FormWindowFile(QDesignerFormWindowInterface *form, QObject *parent = 0); - //IFile + // IFile bool save(const QString &fileName = QString()); QString fileName() const; bool isModified() const; @@ -97,7 +88,6 @@ private: QString m_suggestedName; QDesignerFormWindowInterface *m_formWindow; - Core::ICore *m_core; }; } // namespace Internal diff --git a/src/plugins/designer/formwindowhost.cpp b/src/plugins/designer/formwindowhost.cpp index e1de87af80e7c5971caa037094ac23cf91d5cb57..a2f3da0f0f9b7b075eefb7ee3a3ceda7d1c22631 100644 --- a/src/plugins/designer/formwindowhost.cpp +++ b/src/plugins/designer/formwindowhost.cpp @@ -44,8 +44,6 @@ using namespace Designer::Internal; using namespace SharedTools; -enum { debugFormWindowHost = 0 }; - FormWindowHost::FormWindowHost(QDesignerFormWindowInterface *form, QWidget *parent) : WidgetHost(parent, form) @@ -57,14 +55,14 @@ FormWindowHost::FormWindowHost(QDesignerFormWindowInterface *form, FormWindowHost::~FormWindowHost() { - if (debugFormWindowHost) - qDebug() << "FormWindowHost::~FormWindowHost"; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO; } void FormWindowHost::formSizeChanged(int w, int h) { - if (debugFormWindowHost) - qDebug() << "FormWindowHost::formSizeChanged" << w << h; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << w << h; formWindow()->setDirty(true); static const QString geometry = QLatin1String("geometry"); diff --git a/src/plugins/designer/formwizard.cpp b/src/plugins/designer/formwizard.cpp index d69c2abbbbc7cb62784cfae46ee42bc61b867ecd..77029f6500aa18987c8d07c8916fd6383198f27c 100644 --- a/src/plugins/designer/formwizard.cpp +++ b/src/plugins/designer/formwizard.cpp @@ -39,8 +39,6 @@ #include <QtCore/QFile> #include <QtCore/QDebug> -enum { debugFormWizard = 0 }; - using namespace Designer; using namespace Designer::Internal; diff --git a/src/plugins/designer/settingsmanager.cpp b/src/plugins/designer/settingsmanager.cpp index 3edad0921b84548b8825b778513a57a898f30dc1..a827ddf162aa6b0749c88658ed74b91f525cdfe3 100644 --- a/src/plugins/designer/settingsmanager.cpp +++ b/src/plugins/designer/settingsmanager.cpp @@ -32,26 +32,23 @@ ***************************************************************************/ #include "settingsmanager.h" +#include "designerconstants.h" #include <QtCore/QDebug> using namespace Designer::Internal; -namespace { - bool debug = false; -} - void SettingsManager::beginGroup(const QString &prefix) { - if (debug) - qDebug() << "Designer - beginning group " << addPrefix(prefix); + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << addPrefix(prefix); m_settings.beginGroup(addPrefix(prefix)); } void SettingsManager::endGroup() { - if (debug) - qDebug() << "Designer - end group"; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO; m_settings.endGroup(); } @@ -62,16 +59,16 @@ bool SettingsManager::contains(const QString &key) const void SettingsManager::setValue(const QString &key, const QVariant &value) { - if (debug) - qDebug() << "Designer - storing " << addPrefix(key) << ": " << value; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << addPrefix(key) << ": " << value; m_settings.setValue(addPrefix(key), value); } QVariant SettingsManager::value(const QString &key, const QVariant &defaultValue) const { QVariant result = m_settings.value(addPrefix(key), defaultValue); - if (debug) - qDebug() << "Designer - retrieving " << addPrefix(key) << ": " << result; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << addPrefix(key) << ": " << result; return result; } diff --git a/src/plugins/designer/workbenchintegration.cpp b/src/plugins/designer/workbenchintegration.cpp index 9e25f80432a782eda98d7f8825f4be0262337cb6..6f699b838179db37ef2702cba9ab9764bfb9d957 100644 --- a/src/plugins/designer/workbenchintegration.cpp +++ b/src/plugins/designer/workbenchintegration.cpp @@ -59,7 +59,6 @@ #include <QtCore/QFileInfo> #include <QtCore/QDebug> -enum { debugSlotNavigation = 0 }; enum { indentation = 4 }; using namespace Designer::Internal; @@ -149,7 +148,7 @@ static bool matchMemberClassName(const QString &needle, const QString &hayStack) // Find class definition in namespace static const Class *findClass(const Namespace *parentNameSpace, const QString &className, QString *namespaceName) { - if (debugSlotNavigation) + if (Designer::Constants::Internal::debug) qDebug() << Q_FUNC_INFO << className; const Overview o; @@ -487,7 +486,7 @@ static ClassDocumentPtrPair const Document::Ptr &doc, const QString &className, unsigned maxIncludeDepth, QString *namespaceName) { - if (debugSlotNavigation) + if (Designer::Constants::Internal::debug) qDebug() << Q_FUNC_INFO << doc->fileName() << maxIncludeDepth; // Check document if (const Class *cl = findClass(doc->globalNamespace(), className, namespaceName)) @@ -548,8 +547,8 @@ bool WorkbenchIntegration::navigateToSlot(const QString &objectName, const CPlusPlus::Snapshot docTable = cppModelManagerInstance()->snapshot(); QList<Document::Ptr> docList = findDocumentsIncluding(docTable, uicedName, true); // change to false when we know the absolute path to generated ui_<>.h file - if (debugSlotNavigation) - qDebug() << objectName << signalSignature << "Looking for " << uicedName << " returned " << docList.size(); + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << objectName << signalSignature << "Looking for " << uicedName << " returned " << docList.size(); if (docList.isEmpty()) { *errorMessage = tr("No documents matching %1 could be found.").arg(uicedName); return false; @@ -559,7 +558,7 @@ bool WorkbenchIntegration::navigateToSlot(const QString &objectName, const QString uiClass = uiClassName(fwi->mainContainer()->objectName()); - if (debugSlotNavigation) + if (Designer::Constants::Internal::debug) qDebug() << "Checking docs for " << uiClass; // Find the class definition in the file itself or in the directly @@ -587,8 +586,8 @@ bool WorkbenchIntegration::navigateToSlot(const QString &objectName, const QString functionName = QLatin1String("on_") + objectName + QLatin1Char('_') + signalSignature; const QString functionNameWithParameterNames = addParameterNames(functionName, parameterNames); - if (debugSlotNavigation) - qDebug() << "Found " << uiClass << doc->fileName() << " checking " << functionName << functionNameWithParameterNames; + if (Designer::Constants::Internal::debug) + qDebug() << Q_FUNC_INFO << "Found " << uiClass << doc->fileName() << " checking " << functionName << functionNameWithParameterNames; int line = 0; Document::Ptr sourceDoc; diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp index 547ea00f92b2fef4ec19be420b2eb623d358e95d..cb93d8ed67763f18f9d4a3ff67b9087edec896f2 100644 --- a/src/plugins/perforce/perforceplugin.cpp +++ b/src/plugins/perforce/perforceplugin.cpp @@ -58,7 +58,7 @@ #include <vcsbase/basevcssubmiteditorfactory.h> #include <vcsbase/vcsbaseeditor.h> -#include <QtCore/qplugin.h> +#include <QtCore/QtPlugin> #include <QtCore/QDebug> #include <QtCore/QDir> #include <QtCore/QFileInfo> diff --git a/src/plugins/perforce/workbenchclientuser.cpp b/src/plugins/perforce/workbenchclientuser.cpp index d8943ffd085758c76a3bbb4bcc93fc9bef751713..64dd3085eb5fa8efb6a0830e52a976a2cf81b5aa 100644 --- a/src/plugins/perforce/workbenchclientuser.cpp +++ b/src/plugins/perforce/workbenchclientuser.cpp @@ -95,7 +95,7 @@ QString PromptDialog::input() const WorkbenchClientUser::WorkbenchClientUser(PerforceOutputWindow *out, PerforcePlugin *plugin) : QObject(out), m_plugin(plugin), - m_coreIFace(PerforcePlugin::coreInstance()), + m_core(Core::ICore::instance()), m_currentEditorIface(0), m_userCancelled(false), m_mode(Submit), @@ -103,7 +103,7 @@ WorkbenchClientUser::WorkbenchClientUser(PerforceOutputWindow *out, PerforcePlug m_skipNextMsg(false), m_eventLoop(new QEventLoop(this)) { - connect(m_coreIFace, SIGNAL(coreAboutToClose()), + connect(m_core, SIGNAL(coreAboutToClose()), this, SLOT(cancelP4Command())); } @@ -147,13 +147,13 @@ void WorkbenchClientUser::displayErrorMsg(const QString &msg) const QString title = tr("Perforce Error"); switch (m_mode) { case Submit: { - QMessageBox msgBox(QMessageBox::Critical, title, msg, QMessageBox::Ok, m_coreIFace->mainWindow()); + QMessageBox msgBox(QMessageBox::Critical, title, msg, QMessageBox::Ok, m_core->mainWindow()); msgBox.setDetailedText(m_msg); msgBox.exec(); } break; default: - QMessageBox::critical(m_coreIFace->mainWindow(), title, msg); + QMessageBox::critical(m_core->mainWindow(), title, msg); break; } m_errMsg.clear(); @@ -182,7 +182,7 @@ bool WorkbenchClientUser::editorAboutToClose(Core::IEditor *editor) if (editor && editor == m_currentEditorIface) { if (m_mode == WorkbenchClientUser::Submit) { const QMessageBox::StandardButton answer = - QMessageBox::question(m_coreIFace->mainWindow(), + QMessageBox::question(m_core->mainWindow(), tr("Closing p4 Editor"), tr("Do you want to submit this change list?"), QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes); @@ -190,9 +190,9 @@ bool WorkbenchClientUser::editorAboutToClose(Core::IEditor *editor) return false; if (answer == QMessageBox::No) m_userCancelled = true; - m_coreIFace->fileManager()->blockFileChange(m_currentEditorIface->file()); + m_core->fileManager()->blockFileChange(m_currentEditorIface->file()); m_currentEditorIface->file()->save(); - m_coreIFace->fileManager()->unblockFileChange(m_currentEditorIface->file()); + m_core->fileManager()->unblockFileChange(m_currentEditorIface->file()); } m_eventLoop->quit(); m_currentEditorIface = 0; @@ -228,7 +228,7 @@ void WorkbenchClientUser::Diff(FileSys *f1, FileSys *f2, int, char *, Error *err delete file2; QString title = QString("diff %1").arg(f1->Name()); - m_currentEditorIface = m_coreIFace->editorManager()->newFile("Perforce Editor", &title, tmp.readAll()); + m_currentEditorIface = m_core->editorManager()->newFile("Perforce Editor", &title, tmp.readAll()); if (!m_currentEditorIface) { err->Set(E_FAILED, "p4 data could not be opened!"); return; @@ -246,8 +246,8 @@ void WorkbenchClientUser::Edit(FileSys *f, Error *err) m_currentEditorIface = m_plugin->openPerforceSubmitEditor(fileName, QStringList()); } else { - m_currentEditorIface = m_coreIFace->editorManager()->openEditor(fileName); - m_coreIFace->editorManager()->ensureEditorManagerVisible(); + m_currentEditorIface = m_core->editorManager()->openEditor(fileName); + m_core->editorManager()->ensureEditorManagerVisible(); } if (!m_currentEditorIface) { err->Set(E_FAILED, "p4 data could not be opened!"); @@ -265,7 +265,7 @@ void WorkbenchClientUser::Prompt(const StrPtr &msg, StrBuf &answer, int , Error err->Set(E_FATAL, ""); return; } - PromptDialog dia(msg.Text(), m_msg, qobject_cast<QWidget*>(m_coreIFace)); + PromptDialog dia(msg.Text(), m_msg, qobject_cast<QWidget*>(m_core)); dia.exec(); answer = qstrdup(dia.input().toLatin1().constData()); if (m_mode == WorkbenchClientUser::Resolve) { @@ -282,5 +282,5 @@ void WorkbenchClientUser::Prompt(const StrPtr &msg, StrBuf &answer, int , Error void WorkbenchClientUser::ErrorPause(char *msg, Error *) { - QMessageBox::warning(m_coreIFace->mainWindow(), tr("Perforce Error"), QString::fromUtf8(msg)); + QMessageBox::warning(m_core->mainWindow(), tr("Perforce Error"), QString::fromUtf8(msg)); } diff --git a/src/plugins/perforce/workbenchclientuser.h b/src/plugins/perforce/workbenchclientuser.h index 200b68a9683b06bb6c350ff45aada2ab6d8e551a..8aef183e42d38473c676aaf353d6ae096d610fad 100644 --- a/src/plugins/perforce/workbenchclientuser.h +++ b/src/plugins/perforce/workbenchclientuser.h @@ -61,8 +61,7 @@ class PerforcePlugin; class PromptDialog : public QDialog { public: - PromptDialog(const QString &choice, const QString &text, - QWidget *parent = 0); + PromptDialog(const QString &choice, const QString &text, QWidget *parent = 0); QString input() const; private: @@ -96,7 +95,7 @@ private: void displayErrorMsg(const QString &msg); PerforcePlugin *m_plugin; - Core::ICore *m_coreIFace; + Core::ICore *m_core; Core::IEditor *m_currentEditorIface; bool m_userCancelled; Mode m_mode; diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index 029707155e5dffa7da2aee311eb28bb6befa6cb9..1cb9979538c9e9e386f7148c5fb48c68b9c5583a 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -61,7 +61,7 @@ class FirstRowFilter : public QSortFilterProxyModel public: FirstRowFilter(QObject *parent = 0) : QSortFilterProxyModel(parent) {} protected: - bool filterAcceptsRow (int source_row, const QModelIndex & ) const { + bool filterAcceptsRow(int source_row, const QModelIndex &) const { return source_row != 0; } }; @@ -74,15 +74,14 @@ protected: Shows a file system folder */ -FolderNavigationWidget::FolderNavigationWidget(Core::ICore *core, QWidget *parent) - : QWidget(parent), - m_core(core), - m_explorer(ProjectExplorerPlugin::instance()), - m_view(new QListView(this)), - m_dirModel(new QDirModel(this)), - m_filter(new FirstRowFilter(this)), - m_title(new QLabel(this)), - m_autoSync(false) +FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) + : QWidget(parent), + m_explorer(ProjectExplorerPlugin::instance()), + m_view(new QListView(this)), + m_dirModel(new QDirModel(this)), + m_filter(new FirstRowFilter(this)), + m_title(new QLabel(this)), + m_autoSync(false) { m_dirModel->setFilter(QDir::Dirs | QDir::Files | QDir::Drives | QDir::Readable | QDir::Writable | QDir::Executable | QDir::Hidden); @@ -124,14 +123,14 @@ void FolderNavigationWidget::setAutoSynchronization(bool sync) m_autoSync = sync; - Core::FileManager *fileManager = m_core->fileManager(); + Core::FileManager *fileManager = Core::ICore::instance()->fileManager(); if (m_autoSync) { - connect(fileManager, SIGNAL(currentFileChanged(const QString&)), - this, SLOT(setCurrentFile(const QString&))); + connect(fileManager, SIGNAL(currentFileChanged(QString)), + this, SLOT(setCurrentFile(QString))); setCurrentFile(fileManager->currentFile()); } else { - disconnect(fileManager, SIGNAL(currentFileChanged(const QString&)), - this, SLOT(setCurrentFile(const QString&))); + disconnect(fileManager, SIGNAL(currentFileChanged(QString)), + this, SLOT(setCurrentFile(QString))); } } @@ -171,8 +170,9 @@ void FolderNavigationWidget::openItem(const QModelIndex &index) setCurrentTitle(QDir(m_dirModel->filePath(srcIndex))); } else { const QString filePath = m_dirModel->filePath(srcIndex); - m_core->editorManager()->openEditor(filePath); - m_core->editorManager()->ensureEditorManagerVisible(); + Core::EditorManager *editorManager = Core::ICore::instance()->editorManager(); + editorManager->openEditor(filePath); + editorManager->ensureEditorManagerVisible(); } } } @@ -183,8 +183,7 @@ void FolderNavigationWidget::setCurrentTitle(const QDir &dir) m_title->setToolTip(dir.absolutePath()); } -FolderNavigationWidgetFactory::FolderNavigationWidgetFactory(Core::ICore *core) - : m_core(core) +FolderNavigationWidgetFactory::FolderNavigationWidgetFactory() { } @@ -205,7 +204,7 @@ QKeySequence FolderNavigationWidgetFactory::activationSequence() Core::NavigationView FolderNavigationWidgetFactory::createWidget() { Core::NavigationView n; - FolderNavigationWidget *ptw = new FolderNavigationWidget(m_core); + FolderNavigationWidget *ptw = new FolderNavigationWidget; n.widget = ptw; QToolButton *toggleSync = new QToolButton; toggleSync->setProperty("type", "dockbutton"); diff --git a/src/plugins/projectexplorer/foldernavigationwidget.h b/src/plugins/projectexplorer/foldernavigationwidget.h index c3eba4ce66282795859624d561f06c0c1ced37c6..d0f04f3d5a9cb78e10e2c4d5fd3f19e72330487d 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.h +++ b/src/plugins/projectexplorer/foldernavigationwidget.h @@ -36,15 +36,11 @@ #include <coreplugin/inavigationwidgetfactory.h> -#include <QtGui/QWidget> -#include <QtGui/QListView> #include <QtGui/QDirModel> #include <QtGui/QLabel> +#include <QtGui/QListView> #include <QtGui/QSortFilterProxyModel> - -namespace Core { -class ICore; -} +#include <QtGui/QWidget> namespace ProjectExplorer { @@ -54,10 +50,11 @@ class Node; namespace Internal { -class FolderNavigationWidget : public QWidget { +class FolderNavigationWidget : public QWidget +{ Q_OBJECT public: - FolderNavigationWidget(Core::ICore *core, QWidget *parent = 0); + FolderNavigationWidget(QWidget *parent = 0); bool autoSynchronization() const; void setAutoSynchronization(bool sync); @@ -74,7 +71,6 @@ private slots: private: void setCurrentTitle(const QDir &directory); - Core::ICore *m_core; ProjectExplorerPlugin *m_explorer; QListView *m_view; QDirModel *m_dirModel; @@ -86,14 +82,12 @@ private: class FolderNavigationWidgetFactory : public Core::INavigationWidgetFactory { public: - FolderNavigationWidgetFactory(Core::ICore *core); + FolderNavigationWidgetFactory(); virtual ~FolderNavigationWidgetFactory(); virtual QString displayName(); virtual QKeySequence activationSequence(); virtual Core::NavigationView createWidget(); -private: - Core::ICore *m_core; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/outputwindow.cpp b/src/plugins/projectexplorer/outputwindow.cpp index d34c3f2bb0e3645d0928731c72c6b1587d3e5916..6dc95b2bf053128f90ac76ec3bfde17978494779 100644 --- a/src/plugins/projectexplorer/outputwindow.cpp +++ b/src/plugins/projectexplorer/outputwindow.cpp @@ -55,7 +55,7 @@ using namespace ProjectExplorer::Internal; using namespace ProjectExplorer; -OutputPane::OutputPane(Core::ICore *core) +OutputPane::OutputPane() : m_mainWidget(new QWidget) { // m_insertLineButton = new QToolButton; @@ -78,7 +78,7 @@ OutputPane::OutputPane(Core::ICore *core) this, SLOT(reRunRunControl())); // Stop - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::instance()->actionManager(); QList<int> globalcontext; globalcontext.append(Core::Constants::C_GLOBAL_ID); @@ -107,8 +107,7 @@ OutputPane::OutputPane(Core::ICore *core) connect(m_tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); layout->addWidget(m_tabWidget); - connect(m_tabWidget, SIGNAL(currentChanged(int)), - this, SLOT(tabChanged(int))); + connect(m_tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); m_mainWidget->setLayout(layout); } @@ -129,7 +128,7 @@ QWidget *OutputPane::outputWidget(QWidget *) return m_mainWidget; } -QList<QWidget*> OutputPane::toolBarWidgets(void) const +QList<QWidget*> OutputPane::toolBarWidgets() const { return QList<QWidget*>() << m_reRunButton << m_stopButton ; // << m_insertLineButton; diff --git a/src/plugins/projectexplorer/outputwindow.h b/src/plugins/projectexplorer/outputwindow.h index 674f25cd51d728f41fd45b216e3faa73ee7e6fa4..edc39ac2fb259ab81b3bbb4c1affb0f735e404a8 100644 --- a/src/plugins/projectexplorer/outputwindow.h +++ b/src/plugins/projectexplorer/outputwindow.h @@ -48,10 +48,6 @@ QT_BEGIN_NAMESPACE class QTabWidget; QT_END_NAMESPACE -namespace Core { -class ICore; -} - namespace ProjectExplorer { class RunControl; @@ -65,7 +61,7 @@ class OutputPane : public Core::IOutputPane Q_OBJECT public: - OutputPane(Core::ICore *core); + OutputPane(); ~OutputPane(); QWidget *outputWidget(QWidget *); diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 82dc4a249d9969ab5a512d892f4ee5a3464f1f69..bab8e67b3b9a5905182bf41e9999cabdcc3cc23a 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -157,10 +157,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er addObject(this); - connect(core->fileManager(), SIGNAL(currentFileChanged(const QString&)), - this, SLOT(setCurrentFile(const QString&))); + connect(core->fileManager(), SIGNAL(currentFileChanged(QString)), + this, SLOT(setCurrentFile(QString))); - m_session = new SessionManager(core, this); + m_session = new SessionManager(this); connect(m_session, SIGNAL(projectAdded(ProjectExplorer::Project *)), this, SIGNAL(fileListChanged())); @@ -199,7 +199,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er addAutoReleasedObject(new CoreListenerCheckingForRunningBuild(m_buildManager)); - m_outputPane = new OutputPane(core); + m_outputPane = new OutputPane; addAutoReleasedObject(m_outputPane); connect(m_session, SIGNAL(projectRemoved(ProjectExplorer::Project *)), m_outputPane, SLOT(projectRemoved())); @@ -590,8 +590,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er connect(core, SIGNAL(saveSettingsRequested()), this, SLOT(savePersistentSettings())); - addAutoReleasedObject(new ProjectTreeWidgetFactory(core)); - addAutoReleasedObject(new FolderNavigationWidgetFactory(core)); + addAutoReleasedObject(new ProjectTreeWidgetFactory); + addAutoReleasedObject(new FolderNavigationWidgetFactory); if (QSettings *s = core->settings()) m_recentProjects = s->value("ProjectExplorer/RecentProjects/Files", QStringList()).toStringList(); diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp index 2b891e83f2b2492bc2a54fe9fe05f11a4527432c..f0357dcf3eba68b4aa81b36f49429fc9f7b99b8b 100644 --- a/src/plugins/projectexplorer/projecttreewidget.cpp +++ b/src/plugins/projectexplorer/projecttreewidget.cpp @@ -112,9 +112,8 @@ protected: Shows the projects in form of a tree. */ -ProjectTreeWidget::ProjectTreeWidget(Core::ICore *core, QWidget *parent) +ProjectTreeWidget::ProjectTreeWidget(QWidget *parent) : QWidget(parent), - m_core(core), m_explorer(ProjectExplorerPlugin::instance()), m_view(0), m_model(0), @@ -277,9 +276,8 @@ void ProjectTreeWidget::initView() m_model->fetchMore(sessionIndex); // expand top level projects - for (int i = 0; i < m_model->rowCount(sessionIndex); ++i) { + for (int i = 0; i < m_model->rowCount(sessionIndex); ++i) m_view->expand(m_model->index(i, 0, sessionIndex)); - } setCurrentItem(m_explorer->currentNode(), m_explorer->currentProject()); } @@ -288,8 +286,9 @@ void ProjectTreeWidget::openItem(const QModelIndex &mainIndex) { Node *node = m_model->nodeForIndex(mainIndex); if (node->nodeType() == FileNodeType) { - m_core->editorManager()->openEditor(node->path()); - m_core->editorManager()->ensureEditorManagerVisible(); + Core::EditorManager *editorManager = Core::ICore::instance()->editorManager(); + editorManager->openEditor(node->path()); + editorManager->ensureEditorManagerVisible(); } } @@ -316,8 +315,7 @@ bool ProjectTreeWidget::projectFilter() } -ProjectTreeWidgetFactory::ProjectTreeWidgetFactory(Core::ICore *core) - : m_core(core) +ProjectTreeWidgetFactory::ProjectTreeWidgetFactory() { } @@ -338,7 +336,7 @@ QKeySequence ProjectTreeWidgetFactory::activationSequence() Core::NavigationView ProjectTreeWidgetFactory::createWidget() { Core::NavigationView n; - ProjectTreeWidget *ptw = new ProjectTreeWidget(m_core); + ProjectTreeWidget *ptw = new ProjectTreeWidget; n.widget = ptw; QToolButton *filter = new QToolButton; @@ -359,16 +357,18 @@ void ProjectTreeWidgetFactory::saveSettings(int position, QWidget *widget) { ProjectTreeWidget *ptw = qobject_cast<ProjectTreeWidget *>(widget); Q_ASSERT(ptw); - m_core->settings()->setValue("ProjectTreeWidget."+QString::number(position)+".ProjectFilter", ptw->projectFilter()); - m_core->settings()->setValue("ProjectTreeWidget."+QString::number(position)+".GeneratedFilter", ptw->generatedFilesFilter()); - m_core->settings()->setValue("ProjectTreeWidget."+QString::number(position)+".SyncWithEditor", ptw->autoSynchronization()); + QSettings *settings = Core::ICore::instance()->settings(); + settings->setValue("ProjectTreeWidget."+QString::number(position)+".ProjectFilter", ptw->projectFilter()); + settings->setValue("ProjectTreeWidget."+QString::number(position)+".GeneratedFilter", ptw->generatedFilesFilter()); + settings->setValue("ProjectTreeWidget."+QString::number(position)+".SyncWithEditor", ptw->autoSynchronization()); } void ProjectTreeWidgetFactory::restoreSettings(int position, QWidget *widget) { ProjectTreeWidget *ptw = qobject_cast<ProjectTreeWidget *>(widget); Q_ASSERT(ptw); - ptw->setProjectFilter(m_core->settings()->value("ProjectTreeWidget."+QString::number(position)+".ProjectFilter", false).toBool()); - ptw->setGeneratedFilesFilter(m_core->settings()->value("ProjectTreeWidget."+QString::number(position)+".GeneratedFilter", true).toBool()); - ptw->setAutoSynchronization(m_core->settings()->value("ProjectTreeWidget."+QString::number(position)+".SyncWithEditor", true).toBool()); + QSettings *settings = Core::ICore::instance()->settings(); + ptw->setProjectFilter(settings->value("ProjectTreeWidget."+QString::number(position)+".ProjectFilter", false).toBool()); + ptw->setGeneratedFilesFilter(settings->value("ProjectTreeWidget."+QString::number(position)+".GeneratedFilter", true).toBool()); + ptw->setAutoSynchronization(settings->value("ProjectTreeWidget."+QString::number(position)+".SyncWithEditor", true).toBool()); } diff --git a/src/plugins/projectexplorer/projecttreewidget.h b/src/plugins/projectexplorer/projecttreewidget.h index 4d9224b46e95b1da574f3cdce80fd5403def5fec..dea4c7edb21048a0bcf38ce0baed0b366577f8f7 100644 --- a/src/plugins/projectexplorer/projecttreewidget.h +++ b/src/plugins/projectexplorer/projecttreewidget.h @@ -39,10 +39,6 @@ #include <QtGui/QWidget> #include <QtGui/QTreeView> -namespace Core { -class ICore; -} - namespace ProjectExplorer { class ProjectExplorerPlugin; @@ -53,10 +49,11 @@ namespace Internal { class FlatModel; -class ProjectTreeWidget : public QWidget { +class ProjectTreeWidget : public QWidget +{ Q_OBJECT public: - ProjectTreeWidget(Core::ICore *core, QWidget *parent = 0); + explicit ProjectTreeWidget(QWidget *parent = 0); bool autoSynchronization() const; void setAutoSynchronization(bool sync, bool syncNow = true); @@ -81,7 +78,6 @@ private slots: void initView(); private: - Core::ICore *m_core; ProjectExplorerPlugin *m_explorer; QTreeView *m_view; FlatModel *m_model; @@ -99,15 +95,13 @@ private: class ProjectTreeWidgetFactory : public Core::INavigationWidgetFactory { public: - ProjectTreeWidgetFactory(Core::ICore *core); + ProjectTreeWidgetFactory(); virtual ~ProjectTreeWidgetFactory(); virtual QString displayName(); virtual QKeySequence activationSequence(); virtual Core::NavigationView createWidget(); void restoreSettings(int position, QWidget *widget); void saveSettings(int position, QWidget *widget); -private: - Core::ICore *m_core; }; } // namespace Internal diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index f5b83d162cd2be7e07f2aacbd21dbf83a761fa5d..88f7b53e5599203c877ad8759c06f2b640bc2d94 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -70,13 +70,12 @@ namespace { namespace ProjectExplorer { namespace Internal { -class SessionFile - : public Core::IFile +class SessionFile : public Core::IFile { Q_OBJECT public: - SessionFile(Core::ICore *core); + SessionFile(); bool load(const QString &fileName); bool save(const QString &fileName = QString()); @@ -126,9 +125,9 @@ void SessionFile::sessionLoadingProgress() QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); } -SessionFile::SessionFile(Core::ICore *core) : - m_mimeType(QLatin1String(ProjectExplorer::Constants::SESSIONFILE_MIMETYPE)), - m_core(core), +SessionFile::SessionFile() + : m_mimeType(QLatin1String(ProjectExplorer::Constants::SESSIONFILE_MIMETYPE)), + m_core(Core::ICore::instance()), m_startupProject(0) { } @@ -369,10 +368,10 @@ void Internal::SessionNodeImpl::setFileName(const QString &fileName) /* --------------------------------- */ -SessionManager::SessionManager(Core::ICore *core, QObject *parent) - : QObject(parent), - m_core(core), - m_file(new SessionFile(core)), +SessionManager::SessionManager(QObject *parent) + : QObject(parent), + m_core(Core::ICore::instance()), + m_file(new SessionFile), m_sessionNode(new Internal::SessionNodeImpl(this)) { // Create qtcreator dir if it doesn't yet exist @@ -394,12 +393,11 @@ SessionManager::SessionManager(Core::ICore *core, QObject *parent) connect(m_core->modeManager(), SIGNAL(currentModeChanged(Core::IMode*)), this, SLOT(saveActiveMode(Core::IMode*))); - connect(core->editorManager(), SIGNAL(editorCreated(Core::IEditor *, QString)), + connect(m_core->editorManager(), SIGNAL(editorCreated(Core::IEditor *, QString)), this, SLOT(setEditorCodec(Core::IEditor *, QString))); connect(ProjectExplorerPlugin::instance(), SIGNAL(currentProjectChanged(ProjectExplorer::Project *)), this, SLOT(updateWindowTitle())); - - } +} SessionManager::~SessionManager() { @@ -415,7 +413,6 @@ bool SessionManager::isDefaultVirgin() const && m_core->editorManager()->openedEditors().isEmpty(); } - bool SessionManager::isDefaultSession(const QString &session) const { return session == QLatin1String("default"); @@ -600,7 +597,7 @@ bool SessionManager::createImpl(const QString &fileName) if (success) { delete m_file; emit sessionUnloaded(); - m_file = new SessionFile(m_core); + m_file = new SessionFile; m_file->setFileName(fileName); setStartupProject(defaultStartupProject()); } @@ -634,10 +631,11 @@ bool SessionManager::loadImpl(const QString &fileName) if (success) { delete m_file; + m_file = 0; emit sessionUnloaded(); - m_file = new SessionFile(m_core); + m_file = new SessionFile; if (!m_file->load(fileName)) { - QMessageBox::warning(0, tr("Error while loading session"), \ + QMessageBox::warning(0, tr("Error while loading session"), tr("Could not load session %1").arg(fileName)); success = false; } @@ -880,7 +878,6 @@ void SessionManager::setEditorCodec(Core::IEditor *editor, const QString &fileNa textEditor->setTextCodec(project->editorConfiguration()->defaultTextCodec()); } - QList<Project *> SessionManager::requestCloseOfAllFiles(bool *cancelled) { *cancelled = false; diff --git a/src/plugins/projectexplorer/session.h b/src/plugins/projectexplorer/session.h index f8768ab468bb57087f4edcd09626ffaf5169b4f6..cb465471f7f9c616a46a7699ae13ceed3e692243 100644 --- a/src/plugins/projectexplorer/session.h +++ b/src/plugins/projectexplorer/session.h @@ -65,8 +65,7 @@ class SessionFile; // Must be in header as otherwise moc has issues // with ProjectExplorer::SessionNode on msvc2005 -class SessionNodeImpl - : public ProjectExplorer::SessionNode +class SessionNodeImpl : public ProjectExplorer::SessionNode { Q_OBJECT public: @@ -86,13 +85,12 @@ public: // public interface just wrap around functions which do the actual work // This could be improved. -class PROJECTEXPLORER_EXPORT SessionManager - : public QObject +class PROJECTEXPLORER_EXPORT SessionManager : public QObject { Q_OBJECT public: - SessionManager(Core::ICore *core, QObject *parent = 0); + explicit SessionManager(QObject *parent = 0); ~SessionManager(); // higher level session management diff --git a/src/plugins/qtestlib/qtestlibplugin.cpp b/src/plugins/qtestlib/qtestlibplugin.cpp index 7d0cada5323c365aec704c9097973d40889dce7f..3bb2d1df359366da08993e6aa88e84360448acfc 100644 --- a/src/plugins/qtestlib/qtestlibplugin.cpp +++ b/src/plugins/qtestlib/qtestlibplugin.cpp @@ -33,19 +33,19 @@ #include "qtestlibplugin.h" -#include <Qt4IProjectManagers> -#include <texteditor/TextEditorInterfaces> +//#include <Qt4IProjectManagers> +//#include <texteditor/TextEditorInterfaces> -#include <QtCore/QAction> #include <QtCore/QDebug> #include <QtCore/QDir> #include <QtCore/QFileInfo> -#include <QtCore/QIcon> -#include <QtCore/QKeySequence> #include <QtCore/QTemporaryFile> #include <QtCore/QtPlugin> +#include <QtGui/QAction> #include <QtGui/QComboBox> #include <QtGui/QHeaderView> +#include <QtGui/QIcon> +#include <QtGui/QKeySequence> #include <QtGui/QLabel> #include <QtGui/QSplitter> #include <QtGui/QStandardItemModel> @@ -129,10 +129,9 @@ QTestLibPlugin::~QTestLibPlugin() m_core->pluginManager()->removeObject(m_outputPane); } -bool QTestLibPlugin::init(ExtensionSystem::PluginManagerInterface *app, QString * /*error_message*/) +bool QTestLibPlugin::init(ExtensionSystem::PluginManagerInterface *app, QString *errorMessage) { - m_core = app->getObject<Core::ICore>(); - + Q_UNUSED(errorMessage); m_projectExplorer = app->getObject<ProjectExplorer::ProjectExplorerPlugin>(); connect(m_projectExplorer->qObject(), SIGNAL(aboutToExecuteProject(ProjectExplorer::Project *)), this, SLOT(projectRunHook(ProjectExplorer::Project *))); @@ -383,9 +382,8 @@ bool QTestOutputFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourc // ------- QTestOutputWidget -QTestOutputWidget::QTestOutputWidget(QStandardItemModel *model, Core::ICore *coreInterface, QWidget *parent): - QWidget(parent), - m_coreInterface(coreInterface), +QTestOutputWidget::QTestOutputWidget(QStandardItemModel *model, QWidget *parent) + : QWidget(parent), m_model(model), m_resultsView(new QTreeView(this)), m_filterCombo(new QComboBox(this)), diff --git a/src/plugins/qtestlib/qtestlibplugin.h b/src/plugins/qtestlib/qtestlibplugin.h index 2c804a16c3a3d80b2ce92225b976b5d5712a340f..c442a1ddec6b00235bd47fbed19990fa15a7ceb5 100644 --- a/src/plugins/qtestlib/qtestlibplugin.h +++ b/src/plugins/qtestlib/qtestlibplugin.h @@ -35,17 +35,19 @@ #define QTESTLIBPLUGIN_H #include <coreplugin/ioutputpane.h> -#include <projectexplorer/ProjectExplorerInterfaces> +//#include <projectexplorer/ProjectExplorerInterfaces> -#include <QPixmap> -#include <QStandardItem> -#include <QWidget> -#include <QSortFilterProxyModel> +#include <QtGui/QPixmap> +#include <QtGui/QStandardItem> +#include <QtGui/QWidget> +#include <QtGui/QSortFilterProxyModel> +QT_BEGIN_NAMESPACE class QStandardItemModel; class QTreeView; class QTextEdit; class QComboBox; +QT_END_NAMESPACE namespace QTestLib { namespace Internal { @@ -96,11 +98,10 @@ public: static bool indexHasIncidents(const QModelIndex &function, IncidentType type); }; -class QTestOutputPane : public QObject, - public Core::IOutputPane +class QTestOutputPane : public Core::IOutputPane { Q_OBJECT - Q_INTERFACES(Core::IOutputPane) + //Q_INTERFACES(Core::IOutputPane) public: QTestOutputPane(QTestLibPlugin *plugin); @@ -147,10 +148,9 @@ private: class QTestOutputWidget : public QWidget { Q_OBJECT + public: - QTestOutputWidget(QStandardItemModel *model, - Core::ICore *iCore, - QWidget *parent); + QTestOutputWidget(QStandardItemModel *model, QWidget *parent); void expand(); @@ -159,7 +159,6 @@ private Q_SLOTS: void gotoLocation(QModelIndex index); private: - Core::ICore *m_coreInterface; QStandardItemModel *m_model; QTreeView *m_resultsView; QComboBox *m_filterCombo; @@ -181,10 +180,6 @@ public: bool init(ExtensionSystem::PluginManagerInterface *app, QString *error_message); void extensionsInitialized(); - inline Core::ICore *coreInterface() const { - return m_core; - } - // IApplicationOutput virtual void clear(); virtual void appendOutput(const QString &out); @@ -195,7 +190,6 @@ private slots: private: ProjectExplorer::ProjectExplorerPlugin *m_projectExplorer; - Core::ICore *m_core; QString m_outputFile; QString m_projectDirectory; QTestOutputPane *m_outputPane; diff --git a/src/plugins/qtscripteditor/qtscripteditorplugin.cpp b/src/plugins/qtscripteditor/qtscripteditorplugin.cpp index 41a11d5a7af4f7d6201d72cf7a53b1123b65c295..c8c8e6dea389dac0e61d4418e93186cf555e329a 100644 --- a/src/plugins/qtscripteditor/qtscripteditorplugin.cpp +++ b/src/plugins/qtscripteditor/qtscripteditorplugin.cpp @@ -85,7 +85,7 @@ bool QtScriptEditorPlugin::initialize(const QStringList & /*arguments*/, QString m_context = m_scriptcontext; m_context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); - registerActions(core); + registerActions(); m_editor = new QtScriptEditorFactory(m_context, this); addObject(m_editor); @@ -130,9 +130,9 @@ void QtScriptEditorPlugin::initializeEditor(QtScriptEditor::Internal::ScriptEdit editor->setDisplaySettings(settings->displaySettings()); } -void QtScriptEditorPlugin::registerActions(Core::ICore *core) +void QtScriptEditorPlugin::registerActions() { - Core::ActionManager *am = core->actionManager(); + Core::ActionManager *am = Core::ICore::instance()->actionManager(); Core::ActionContainer *mcontext = am->createMenu(QtScriptEditor::Constants::M_CONTEXT); QAction *action = new QAction(this); diff --git a/src/plugins/qtscripteditor/qtscripteditorplugin.h b/src/plugins/qtscripteditor/qtscripteditorplugin.h index 5bd1d5ba17e3158adf87c27ab1fdfa27d1fd54cf..a2a5981d18acd7446f0f26c91fec9a0db33733da 100644 --- a/src/plugins/qtscripteditor/qtscripteditorplugin.h +++ b/src/plugins/qtscripteditor/qtscripteditorplugin.h @@ -36,19 +36,13 @@ #include <extensionsystem/iplugin.h> -namespace Core { -class ICore; -} - namespace TextEditor { -class FontSettingsPage; class TextFileWizard; -} +} // namespace TextEditor namespace QtScriptEditor { namespace Internal { -class QtScriptWizard; class QtScriptEditorFactory; class ScriptEditor; @@ -60,14 +54,14 @@ public: QtScriptEditorPlugin(); virtual ~QtScriptEditorPlugin(); - //Plugin - bool initialize(const QStringList &arguments, QString *error_message = 0); + // IPlugin + bool initialize(const QStringList &arguments, QString *errorMessage = 0); void extensionsInitialized(); static void initializeEditor(ScriptEditor *editor); private: - void registerActions(Core::ICore *core); + void registerActions(); static QtScriptEditorPlugin *m_instance; diff --git a/src/plugins/quickopen/quickopenplugin.cpp b/src/plugins/quickopen/quickopenplugin.cpp index 3c080cd83840162a7789665d7d3c25228373eacf..0abebe3a88f7528c7d763a9c2f2f879d9463a7cf 100644 --- a/src/plugins/quickopen/quickopenplugin.cpp +++ b/src/plugins/quickopen/quickopenplugin.cpp @@ -83,7 +83,7 @@ QuickOpenPlugin::~QuickOpenPlugin() bool QuickOpenPlugin::initialize(const QStringList &, QString *) { Core::ICore *core = Core::ICore::instance(); - m_settingsPage = new SettingsPage(core, this); + m_settingsPage = new SettingsPage(this); addObject(m_settingsPage); m_quickOpenToolWindow = new QuickOpenToolWindow(this); diff --git a/src/plugins/quickopen/settingspage.cpp b/src/plugins/quickopen/settingspage.cpp index 5d1b3a24b59b0b52833ba076a08a6c14f2018ed4..2dd577aa27d2945a790584de12fc353a3e9f7b3b 100644 --- a/src/plugins/quickopen/settingspage.cpp +++ b/src/plugins/quickopen/settingspage.cpp @@ -45,8 +45,8 @@ Q_DECLARE_METATYPE(QuickOpen::IQuickOpenFilter*) using namespace QuickOpen; using namespace QuickOpen::Internal; -SettingsPage::SettingsPage(Core::ICore *core, QuickOpenPlugin *plugin) - : m_core(core), m_plugin(plugin), m_page(0) +SettingsPage::SettingsPage(QuickOpenPlugin *plugin) + : m_plugin(plugin), m_page(0) { } diff --git a/src/plugins/quickopen/settingspage.h b/src/plugins/quickopen/settingspage.h index e169bca6a0b58d034b66c26f857e186e1e983435..ddd1d5e28880fc14a293da9ca6c51bbccb204222 100644 --- a/src/plugins/quickopen/settingspage.h +++ b/src/plugins/quickopen/settingspage.h @@ -60,7 +60,7 @@ class SettingsPage : public Core::IOptionsPage Q_OBJECT public: - SettingsPage(Core::ICore *core, QuickOpenPlugin *plugin); + explicit SettingsPage(QuickOpenPlugin *plugin); QString name() const { return tr(Constants::FILTER_OPTIONS_PAGE); } QString category() const { return Constants::QUICKOPEN_CATEGORY; } QString trCategory() const { return tr(Constants::QUICKOPEN_CATEGORY); } @@ -82,7 +82,6 @@ private: void requestRefresh(); Ui::SettingsWidget m_ui; - Core::ICore *m_core; QuickOpenPlugin *m_plugin; QPointer<QWidget> m_page; QList<IQuickOpenFilter *> m_filters; diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp index 5a3d567f1ec1f456369e668809524d220428b0f7..4d10297d9b9181584d700f48b4d167893db08f0e 100644 --- a/src/plugins/subversion/subversionplugin.cpp +++ b/src/plugins/subversion/subversionplugin.cpp @@ -132,9 +132,9 @@ static inline QString debugCodec(const QTextCodec *c) return c ? QString::fromAscii(c->name()) : QString::fromAscii("Null codec"); } -inline Core::IEditor* locateEditor(const Core::ICore *core, const char *property, const QString &entry) +Core::IEditor* locateEditor(const char *property, const QString &entry) { - foreach (Core::IEditor *ed, core->editorManager()->openedEditors()) + foreach (Core::IEditor *ed, Core::ICore::instance()->editorManager()->openedEditors()) if (ed->property(property).toString() == entry) return ed; return 0; @@ -164,7 +164,6 @@ StatusList parseStatusOutput(const QString &output) } // ------------- SubversionPlugin -Core::ICore *SubversionPlugin::m_coreInstance = 0; SubversionPlugin *SubversionPlugin::m_subversionPluginInstance = 0; SubversionPlugin::SubversionPlugin() : @@ -261,15 +260,15 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe using namespace ExtensionSystem; m_subversionPluginInstance = this; - m_coreInstance = Core::ICore::instance(); + Core::ICore *core = Core::ICore::instance(); - if (!m_coreInstance->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.subversion/Subversion.mimetypes.xml"), errorMessage)) + if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/trolltech.subversion/Subversion.mimetypes.xml"), errorMessage)) return false; m_versionControl = new SubversionControl(this); addObject(m_versionControl); - if (QSettings *settings = m_coreInstance->settings()) + if (QSettings *settings = core->settings()) m_settings.fromSettings(settings); m_coreListener = new CoreListener(this); @@ -293,7 +292,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe addObject(m_subversionOutputWindow); //register actions - Core::ActionManager *ami = m_coreInstance->actionManager(); + Core::ActionManager *ami = core->actionManager(); Core::ActionContainer *toolsContainer = ami->actionContainer(M_TOOLS); Core::ActionContainer *subversionMenu = @@ -306,7 +305,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe } QList<int> globalcontext; - globalcontext << m_coreInstance->uniqueIDManager()->uniqueIdentifier(C_GLOBAL); + globalcontext << core->uniqueIDManager()->uniqueIdentifier(C_GLOBAL); Core::Command *command; m_addAction = new QAction(tr("Add"), this); @@ -408,7 +407,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe // Actions of the submit editor QList<int> svncommitcontext; - svncommitcontext << m_coreInstance->uniqueIDManager()->uniqueIdentifier(Constants::SUBVERSIONCOMMITEDITOR); + svncommitcontext << Core::ICore::instance()->uniqueIDManager()->uniqueIdentifier(Constants::SUBVERSIONCOMMITEDITOR); m_submitCurrentLogAction = new QAction(VCSBase::VCSBaseSubmitEditor::submitIcon(), tr("Commit"), this); command = ami->registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, svncommitcontext); @@ -423,7 +422,7 @@ bool SubversionPlugin::initialize(const QStringList &arguments, QString *errorMe m_submitRedoAction = new QAction(tr("&Redo"), this); command = ami->registerAction(m_submitRedoAction, Core::Constants::REDO, svncommitcontext); - connect(m_coreInstance, SIGNAL(contextChanged(Core::IContext *)), this, SLOT(updateActions())); + connect(Core::ICore::instance(), SIGNAL(contextChanged(Core::IContext *)), this, SLOT(updateActions())); return true; } @@ -461,7 +460,7 @@ bool SubversionPlugin::editorAboutToClose(Core::IEditor *iEditor) // Prompt user. const QMessageBox::StandardButton answer = QMessageBox::question( - m_coreInstance->mainWindow(), tr("Closing Subversion Editor"), + Core::ICore::instance()->mainWindow(), tr("Closing Subversion Editor"), tr("Do you want to commit the change?"), QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes); switch (answer) { @@ -477,9 +476,9 @@ bool SubversionPlugin::editorAboutToClose(Core::IEditor *iEditor) const QStringList fileList = editor->checkedFiles(); if (!fileList.empty()) { // get message & commit - m_coreInstance->fileManager()->blockFileChange(fileIFace); + Core::ICore::instance()->fileManager()->blockFileChange(fileIFace); fileIFace->save(); - m_coreInstance->fileManager()->unblockFileChange(fileIFace); + Core::ICore::instance()->fileManager()->unblockFileChange(fileIFace); commit(m_changeTmpFile->fileName(), fileList); } cleanChangeTmpFile(); @@ -512,9 +511,9 @@ void SubversionPlugin::svnDiff(const QStringList &files, QString diffname) // the common usage pattern of continuously changing and diffing a file if (files.count() == 1) { // Show in the same editor if diff has been executed before - if (Core::IEditor *editor = locateEditor(m_coreInstance, "originalFileName", files.front())) { + if (Core::IEditor *editor = locateEditor("originalFileName", files.front())) { editor->createNew(response.stdOut); - m_coreInstance->editorManager()->setCurrentEditor(editor); + Core::ICore::instance()->editorManager()->setCurrentEditor(editor); return; } } @@ -526,7 +525,7 @@ void SubversionPlugin::svnDiff(const QStringList &files, QString diffname) SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QString &fileName) { - Core::IEditor *editor = m_coreInstance->editorManager()->openEditor(fileName, QLatin1String(Constants::SUBVERSIONCOMMITEDITOR_KIND)); + Core::IEditor *editor = Core::ICore::instance()->editorManager()->openEditor(fileName, QLatin1String(Constants::SUBVERSIONCOMMITEDITOR_KIND)); SubversionSubmitEditor *submitEditor = qobject_cast<SubversionSubmitEditor*>(editor); QTC_ASSERT(submitEditor, /**/); submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction); @@ -597,7 +596,7 @@ void SubversionPlugin::revertCurrentFile() QMessageBox::Yes, QMessageBox::No) == QMessageBox::No) return; - Core::FileManager *fm = m_coreInstance->fileManager(); + Core::FileManager *fm = Core::ICore::instance()->fileManager(); QList<Core::IFile *> files = fm->managedFiles(file); foreach (Core::IFile *file, files) fm->blockFileChange(file); @@ -775,9 +774,9 @@ void SubversionPlugin::filelog(const QString &file) // Re-use an existing view if possible to support // the common usage pattern of continuously changing and diffing a file - if (Core::IEditor *editor = locateEditor(m_coreInstance, "logFileName", file)) { + if (Core::IEditor *editor = locateEditor("logFileName", file)) { editor->createNew(response.stdOut); - m_coreInstance->editorManager()->setCurrentEditor(editor); + Core::ICore::instance()->editorManager()->setCurrentEditor(editor); } else { const QString title = tr("svn log %1").arg(QFileInfo(file).fileName()); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::LogOutput, file, codec); @@ -818,9 +817,9 @@ void SubversionPlugin::annotate(const QString &file) // Re-use an existing view if possible to support // the common usage pattern of continuously changing and diffing a file - if (Core::IEditor *editor = locateEditor(m_coreInstance, "annotateFileName", file)) { + if (Core::IEditor *editor = locateEditor("annotateFileName", file)) { editor->createNew(response.stdOut); - m_coreInstance->editorManager()->setCurrentEditor(editor); + Core::ICore::instance()->editorManager()->setCurrentEditor(editor); } else { const QString title = tr("svn annotate %1").arg(QFileInfo(file).fileName()); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::AnnotateOutput, file, codec); @@ -872,9 +871,9 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr) // Re-use an existing view if possible to support // the common usage pattern of continuously changing and diffing a file const QString id = diffArg + source; - if (Core::IEditor *editor = locateEditor(m_coreInstance, "describeChange", id)) { + if (Core::IEditor *editor = locateEditor("describeChange", id)) { editor->createNew(response.stdOut); - m_coreInstance->editorManager()->setCurrentEditor(editor); + Core::ICore::instance()->editorManager()->setCurrentEditor(editor); } else { const QString title = tr("svn describe %1#%2").arg(QFileInfo(source).fileName(), changeNr); Core::IEditor *newEditor = showOutputInEditor(title, response.stdOut, VCSBase::DiffOutput, source, codec); @@ -884,13 +883,13 @@ void SubversionPlugin::describe(const QString &source, const QString &changeNr) void SubversionPlugin::submitCurrentLog() { - m_coreInstance->editorManager()->closeEditors(QList<Core::IEditor*>() - << m_coreInstance->editorManager()->currentEditor()); + Core::ICore::instance()->editorManager()->closeEditors(QList<Core::IEditor*>() + << Core::ICore::instance()->editorManager()->currentEditor()); } QString SubversionPlugin::currentFileName() const { - const QString fileName = m_coreInstance->fileManager()->currentFile(); + const QString fileName = Core::ICore::instance()->fileManager()->currentFile(); if (!fileName.isEmpty()) { const QFileInfo fi(fileName); if (fi.exists()) @@ -991,7 +990,7 @@ Core::IEditor * SubversionPlugin::showOutputInEditor(const QString& title, const if (Subversion::Constants::debug) qDebug() << "SubversionPlugin::showOutputInEditor" << title << kind << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec); QString s = title; - Core::IEditor *ediface = m_coreInstance->editorManager()->newFile(kind, &s, output.toLocal8Bit()); + Core::IEditor *ediface = Core::ICore::instance()->editorManager()->newFile(kind, &s, output.toLocal8Bit()); SubversionEditor *e = qobject_cast<SubversionEditor*>(ediface->widget()); if (!e) return 0; @@ -1013,7 +1012,7 @@ void SubversionPlugin::setSettings(const SubversionSettings &s) { if (s != m_settings) { m_settings = s; - if (QSettings *settings = m_coreInstance->settings()) + if (QSettings *settings = Core::ICore::instance()->settings()) m_settings.toSettings(settings); } } diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h index 17285e73351a31aee5922ea7f1b0a7bb96cc6c47..f589468e40f555ce6f2881a3186aa85ce5bd37ab 100644 --- a/src/plugins/subversion/subversionplugin.h +++ b/src/plugins/subversion/subversionplugin.h @@ -54,7 +54,6 @@ class QTextCodec; QT_END_NAMESPACE namespace Core { - class ICore; class IEditorFactory; class IVersionControl; } @@ -189,7 +188,6 @@ private: static const char * const STATUS; static const char * const UPDATE; - static Core::ICore *m_coreInstance; static SubversionPlugin *m_subversionPluginInstance; friend class SubversionOutputWindow; diff --git a/src/plugins/texteditor/basetextdocument.h b/src/plugins/texteditor/basetextdocument.h index 83f42dcee7be51ce24f617821e71cb19693e1b97..72d81d33c859eaa9bfb97f33e8635f6bebb4ed50 100644 --- a/src/plugins/texteditor/basetextdocument.h +++ b/src/plugins/texteditor/basetextdocument.h @@ -46,11 +46,8 @@ class QSyntaxHighlighter; QT_END_NAMESPACE -namespace Core { class ICore; } - namespace TextEditor { - class DocumentMarker : public ITextMarkable { Q_OBJECT @@ -69,9 +66,7 @@ private: }; - -class TEXTEDITOR_EXPORT BaseTextDocument - : public Core::IFile +class TEXTEDITOR_EXPORT BaseTextDocument : public Core::IFile { Q_OBJECT @@ -133,7 +128,6 @@ private: QString m_mimeType; StorageSettings m_storageSettings; TabSettings m_tabSettings; - Core::ICore *m_core; QTextDocument *m_document; DocumentMarker *m_documentMarker; QSyntaxHighlighter *m_highlighter;