Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

Conflicts:
	src/plugins/coreplugin/editormanager/editormanager.cpp
	src/plugins/coreplugin/editormanager/openeditorsview.cpp
	src/plugins/coreplugin/editormanager/stackededitorgroup.cpp
This commit is contained in:
mae
2009-01-21 15:24:20 +01:00
67 changed files with 510 additions and 632 deletions

View File

@@ -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();
}

View File

@@ -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.

View File

@@ -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);

View File

@@ -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))

View File

@@ -32,7 +32,6 @@
***************************************************************************/
#include "settingsdialog.h"
#include "coreimpl.h"
#include <extensionsystem/pluginmanager.h>

View File

@@ -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()));
}
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 {

View File

@@ -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>

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -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)

View File

@@ -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());
}

View File

@@ -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,8 +99,7 @@ public:
QString getSaveAsFileName(IFile *file);
QList<IFile *> saveModifiedFilesSilently(const QList<IFile *> &files);
QList<IFile *> saveModifiedFiles(
const QList<IFile *> &files,
QList<IFile *> saveModifiedFiles(const QList<IFile *> &files,
bool *cancelled = 0,
const QString &message = QString());
@@ -130,7 +129,6 @@ private:
QString m_currentFile;
Core::ICore *m_core;
Internal::MainWindow *m_mainWindow;
QFileSystemWatcher *m_fileWatcher;
QList<QPointer<IFile> > m_changedFiles;

View File

@@ -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,10 +217,9 @@ 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();

View File

@@ -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>

View File

@@ -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

View File

@@ -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;

View File

@@ -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()));
}

View File

@@ -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);

View File

@@ -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")) {

View File

@@ -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())

View File

@@ -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;

View File

@@ -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;
};

View File

@@ -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();

View File

@@ -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");
@@ -3338,7 +3325,6 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record)
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);
}

View File

@@ -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];

View File

@@ -34,8 +34,6 @@
#ifndef DEBUGGER_GDBMI_H
#define DEBUGGER_GDBMI_H
#include <qglobal.h>
#include <QtCore/QByteArray>
#include <QtCore/QList>
@@ -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

View File

@@ -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;

View File

@@ -67,6 +67,9 @@ enum EditModes
NumEditModes
};
namespace Internal {
enum { debug = 0 };
}
} // Constants
} // Designer

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -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;

View File

@@ -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)) {

View File

@@ -41,29 +41,20 @@
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
bool save(const QString &fileName = QString());
@@ -97,7 +88,6 @@ private:
QString m_suggestedName;
QDesignerFormWindowInterface *m_formWindow;
Core::ICore *m_core;
};
} // namespace Internal

View File

@@ -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");

View File

@@ -39,8 +39,6 @@
#include <QtCore/QFile>
#include <QtCore/QDebug>
enum { debugFormWizard = 0 };
using namespace Designer;
using namespace Designer::Internal;

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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>

View File

@@ -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));
}

View File

@@ -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;

View File

@@ -74,9 +74,8 @@ protected:
Shows a file system folder
*/
FolderNavigationWidget::FolderNavigationWidget(Core::ICore *core, QWidget *parent)
FolderNavigationWidget::FolderNavigationWidget(QWidget *parent)
: QWidget(parent),
m_core(core),
m_explorer(ProjectExplorerPlugin::instance()),
m_view(new QListView(this)),
m_dirModel(new QDirModel(this)),
@@ -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");

View File

@@ -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

View File

@@ -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;

View File

@@ -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 *);

View File

@@ -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();

View File

@@ -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());
}

View File

@@ -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

View File

@@ -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)
SessionManager::SessionManager(QObject *parent)
: QObject(parent),
m_core(core),
m_file(new SessionFile(core)),
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,11 +393,10 @@ 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;

View File

@@ -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

View File

@@ -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)),

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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)
{
}

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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;