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

Conflicts:
	src/plugins/coreplugin/editormanager/editormanager.cpp
This commit is contained in:
mae
2009-01-28 17:03:52 +01:00
63 changed files with 1446 additions and 991 deletions

View File

@@ -109,7 +109,7 @@ int qtGhVersion = QT_VERSION;
'P(d, name, value)' roughly expands to: 'P(d, name, value)' roughly expands to:
d << (name) << "='" << value << "'"; d << (name) << "=\"" << value << "\"";
Useful (i.e. understood by the IDE) names include: Useful (i.e. understood by the IDE) names include:
@@ -311,7 +311,7 @@ static bool isSimpleType(const char *type)
static bool isShortKey(const char *type) static bool isShortKey(const char *type)
{ {
return isSimpleType(type) || isEqual(type, "QString"); return isSimpleType(type) || isEqual(type, NS"QString");
} }
static bool isMovableType(const char *type) static bool isMovableType(const char *type)
@@ -551,11 +551,11 @@ void QDumper::addCommaIfNeeded()
if (pos == 0) if (pos == 0)
return; return;
char c = qDumpOutBuffer[pos - 1]; char c = qDumpOutBuffer[pos - 1];
if (c == '}' || c == '\'' || c == ']') if (c == '}' || c == '"' || c == ']')
put(','); put(',');
} }
void QDumper::putBase64Encoded(const char *buf, int n) void QDumper::putBase64Encoded(const char *buf, int n, char delim)
{ {
const char alphabet[] = "ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef" const char alphabet[] = "ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef"
"ghijklmn" "opqrstuv" "wxyz0123" "456789+/"; "ghijklmn" "opqrstuv" "wxyz0123" "456789+/";
@@ -630,7 +630,7 @@ void QDumper::endHash()
void QDumper::putEllipsis() void QDumper::putEllipsis()
{ {
addCommaIfNeeded(); addCommaIfNeeded();
*this << "{name='<incomplete>',value='',type='" << innertype << "'}"; *this << "{name=\"<incomplete>\",value=\"\",type=\"" << innertype << "\"}";
} }
// //
@@ -642,7 +642,7 @@ void QDumper::putEllipsis()
#define P(dumper,name,value) \ #define P(dumper,name,value) \
do { \ do { \
dumper.addCommaIfNeeded(); \ dumper.addCommaIfNeeded(); \
dumper << (name) << "='" << value << "'"; \ dumper << (name) << "=\"" << value << "\""; \
} while (0) } while (0)
// simple string property // simple string property
@@ -704,44 +704,44 @@ static void qDumpUnknown(QDumper &d)
} }
static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr, static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr,
const char *key = "value") const char *field = "value")
{ {
type = stripNamespace(type); type = stripNamespace(type);
switch (type[1]) { switch (type[1]) {
case 'l': case 'l':
if (isEqual(type, "float")) if (isEqual(type, "float"))
P(d, key, *(float*)addr); P(d, field, *(float*)addr);
return; return;
case 'n': case 'n':
if (isEqual(type, "int")) if (isEqual(type, "int"))
P(d, key, *(int*)addr); P(d, field, *(int*)addr);
else if (isEqual(type, "unsigned")) else if (isEqual(type, "unsigned"))
P(d, key, *(unsigned int*)addr); P(d, field, *(unsigned int*)addr);
else if (isEqual(type, "unsigned int")) else if (isEqual(type, "unsigned int"))
P(d, key, *(unsigned int*)addr); P(d, field, *(unsigned int*)addr);
else if (isEqual(type, "unsigned long")) else if (isEqual(type, "unsigned long"))
P(d, key, *(unsigned long*)addr); P(d, field, *(unsigned long*)addr);
else if (isEqual(type, "unsigned long long")) else if (isEqual(type, "unsigned long long"))
P(d, key, *(qulonglong*)addr); P(d, field, *(qulonglong*)addr);
return; return;
case 'o': case 'o':
if (isEqual(type, "bool")) if (isEqual(type, "bool"))
switch (*(bool*)addr) { switch (*(bool*)addr) {
case 0: P(d, key, "false"); break; case 0: P(d, field, "false"); break;
case 1: P(d, key, "true"); break; case 1: P(d, field, "true"); break;
default: P(d, key, *(bool*)addr); break; default: P(d, field, *(bool*)addr); break;
} }
else if (isEqual(type, "double")) else if (isEqual(type, "double"))
P(d, key, *(double*)addr); P(d, field, *(double*)addr);
else if (isEqual(type, "long")) else if (isEqual(type, "long"))
P(d, key, *(long*)addr); P(d, field, *(long*)addr);
else if (isEqual(type, "long long")) else if (isEqual(type, "long long"))
P(d, key, *(qulonglong*)addr); P(d, field, *(qulonglong*)addr);
return; return;
case 'B': case 'B':
if (isEqual(type, "QByteArray")) { if (isEqual(type, "QByteArray")) {
d << key << "encoded='1',"; d << field << "encoded=\"1\",";
P(d, key, *(QByteArray*)addr); P(d, field, *(QByteArray*)addr);
} }
return; return;
case 'L': case 'L':
@@ -769,8 +769,8 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr
return; return;
case 'S': case 'S':
if (isEqual(type, "QString")) { if (isEqual(type, "QString")) {
d << key << "encoded='1',"; d << field << "encoded=\"1\",";
P(d, key, *(QString*)addr); P(d, field, *(QString*)addr);
} }
return; return;
default: default:
@@ -839,7 +839,7 @@ static void qDumpQByteArray(QDumper &d)
unsigned char u = (isprint(c) && c != '\'' && c != '"') ? c : '?'; unsigned char u = (isprint(c) && c != '\'' && c != '"') ? c : '?';
sprintf(buf, "%02x (%u '%c')", c, c, u); sprintf(buf, "%02x (%u '%c')", c, c, u);
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "]"); P(d, "name", i);
P(d, "value", buf); P(d, "value", buf);
d.endHash(); d.endHash();
} }
@@ -1104,14 +1104,14 @@ static void qDumpQHash(QDumper &d)
while (node != end) { while (node != end) {
d.beginHash(); d.beginHash();
if (simpleKey) { if (simpleKey) {
P(d, "name", "[" << i << "]"); P(d, "name", i);
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key"); qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
if (simpleValue) if (simpleValue)
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset)); qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
P(d, "type", valueType); P(d, "type", valueType);
P(d, "addr", addOffset(node, valueOffset)); P(d, "addr", addOffset(node, valueOffset));
} else { } else {
P(d, "name", "[" << i << "]"); P(d, "name", i);
//P(d, "exp", "*(char*)" << node); //P(d, "exp", "*(char*)" << node);
P(d, "exp", "*('"NS"QHashNode<" << keyType << "," << valueType << " >'*)" << node); P(d, "exp", "*('"NS"QHashNode<" << keyType << "," << valueType << " >'*)" << node);
P(d, "type", "'"NS"QHashNode<" << keyType << "," << valueType << " >'"); P(d, "type", "'"NS"QHashNode<" << keyType << "," << valueType << " >'");
@@ -1215,7 +1215,7 @@ static void qDumpQList(QDumper &d)
d << ",children=["; d << ",children=[";
for (int i = 0; i != n; ++i) { for (int i = 0; i != n; ++i) {
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "]"); P(d, "name", i);
if (innerTypeIsPointer) { if (innerTypeIsPointer) {
void *p = ldata.d->array + i + pdata->begin; void *p = ldata.d->array + i + pdata->begin;
if (p) { if (p) {
@@ -1275,7 +1275,7 @@ static void qDumpQLinkedList(QDumper &d)
const void *p = deref(ldata); const void *p = deref(ldata);
for (int i = 0; i != n; ++i) { for (int i = 0; i != n; ++i) {
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "]"); P(d, "name", i);
const void *addr = addOffset(p, 2 * sizeof(void*)); const void *addr = addOffset(p, 2 * sizeof(void*));
qDumpInnerValueOrPointer(d, d.innertype, stripped, addr); qDumpInnerValueOrPointer(d, d.innertype, stripped, addr);
p = deref(p); p = deref(p);
@@ -1414,7 +1414,7 @@ static void qDumpQMap(QDumper &d)
while (node != end) { while (node != end) {
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "]"); P(d, "name", i);
if (simpleKey) { if (simpleKey) {
P(d, "type", valueType); P(d, "type", valueType);
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key"); qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
@@ -1660,7 +1660,7 @@ static void qDumpQObjectMethodList(QDumper &d)
const QMetaMethod & method = mo->method(i); const QMetaMethod & method = mo->method(i);
int mt = method.methodType(); int mt = method.methodType();
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "] " << mo->indexOfMethod(method.signature()) P(d, "name", i << " " << mo->indexOfMethod(method.signature())
<< " " << method.signature()); << " " << method.signature());
P(d, "value", (mt == QMetaMethod::Signal ? "<Signal>" : "<Slot>") << " (" << mt << ")"); P(d, "value", (mt == QMetaMethod::Signal ? "<Signal>" : "<Slot>") << " (" << mt << ")");
d.endHash(); d.endHash();
@@ -1712,11 +1712,11 @@ static void qDumpQObjectSignal(QDumper &d)
for (int i = 0; i != connList.size(); ++i) { for (int i = 0; i != connList.size(); ++i) {
const QObjectPrivate::Connection &conn = connList.at(i); const QObjectPrivate::Connection &conn = connList.at(i);
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "] receiver"); P(d, "name", i << " receiver");
qDumpInnerValueHelper(d, NS"QObject *", conn.receiver); qDumpInnerValueHelper(d, NS"QObject *", conn.receiver);
d.endHash(); d.endHash();
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "] slot"); P(d, "name", i << " slot");
P(d, "type", ""); P(d, "type", "");
if (conn.receiver) if (conn.receiver)
P(d, "value", conn.receiver->metaObject()->method(conn.method).signature()); P(d, "value", conn.receiver->metaObject()->method(conn.method).signature());
@@ -1725,7 +1725,7 @@ static void qDumpQObjectSignal(QDumper &d)
P(d, "numchild", "0"); P(d, "numchild", "0");
d.endHash(); d.endHash();
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "] type"); P(d, "name", i << " type");
P(d, "type", ""); P(d, "type", "");
P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>"); P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>");
P(d, "numchild", "0"); P(d, "numchild", "0");
@@ -1756,7 +1756,7 @@ static void qDumpQObjectSignalList(QDumper &d)
int k = mo->indexOfSignal(method.signature()); int k = mo->indexOfSignal(method.signature());
const QObjectPrivate::ConnectionList &connList = qConnectionList(ob, k); const QObjectPrivate::ConnectionList &connList = qConnectionList(ob, k);
d.beginHash(); d.beginHash();
P(d, "name", "[" << k << "]"); P(d, "name", k);
P(d, "value", method.signature()); P(d, "value", method.signature());
P(d, "numchild", connList.size()); P(d, "numchild", connList.size());
//P(d, "numchild", "1"); //P(d, "numchild", "1");
@@ -1796,17 +1796,17 @@ static void qDumpQObjectSlot(QDumper &d)
const QMetaMethod & method = const QMetaMethod & method =
sender.sender->metaObject()->method(sender.signal); sender.sender->metaObject()->method(sender.signal);
d.beginHash(); d.beginHash();
P(d, "name", "[" << s << "] sender"); P(d, "name", s << " sender");
qDumpInnerValueHelper(d, NS"QObject *", sender.sender); qDumpInnerValueHelper(d, NS"QObject *", sender.sender);
d.endHash(); d.endHash();
d.beginHash(); d.beginHash();
P(d, "name", "[" << s << "] signal"); P(d, "name", s << " signal");
P(d, "type", ""); P(d, "type", "");
P(d, "value", method.signature()); P(d, "value", method.signature());
P(d, "numchild", "0"); P(d, "numchild", "0");
d.endHash(); d.endHash();
d.beginHash(); d.beginHash();
P(d, "name", "[" << s << "] type"); P(d, "name", s << " type");
P(d, "type", ""); P(d, "type", "");
P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>"); P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>");
P(d, "numchild", "0"); P(d, "numchild", "0");
@@ -1843,7 +1843,7 @@ static void qDumpQObjectSlotList(QDumper &d)
if (method.methodType() == QMetaMethod::Slot) { if (method.methodType() == QMetaMethod::Slot) {
d.beginHash(); d.beginHash();
int k = mo->indexOfSlot(method.signature()); int k = mo->indexOfSlot(method.signature());
P(d, "name", "[" << k << "]"); P(d, "name", k);
P(d, "value", method.signature()); P(d, "value", method.signature());
// count senders. expensive... // count senders. expensive...
@@ -1911,7 +1911,7 @@ static void qDumpQSet(QDumper &d)
for (int bucket = 0; bucket != hd->numBuckets && i <= 10000; ++bucket) { for (int bucket = 0; bucket != hd->numBuckets && i <= 10000; ++bucket) {
for (node = hd->buckets[bucket]; node->next; node = node->next) { for (node = hd->buckets[bucket]; node->next; node = node->next) {
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "]"); P(d, "name", i);
P(d, "type", d.innertype); P(d, "type", d.innertype);
P(d, "exp", "(('"NS"QHashNode<" << d.innertype P(d, "exp", "(('"NS"QHashNode<" << d.innertype
<< ","NS"QHashDummyValue>'*)" << ","NS"QHashDummyValue>'*)"
@@ -1970,7 +1970,7 @@ static void qDumpQStringList(QDumper &d)
d << ",children=["; d << ",children=[";
for (int i = 0; i != n; ++i) { for (int i = 0; i != n; ++i) {
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "]"); P(d, "name", i);
P(d, "value", list[i]); P(d, "value", list[i]);
P(d, "valueencoded", "1"); P(d, "valueencoded", "1");
d.endHash(); d.endHash();
@@ -2008,7 +2008,7 @@ static void qDumpQVariantHelper(const void *data, QString *value,
*numchild = 0; *numchild = 0;
break; break;
case QVariant::String: case QVariant::String:
*value = QLatin1Char('\'') + v.toString() + QLatin1Char('\''); *value = QLatin1Char('"') + v.toString() + QLatin1Char('"');
*numchild = 0; *numchild = 0;
break; break;
case QVariant::StringList: case QVariant::StringList:
@@ -2108,7 +2108,7 @@ static void qDumpQVector(QDumper &d)
d << ",children=["; d << ",children=[";
for (int i = 0; i != n; ++i) { for (int i = 0; i != n; ++i) {
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "]"); P(d, "name", i);
qDumpInnerValueOrPointer(d, d.innertype, stripped, qDumpInnerValueOrPointer(d, d.innertype, stripped,
addOffset(v, i * innersize + typeddatasize)); addOffset(v, i * innersize + typeddatasize));
d.endHash(); d.endHash();
@@ -2156,7 +2156,7 @@ static void qDumpStdList(QDumper &d)
it = list.begin(); it = list.begin();
for (int i = 0; i < 1000 && it != list.end(); ++i, ++it) { for (int i = 0; i < 1000 && it != list.end(); ++i, ++it) {
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "]"); P(d, "name", i);
qDumpInnerValueOrPointer(d, d.innertype, stripped, it.operator->()); qDumpInnerValueOrPointer(d, d.innertype, stripped, it.operator->());
d.endHash(); d.endHash();
} }
@@ -2218,7 +2218,7 @@ static void qDumpStdMap(QDumper &d)
d.endHash(); d.endHash();
} else { } else {
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "]"); P(d, "name", i);
P(d, "addr", it.operator->()); P(d, "addr", it.operator->());
P(d, "type", pairType); P(d, "type", pairType);
d.endHash(); d.endHash();
@@ -2240,9 +2240,9 @@ static void qDumpStdString(QDumper &d)
qCheckAccess(str.c_str() + str.size() - 1); qCheckAccess(str.c_str() + str.size() - 1);
} }
d << ",value='"; d << ",value=\"";
d.putBase64Encoded(str.c_str(), str.size()); d.putBase64Encoded(str.c_str(), str.size());
d << "'"; d << "\"";
P(d, "valueencoded", "1"); P(d, "valueencoded", "1");
P(d, "type", "std::string"); P(d, "type", "std::string");
P(d, "numchild", "0"); P(d, "numchild", "0");
@@ -2305,7 +2305,7 @@ static void qDumpStdVector(QDumper &d)
d << ",children=["; d << ",children=[";
for (int i = 0; i != n; ++i) { for (int i = 0; i != n; ++i) {
d.beginHash(); d.beginHash();
P(d, "name", "[" << i << "]"); P(d, "name", i);
qDumpInnerValueOrPointer(d, d.innertype, stripped, qDumpInnerValueOrPointer(d, d.innertype, stripped,
addOffset(v->start, i * innersize)); addOffset(v->start, i * innersize));
d.endHash(); d.endHash();
@@ -2482,54 +2482,54 @@ void qDumpObjectData440(
// They are mentioned here nevertheless. For types that not listed // They are mentioned here nevertheless. For types that not listed
// here, dumpers won't be used. // here, dumpers won't be used.
d << "dumpers=[" d << "dumpers=["
"'"NS"QByteArray'," "\""NS"QByteArray\","
"'"NS"QDateTime'," "\""NS"QDateTime\","
"'"NS"QDir'," "\""NS"QDir\","
"'"NS"QFile'," "\""NS"QFile\","
"'"NS"QFileInfo'," "\""NS"QFileInfo\","
"'"NS"QHash'," "\""NS"QHash\","
"'"NS"QHashNode'," "\""NS"QHashNode\","
"'"NS"QImage'," "\""NS"QImage\","
"'"NS"QLinkedList'," "\""NS"QLinkedList\","
"'"NS"QList'," "\""NS"QList\","
"'"NS"QLocale'," "\""NS"QLocale\","
"'"NS"QMap'," "\""NS"QMap\","
"'"NS"QMapNode'," "\""NS"QMapNode\","
"'"NS"QModelIndex'," "\""NS"QModelIndex\","
#if QT_VERSION >= 0x040500 #if QT_VERSION >= 0x040500
"'"NS"QMultiMap'," "\""NS"QMultiMap\","
#endif #endif
"'"NS"QObject'," "\""NS"QObject\","
"'"NS"QObjectMethodList'," // hack to get nested properties display "\""NS"QObjectMethodList\"," // hack to get nested properties display
"'"NS"QObjectPropertyList'," "\""NS"QObjectPropertyList\","
#if PRIVATE_OBJECT_ALLOWED #if PRIVATE_OBJECT_ALLOWED
"'"NS"QObjectSignal'," "\""NS"QObjectSignal\","
"'"NS"QObjectSignalList'," "\""NS"QObjectSignalList\","
"'"NS"QObjectSlot'," "\""NS"QObjectSlot\","
"'"NS"QObjectSlotList'," "\""NS"QObjectSlotList\","
#endif // PRIVATE_OBJECT_ALLOWED #endif // PRIVATE_OBJECT_ALLOWED
// << "'"NS"QRegion'," // << "\""NS"QRegion\","
"'"NS"QSet'," "\""NS"QSet\","
"'"NS"QString'," "\""NS"QString\","
"'"NS"QStringList'," "\""NS"QStringList\","
"'"NS"QTextCodec'," "\""NS"QTextCodec\","
"'"NS"QVariant'," "\""NS"QVariant\","
"'"NS"QVector'," "\""NS"QVector\","
"'"NS"QWidget'," "\""NS"QWidget\","
"'string'," "\"string\","
"'wstring'," "\"wstring\","
"'std::basic_string'," "\"std::basic_string\","
"'std::list'," "\"std::list\","
"'std::map'," "\"std::map\","
"'std::string'," "\"std::string\","
"'std::vector'," "\"std::vector\","
"'std::wstring'," "\"std::wstring\","
"]"; "]";
d << ",qtversion=[" d << ",qtversion=["
"'" << ((QT_VERSION >> 16) & 255) << "'," "\"" << ((QT_VERSION >> 16) & 255) << "\","
"'" << ((QT_VERSION >> 8) & 255) << "'," "\"" << ((QT_VERSION >> 8) & 255) << "\","
"'" << ((QT_VERSION) & 255) << "']"; "\"" << ((QT_VERSION) & 255) << "\"]";
d << ",namespace='"NS"'"; d << ",namespace=\""NS"\"";
d.disarm(); d.disarm();
} }

View File

@@ -17,7 +17,7 @@ macx {
QMAKE_INFO_PLIST = $$PWD/qtcreator/Info.plist QMAKE_INFO_PLIST = $$PWD/qtcreator/Info.plist
} }
win32 { win32|linux-* {
# make sure the resources are in place # make sure the resources are in place
!exists($$OUT_PWD/app.pro) { !exists($$OUT_PWD/app.pro) {
unix:SEPARATOR = ; unix:SEPARATOR = ;
@@ -28,10 +28,11 @@ win32 {
designer \ designer \
schemes \ schemes \
gdbmacros gdbmacros
COPYDEST = $${OUT_PWD}/../../bin COPYDEST = $${OUT_PWD}/../../share/qtcreator
win32:COPYDEST ~= s|/+|\| win32:COPYDEST ~= s|/+|\|
QMAKE_POST_LINK += $${QMAKE_MKDIR} $$COPYDEST $$SEPARATOR
for(tmp,COPYSRC) { for(tmp,COPYSRC) {
REALSRC = $$PWD/$$tmp REALSRC = $$PWD/qtcreator/$$tmp
REALDEST = $$COPYDEST/$$tmp REALDEST = $$COPYDEST/$$tmp
win32:tmp ~= s|/+|\| win32:tmp ~= s|/+|\|
win32:REALSRC ~= s|/+|\| win32:REALSRC ~= s|/+|\|

View File

@@ -51,10 +51,9 @@
using namespace Core; using namespace Core;
using namespace Core::Internal; using namespace Core::Internal;
EditorSplitter::EditorSplitter(ICore *core, QWidget *parent) EditorSplitter::EditorSplitter(QWidget *parent)
: QWidget(parent), : QWidget(parent),
m_curGroup(0), m_curGroup(0)
m_core(core)
{ {
registerActions(); registerActions();
createRootGroup(); createRootGroup();
@@ -69,9 +68,9 @@ void EditorSplitter::registerActions()
{ {
QList<int> gc = QList<int>() << Constants::C_GLOBAL_ID; QList<int> gc = QList<int>() << Constants::C_GLOBAL_ID;
const QList<int> editorManagerContext = const QList<int> editorManagerContext =
QList<int>() << m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_EDITORMANAGER); QList<int>() << ICore::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_EDITORMANAGER);
ActionManager *am = m_core->actionManager(); ActionManager *am = ICore::instance()->actionManager();
ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW);
Command *cmd; Command *cmd;
@@ -541,13 +540,13 @@ QWidget *EditorSplitter::recreateGroupTree(QWidget *node)
void EditorSplitter::saveCurrentLayout() void EditorSplitter::saveCurrentLayout()
{ {
QSettings *settings = m_core->settings(); QSettings *settings = ICore::instance()->settings();
settings->setValue("EditorManager/Splitting", saveState()); settings->setValue("EditorManager/Splitting", saveState());
} }
void EditorSplitter::restoreDefaultLayout() void EditorSplitter::restoreDefaultLayout()
{ {
QSettings *settings = m_core->settings(); QSettings *settings = ICore::instance()->settings();
if (settings->contains("EditorManager/Splitting")) if (settings->contains("EditorManager/Splitting"))
restoreState(settings->value("EditorManager/Splitting").toByteArray()); restoreState(settings->value("EditorManager/Splitting").toByteArray());
} }
@@ -659,12 +658,12 @@ EditorGroup *EditorSplitter::createGroup()
this, SLOT(updateActions())); this, SLOT(updateActions()));
connect(group, SIGNAL(editorAdded(Core::IEditor *)), connect(group, SIGNAL(editorAdded(Core::IEditor *)),
this, SLOT(updateActions())); this, SLOT(updateActions()));
m_core->addContextObject(group->contextObject()); ICore::instance()->addContextObject(group->contextObject());
return group; return group;
} }
void EditorSplitter::deleteGroup(EditorGroup *group) void EditorSplitter::deleteGroup(EditorGroup *group)
{ {
m_core->removeContextObject(group->contextObject()); ICore::instance()->removeContextObject(group->contextObject());
delete group; delete group;
} }

View File

@@ -45,7 +45,6 @@
namespace Core { namespace Core {
class EditorGroup; class EditorGroup;
class ICore;
class IEditor; class IEditor;
namespace Internal { namespace Internal {
@@ -55,7 +54,7 @@ class EditorSplitter : public QWidget
Q_OBJECT Q_OBJECT
public: public:
EditorSplitter(ICore *core, QWidget *parent = 0); explicit EditorSplitter(QWidget *parent = 0);
~EditorSplitter(); ~EditorSplitter();
void setCurrentGroup(Core::EditorGroup *group); void setCurrentGroup(Core::EditorGroup *group);
@@ -114,7 +113,6 @@ private:
QWidget *m_root; QWidget *m_root;
EditorGroup *m_curGroup; EditorGroup *m_curGroup;
ICore *m_core;
QAction *m_horizontalSplitAction; QAction *m_horizontalSplitAction;
QAction *m_verticalSplitAction; QAction *m_verticalSplitAction;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 B

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 407 B

After

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 B

After

Width:  |  Height:  |  Size: 518 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 436 B

View File

@@ -120,7 +120,7 @@ MainWindow::MainWindow() :
m_editorManager(0), m_editorManager(0),
m_fileManager(new FileManager(this)), m_fileManager(new FileManager(this)),
m_progressManager(new ProgressManagerPrivate()), m_progressManager(new ProgressManagerPrivate()),
m_scriptManager(new ScriptManagerPrivate(this, m_coreImpl)), m_scriptManager(new ScriptManagerPrivate(this)),
m_variableManager(new VariableManager(this)), m_variableManager(new VariableManager(this)),
m_vcsManager(new VCSManager()), m_vcsManager(new VCSManager()),
m_viewManager(0), m_viewManager(0),

View File

@@ -518,7 +518,8 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
painter->drawLine(rect.bottomLeft(), rect.bottomRight()); painter->drawLine(rect.bottomLeft(), rect.bottomRight());
} }
#ifndef Q_WS_MAC #ifndef Q_WS_MAC
else if (option->state & State_MouseOver) { else if (option->state & State_Enabled &&
option->state & State_MouseOver) {
QColor lighter(255, 255, 255, 35); QColor lighter(255, 255, 255, 35);
painter->fillRect(rect, lighter); painter->fillRect(rect, lighter);
painter->drawLine(rect.topRight(), rect.bottomRight()); painter->drawLine(rect.topRight(), rect.bottomRight());

View File

@@ -519,7 +519,7 @@ void OutputPaneToggleButton::paintEvent(QPaintEvent *event)
QPushButton::paintEvent(event); QPushButton::paintEvent(event);
const QFontMetrics fm = fontMetrics(); const QFontMetrics fm = fontMetrics();
const int baseLine = (height() - fm.height()) / 2 + fm.ascent(); const int baseLine = (height() - fm.height() + 1) / 2 + fm.ascent();
const int numberWidth = fm.width(m_number); const int numberWidth = fm.width(m_number);
QPainter p(this); QPainter p(this);

View File

@@ -99,6 +99,7 @@ void ProgressView::deleteTask(FutureProgress *progress)
m_type.remove(progress); m_type.remove(progress);
m_keep.remove(progress); m_keep.remove(progress);
layout()->removeWidget(progress); layout()->removeWidget(progress);
progress->hide();
progress->deleteLater(); progress->deleteLater();
} }

View File

@@ -181,10 +181,8 @@ static QScriptValue fileBox(QScriptContext *context, QScriptEngine *engine)
namespace Core { namespace Core {
namespace Internal { namespace Internal {
ScriptManagerPrivate::ScriptManagerPrivate(QObject *parent, ICore *core) : ScriptManagerPrivate::ScriptManagerPrivate(QObject *parent)
ScriptManager(parent), : ScriptManager(parent), m_initialized(false)
m_core(core),
m_initialized(false)
{ {
} }
@@ -250,7 +248,6 @@ void ScriptManagerPrivate::ensureEngineInitialized()
{ {
if (m_initialized) if (m_initialized)
return; return;
QTC_ASSERT(m_core, return);
// register QObjects that occur as properties // register QObjects that occur as properties
SharedTools::registerQObject<QMainWindow>(m_engine); SharedTools::registerQObject<QMainWindow>(m_engine);
SharedTools::registerQObject<QStatusBar>(m_engine); SharedTools::registerQObject<QStatusBar>(m_engine);
@@ -274,7 +271,7 @@ void ScriptManagerPrivate::ensureEngineInitialized()
// SharedTools::registerQObjectInterface<Core::ICore, CorePrototype>(m_engine); // SharedTools::registerQObjectInterface<Core::ICore, CorePrototype>(m_engine);
// Make "core" available // Make "core" available
m_engine.globalObject().setProperty(QLatin1String("core"), qScriptValueFromValue(&m_engine, m_core)); m_engine.globalObject().setProperty(QLatin1String("core"), qScriptValueFromValue(&m_engine, Core::ICore::instance()));
// CLASSIC: registerInterfaceWithDefaultPrototype<Core::MessageManager, MessageManagerPrototype>(m_engine); // CLASSIC: registerInterfaceWithDefaultPrototype<Core::MessageManager, MessageManagerPrototype>(m_engine);

View File

@@ -37,13 +37,9 @@
#include <coreplugin/scriptmanager/scriptmanager.h> #include <coreplugin/scriptmanager/scriptmanager.h>
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QList>
#include <QtScript/QScriptEngine> #include <QtScript/QScriptEngine>
namespace Core { namespace Core {
class ICore;
namespace Internal { namespace Internal {
class ScriptManagerPrivate : public Core::ScriptManager class ScriptManagerPrivate : public Core::ScriptManager
@@ -51,12 +47,11 @@ class ScriptManagerPrivate : public Core::ScriptManager
Q_OBJECT Q_OBJECT
public: public:
ScriptManagerPrivate(QObject *parent, ICore *core); explicit ScriptManagerPrivate(QObject *parent);
virtual QScriptEngine &scriptEngine(); QScriptEngine &scriptEngine();
bool runScript(const QString &script, QString *errorMessage, Stack *stack);
virtual bool runScript(const QString &script, QString *errorMessage, Stack *stack); bool runScript(const QString &script, QString *errorMessage);
virtual bool runScript(const QString &script, QString *errorMessage);
static QString engineError(QScriptEngine &scriptEngine); static QString engineError(QScriptEngine &scriptEngine);
@@ -64,7 +59,6 @@ private:
void ensureEngineInitialized(); void ensureEngineInitialized();
QScriptEngine m_engine; QScriptEngine m_engine;
ICore *m_core;
bool m_initialized; bool m_initialized;
}; };

View File

@@ -133,5 +133,6 @@
<glob pattern="*.cxx"/> <glob pattern="*.cxx"/>
<glob pattern="*.c++"/> <glob pattern="*.c++"/>
<glob pattern="*.C"/> <glob pattern="*.C"/>
<glob pattern="*.inl"/>
</mime-type> </mime-type>
</mime-info> </mime-info>

View File

@@ -15,33 +15,42 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QCheckBox" name="caseSensitive"> <widget class="QGroupBox" name="groupBox">
<property name="text"> <property name="title">
<string>&amp;Case-sensitive completion</string> <string>Completion Settings</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="autoInsertBraces">
<property name="text">
<string>&amp;Automatically insert braces</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="partiallyComplete">
<property name="text">
<string>Autocomplete common &amp;prefix</string>
</property>
<property name="checked">
<bool>true</bool>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="caseSensitive">
<property name="text">
<string>&amp;Case-sensitive completion</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="autoInsertBraces">
<property name="text">
<string>&amp;Automatically insert braces</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="partiallyComplete">
<property name="text">
<string>Autocomplete common &amp;prefix</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>

View File

@@ -74,9 +74,10 @@ using namespace CPlusPlus;
namespace CppTools { namespace CppTools {
namespace Internal { namespace Internal {
class FunctionArgumentWidget : public QLabel { class FunctionArgumentWidget : public QLabel
{
public: public:
FunctionArgumentWidget(Core::ICore *core); FunctionArgumentWidget();
void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot); void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot);
protected: protected:
@@ -183,10 +184,10 @@ protected:
using namespace CppTools::Internal; using namespace CppTools::Internal;
FunctionArgumentWidget::FunctionArgumentWidget(Core::ICore *core) FunctionArgumentWidget::FunctionArgumentWidget()
: m_item(0) : m_item(0)
{ {
QObject *editorObject = core->editorManager()->currentEditor(); QObject *editorObject = Core::ICore::instance()->editorManager()->currentEditor();
m_editor = qobject_cast<TextEditor::ITextEditor *>(editorObject); m_editor = qobject_cast<TextEditor::ITextEditor *>(editorObject);
m_popupFrame = new QFrame(0, Qt::ToolTip|Qt::WindowStaysOnTopHint); m_popupFrame = new QFrame(0, Qt::ToolTip|Qt::WindowStaysOnTopHint);
@@ -311,9 +312,8 @@ void FunctionArgumentWidget::updateHintText()
setText(text); setText(text);
} }
CppCodeCompletion::CppCodeCompletion(CppModelManager *manager, Core::ICore *core) CppCodeCompletion::CppCodeCompletion(CppModelManager *manager)
: ICompletionCollector(manager), : ICompletionCollector(manager),
m_core(core),
m_manager(manager), m_manager(manager),
m_caseSensitivity(Qt::CaseSensitive), m_caseSensitivity(Qt::CaseSensitive),
m_autoInsertBraces(true), m_autoInsertBraces(true),
@@ -1030,7 +1030,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
Function *function = symbol->type()->asFunction(); Function *function = symbol->type()->asFunction();
QTC_ASSERT(function, return); QTC_ASSERT(function, return);
m_functionArgumentWidget = new FunctionArgumentWidget(m_core); m_functionArgumentWidget = new FunctionArgumentWidget();
m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot()); m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot());
} }
} else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) { } else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) {

View File

@@ -34,23 +34,17 @@
#ifndef CPPCODECOMPLETION_H #ifndef CPPCODECOMPLETION_H
#define CPPCODECOMPLETION_H #define CPPCODECOMPLETION_H
// C++ front-end
#include <ASTfwd.h> #include <ASTfwd.h>
#include <FullySpecifiedType.h> #include <FullySpecifiedType.h>
#include <cplusplus/Icons.h> #include <cplusplus/Icons.h>
#include <cplusplus/Overview.h> #include <cplusplus/Overview.h>
#include <cplusplus/TypeOfExpression.h> #include <cplusplus/TypeOfExpression.h>
// Qt Creator
#include <texteditor/icompletioncollector.h> #include <texteditor/icompletioncollector.h>
// Qt
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QPointer> #include <QtCore/QPointer>
namespace Core {
class ICore;
}
namespace TextEditor { namespace TextEditor {
class ITextEditor; class ITextEditor;
@@ -66,7 +60,7 @@ class CppCodeCompletion : public TextEditor::ICompletionCollector
{ {
Q_OBJECT Q_OBJECT
public: public:
CppCodeCompletion(CppModelManager *manager, Core::ICore *core); explicit CppCodeCompletion(CppModelManager *manager);
bool triggersCompletion(TextEditor::ITextEditable *editor); bool triggersCompletion(TextEditor::ITextEditable *editor);
int startCompletion(TextEditor::ITextEditable *editor); int startCompletion(TextEditor::ITextEditable *editor);
@@ -131,7 +125,6 @@ private:
TextEditor::ITextEditable *m_editor; TextEditor::ITextEditable *m_editor;
int m_startPosition; // Position of the cursor from which completion started int m_startPosition; // Position of the cursor from which completion started
Core::ICore *m_core;
CppModelManager *m_manager; CppModelManager *m_manager;
Qt::CaseSensitivity m_caseSensitivity; Qt::CaseSensitivity m_caseSensitivity;
bool m_autoInsertBraces; bool m_autoInsertBraces;

View File

@@ -87,7 +87,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
// Objects // Objects
m_modelManager = new CppModelManager(this); m_modelManager = new CppModelManager(this);
addAutoReleasedObject(m_modelManager); addAutoReleasedObject(m_modelManager);
m_completion = new CppCodeCompletion(m_modelManager, core); m_completion = new CppCodeCompletion(m_modelManager);
addAutoReleasedObject(m_completion); addAutoReleasedObject(m_completion);
CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager, CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager,
core->editorManager()); core->editorManager());

View File

@@ -888,7 +888,9 @@ void DebuggerManager::executeDebuggerCommand(const QString &command)
void DebuggerManager::sessionLoaded() void DebuggerManager::sessionLoaded()
{ {
exitDebugger(); cleanupViews();
setStatus(DebuggerProcessNotReady);
setBusyCursor(false);
loadSessionData(); loadSessionData();
} }
@@ -1092,6 +1094,28 @@ bool DebuggerManager::useFastStart() const
return 0; // && m_settings.m_useFastStart; return 0; // && m_settings.m_useFastStart;
} }
void DebuggerManager::setUseCustomDumpers(bool on)
{
m_settings.m_useCustomDumpers = on;
engine()->setUseCustomDumpers(on);
}
void DebuggerManager::setUseFastStart(bool on)
{
m_settings.m_useFastStart = on;
}
void DebuggerManager::setDebugDumpers(bool on)
{
m_settings.m_debugDumpers = on;
engine()->setDebugDumpers(on);
}
void DebuggerManager::setSkipKnownFrames(bool on)
{
m_settings.m_skipKnownFrames = on;
}
void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber, void DebuggerManager::queryCurrentTextEditor(QString *fileName, int *lineNumber,
QObject **object) QObject **object)
{ {

View File

@@ -167,8 +167,6 @@ private:
virtual WatchHandler *watchHandler() = 0; virtual WatchHandler *watchHandler() = 0;
virtual void showApplicationOutput(const QString &data) = 0; virtual void showApplicationOutput(const QString &data) = 0;
//virtual QAction *useCustomDumpersAction() const = 0;
//virtual QAction *debugDumpersAction() const = 0;
virtual bool skipKnownFrames() const = 0; virtual bool skipKnownFrames() const = 0;
virtual bool debugDumpers() const = 0; virtual bool debugDumpers() const = 0;
virtual bool useCustomDumpers() const = 0; virtual bool useCustomDumpers() const = 0;
@@ -283,6 +281,11 @@ public slots:
void showStatusMessage(const QString &msg, int timeout = -1); // -1 forever void showStatusMessage(const QString &msg, int timeout = -1); // -1 forever
void setUseCustomDumpers(bool on);
void setDebugDumpers(bool on);
void setSkipKnownFrames(bool on);
void setUseFastStart(bool on);
private slots: private slots:
void showDebuggerOutput(const QString &prefix, const QString &msg); void showDebuggerOutput(const QString &prefix, const QString &msg);
void showDebuggerInput(const QString &prefix, const QString &msg); void showDebuggerInput(const QString &prefix, const QString &msg);
@@ -312,9 +315,7 @@ private:
StackHandler *stackHandler() { return m_stackHandler; } StackHandler *stackHandler() { return m_stackHandler; }
ThreadsHandler *threadsHandler() { return m_threadsHandler; } ThreadsHandler *threadsHandler() { return m_threadsHandler; }
WatchHandler *watchHandler() { return m_watchHandler; } WatchHandler *watchHandler() { return m_watchHandler; }
//QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; }
//QAction *useToolTipsAction() const { return m_useToolTipsAction; }
//QAction *debugDumpersAction() const { return m_debugDumpersAction; }
bool skipKnownFrames() const; bool skipKnownFrames() const;
bool debugDumpers() const; bool debugDumpers() const;
bool useCustomDumpers() const; bool useCustomDumpers() const;

View File

@@ -61,6 +61,7 @@
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h> #include <projectexplorer/session.h>
@@ -85,8 +86,6 @@
#include <QtGui/QTextCursor> #include <QtGui/QTextCursor>
namespace ExtensionSystem { class PluginManager; }
using namespace Core; using namespace Core;
using namespace Debugger::Constants; using namespace Debugger::Constants;
using namespace Debugger::Internal; using namespace Debugger::Internal;
@@ -144,6 +143,11 @@ const char * const ADD_TO_WATCH_KEY = "Ctrl+Alt+Q";
} // namespace Debugger } // namespace Debugger
static ProjectExplorer::SessionManager *sessionManager()
{
return ProjectExplorer::ProjectExplorerPlugin::instance()->session();
}
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// //
// DebugMode // DebugMode
@@ -251,6 +255,7 @@ public:
void finish() {} // automatically calls "apply" void finish() {} // automatically calls "apply"
private: private:
friend class DebuggerPlugin;
Ui::GdbOptionPage m_ui; Ui::GdbOptionPage m_ui;
DebuggerSettings m_settings; DebuggerSettings m_settings;
@@ -300,6 +305,10 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
//m_dumpLogAction = new QAction(this); //m_dumpLogAction = new QAction(this);
//m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes")); //m_dumpLogAction->setText(tr("Dump Log File for Debugging Purposes"));
//
connect(m_ui.checkBoxUseCustomDumpers, SIGNAL(clicked(bool)),
m_plugin->m_manager, SLOT(setUseCustomDumpers(bool)));
return w; return w;
} }
@@ -334,7 +343,6 @@ void GdbOptionPage::apply()
DebuggerPlugin::DebuggerPlugin() DebuggerPlugin::DebuggerPlugin()
{ {
m_pm = 0;
m_generalOptionPage = 0; m_generalOptionPage = 0;
m_locationMark = 0; m_locationMark = 0;
m_manager = 0; m_manager = 0;
@@ -385,8 +393,6 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
m_manager = new DebuggerManager; m_manager = new DebuggerManager;
m_pm = ExtensionSystem::PluginManager::instance();
ICore *core = ICore::instance(); ICore *core = ICore::instance();
QTC_ASSERT(core, return false); QTC_ASSERT(core, return false);
@@ -560,10 +566,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
connect(resetToSimpleAction, SIGNAL(triggered()), connect(resetToSimpleAction, SIGNAL(triggered()),
m_manager, SLOT(setSimpleDockWidgetArrangement())); m_manager, SLOT(setSimpleDockWidgetArrangement()));
// FIXME:
m_generalOptionPage = 0;
// FIXME:
m_generalOptionPage = new GdbOptionPage(this); m_generalOptionPage = new GdbOptionPage(this);
addObject(m_generalOptionPage); addObject(m_generalOptionPage);
@@ -661,9 +664,9 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
// //
// ProjectExplorer // ProjectExplorer
connect(projectExplorer()->session(), SIGNAL(sessionLoaded()), connect(sessionManager(), SIGNAL(sessionLoaded()),
m_manager, SLOT(sessionLoaded())); m_manager, SLOT(sessionLoaded()));
connect(projectExplorer()->session(), SIGNAL(aboutToSaveSession()), connect(sessionManager(), SIGNAL(aboutToSaveSession()),
m_manager, SLOT(aboutToSaveSession())); m_manager, SLOT(aboutToSaveSession()));
// EditorManager // EditorManager
@@ -704,11 +707,6 @@ void DebuggerPlugin::extensionsInitialized()
{ {
} }
ProjectExplorer::ProjectExplorerPlugin *DebuggerPlugin::projectExplorer() const
{
return m_pm->getObject<ProjectExplorer::ProjectExplorerPlugin>();
}
/*! Activates the previous mode when the current mode is the debug mode. */ /*! Activates the previous mode when the current mode is the debug mode. */
void DebuggerPlugin::activatePreviousMode() void DebuggerPlugin::activatePreviousMode()
{ {
@@ -820,17 +818,14 @@ void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
void DebuggerPlugin::setSessionValue(const QString &name, const QVariant &value) void DebuggerPlugin::setSessionValue(const QString &name, const QVariant &value)
{ {
//qDebug() << "SET SESSION VALUE" << name << value; //qDebug() << "SET SESSION VALUE" << name << value;
ProjectExplorerPlugin *pe = projectExplorer(); QTC_ASSERT(sessionManager(), return);
if (pe->session()) sessionManager()->setValue(name, value);
pe->session()->setValue(name, value);
else
qDebug() << "FIXME: Session does not exist yet";
} }
void DebuggerPlugin::querySessionValue(const QString &name, QVariant *value) void DebuggerPlugin::querySessionValue(const QString &name, QVariant *value)
{ {
ProjectExplorerPlugin *pe = projectExplorer(); QTC_ASSERT(sessionManager(), return);
*value = pe->session()->value(name); *value = sessionManager()->value(name);
//qDebug() << "GET SESSION VALUE: " << name << value; //qDebug() << "GET SESSION VALUE: " << name << value;
} }

View File

@@ -34,19 +34,26 @@
#ifndef DEBUGGERPLUGIN_H #ifndef DEBUGGERPLUGIN_H
#define DEBUGGERPLUGIN_H #define DEBUGGERPLUGIN_H
#include <projectexplorer/projectexplorer.h>
#include <extensionsystem/iplugin.h> #include <extensionsystem/iplugin.h>
#include <QtCore/QObject> #include <QtCore/QObject>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAbstractItemView;
class QAction; class QAction;
class QCursor; class QCursor;
class QAbstractItemView; class QMenu;
class QPoint;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core { class IEditor; } namespace Core {
namespace TextEditor { class ITextEditor; } class IEditor;
class IMode;
}
namespace TextEditor {
class ITextEditor;
}
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
@@ -99,12 +106,9 @@ private:
friend class GdbOptionPage; friend class GdbOptionPage;
friend class DebugMode; // FIXME: Just a hack now so that it can access the views friend class DebugMode; // FIXME: Just a hack now so that it can access the views
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;
DebuggerManager *m_manager; DebuggerManager *m_manager;
DebugMode *m_debugMode; DebugMode *m_debugMode;
ExtensionSystem::PluginManager *m_pm;
GdbOptionPage *m_generalOptionPage; GdbOptionPage *m_generalOptionPage;
QString m_previousMode; QString m_previousMode;

View File

@@ -253,6 +253,7 @@ void GdbEngine::init()
m_gdbVersion = 100; m_gdbVersion = 100;
m_shared = 0; m_shared = 0;
m_outputCodec = QTextCodec::codecForLocale(); m_outputCodec = QTextCodec::codecForLocale();
m_dataDumperState = DataDumperUninitialized;
m_oldestAcceptableToken = -1; m_oldestAcceptableToken = -1;
@@ -733,7 +734,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
--m_pendingRequests; --m_pendingRequests;
PENDING_DEBUG(" TYPE " << cmd.type << " DECREMENTS PENDING TO: " PENDING_DEBUG(" TYPE " << cmd.type << " DECREMENTS PENDING TO: "
<< m_pendingRequests << cmd.command); << m_pendingRequests << cmd.command);
if (m_pendingRequests == 0) if (m_pendingRequests <= 0)
updateWatchModel2(); updateWatchModel2();
} else { } else {
PENDING_DEBUG(" UNKNOWN TYPE " << cmd.type << " LEAVES PENDING AT: " PENDING_DEBUG(" UNKNOWN TYPE " << cmd.type << " LEAVES PENDING AT: "
@@ -1760,14 +1761,6 @@ void GdbEngine::setDebugDumpers(bool on)
} }
} }
//QByteArray GdbEngine::dumperChannel() const
//{
// return m_dumperServer->serverName().toLatin1();
// //QByteArray ba;
// //ba.setNum(m_dumperServer->serverPort());
// //return ba;
//}
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// //
@@ -2768,14 +2761,17 @@ static void setWatchDataValue(WatchData &data, const GdbMi &mi,
break; break;
case 1: // base64 encoded 8 bit data case 1: // base64 encoded 8 bit data
ba = QByteArray::fromBase64(mi.data()); ba = QByteArray::fromBase64(mi.data());
ba = '"' + ba + '"';
break; break;
case 2: // base64 encoded 16 bit data case 2: // base64 encoded 16 bit data
ba = QByteArray::fromBase64(mi.data()); ba = QByteArray::fromBase64(mi.data());
ba = QString::fromUtf16((ushort *)ba.data(), ba.size() / 2).toUtf8(); ba = QString::fromUtf16((ushort *)ba.data(), ba.size() / 2).toUtf8();
ba = '"' + ba + '"';
break; break;
case 3: // base64 encoded 32 bit data case 3: // base64 encoded 32 bit data
ba = QByteArray::fromBase64(mi.data()); ba = QByteArray::fromBase64(mi.data());
ba = QString::fromUcs4((uint *)ba.data(), ba.size() / 4).toUtf8(); ba = QString::fromUcs4((uint *)ba.data(), ba.size() / 4).toUtf8();
ba = '"' + ba + '"';
break; break;
} }
data.setValue(ba); data.setValue(ba);
@@ -2889,11 +2885,11 @@ static QString sizeofTypeExpression(const QString &type)
return "sizeof(" + gdbQuoteTypes(type) + ")"; return "sizeof(" + gdbQuoteTypes(type) + ")";
} }
void GdbEngine::setCustomDumpersWanted(bool on) void GdbEngine::setUseCustomDumpers(bool on)
{ {
//qDebug() << "SWITCHING ON/OFF DUMPER DEBUGGING:" << on;
Q_UNUSED(on); Q_UNUSED(on);
// FIXME: a bit too harsh, but otherwise the treeview // FIXME: a bit too harsh, but otherwise the treeview sometimes look funny
// sometimes look funny
//m_expandedINames.clear(); //m_expandedINames.clear();
updateLocals(); updateLocals();
} }
@@ -3060,15 +3056,15 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
//qDebug() << "CMD: " << cmd; //qDebug() << "CMD: " << cmd;
sendSynchronizedCommand(cmd, WatchDumpCustomValue1, QVariant::fromValue(data)); QVariant var;
var.setValue(data);
sendSynchronizedCommand(cmd, WatchDumpCustomValue1, var);
q->showStatusMessage( q->showStatusMessage(
tr("Retrieving data for watch view (%1 requests pending)...") tr("Retrieving data for watch view (%1 requests pending)...")
.arg(m_pendingRequests + 1), 10000); .arg(m_pendingRequests + 1), 10000);
// retrieve response // retrieve response
QVariant var;
var.setValue(data);
sendSynchronizedCommand("p (char*)qDumpOutBuffer", WatchDumpCustomValue2, var); sendSynchronizedCommand("p (char*)qDumpOutBuffer", WatchDumpCustomValue2, var);
} }
@@ -3276,7 +3272,7 @@ void GdbEngine::updateWatchModel2()
return; return;
} }
PENDING_DEBUG("REBUILDING MODEL") PENDING_DEBUG("REBUILDING MODEL");
emit gdbInputAvailable(QString(), emit gdbInputAvailable(QString(),
"[" + currentTime() + "] <Rebuild Watchmodel>"); "[" + currentTime() + "] <Rebuild Watchmodel>");
q->showStatusMessage(tr("Finished retrieving data."), 400); q->showStatusMessage(tr("Finished retrieving data."), 400);
@@ -3307,7 +3303,8 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record)
QByteArray out = output.data(); QByteArray out = output.data();
out = out.mid(out.indexOf('"') + 2); // + 1 is success marker out = out.mid(out.indexOf('"') + 2); // + 1 is success marker
out = out.left(out.lastIndexOf('"')); out = out.left(out.lastIndexOf('"'));
out = out.replace('\'', '"'); //out.replace('\'', '"');
out.replace("\\", "");
out = "dummy={" + out + "}"; out = "dummy={" + out + "}";
//qDebug() << "OUTPUT: " << out; //qDebug() << "OUTPUT: " << out;
@@ -3461,7 +3458,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
} else if (record.resultClass == GdbResultError) { } else if (record.resultClass == GdbResultError) {
// Record an extra result, as the socket result will be lost // Record an extra result, as the socket result will be lost
// in transmission // in transmission
--m_pendingRequests; //--m_pendingRequests;
QString msg = record.data.findChild("msg").data(); QString msg = record.data.findChild("msg").data();
//qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg; //qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg;
#ifdef QT_DEBUG #ifdef QT_DEBUG
@@ -3476,12 +3473,12 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
return; return;
} }
#endif #endif
if (msg.startsWith("The program being debugged was sig")) //if (msg.startsWith("The program being debugged was sig"))
msg = strNotInScope; // msg = strNotInScope;
if (msg.startsWith("The program being debugged stopped while")) //if (msg.startsWith("The program being debugged stopped while"))
msg = strNotInScope; // msg = strNotInScope;
data.setError(msg); //data.setError(msg);
insertData(data); //insertData(data);
} }
} }
@@ -3492,219 +3489,208 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
QTC_ASSERT(data.isValid(), return); QTC_ASSERT(data.isValid(), return);
//qDebug() << "CUSTOM VALUE RESULT: " << record.toString(); //qDebug() << "CUSTOM VALUE RESULT: " << record.toString();
//qDebug() << "FOR DATA: " << data.toString() << record.resultClass; //qDebug() << "FOR DATA: " << data.toString() << record.resultClass;
if (record.resultClass == GdbResultDone) { if (record.resultClass != GdbResultDone) {
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>");
if (data.isTypeNeeded())
data.setType("<unknown>");
if (data.isChildrenNeeded())
data.setChildCount(0);
if (data.isChildCountNeeded())
data.setChildCount(0);
data.setValueToolTip("<custom dumper produced no output>");
insertData(data);
} else {
setWatchDataType(data, contents.findChild("type"));
setWatchDataValue(data, contents.findChild("value"),
contents.findChild("valueencoded").data().toInt());
setWatchDataAddress(data, contents.findChild("addr"));
setWatchDataChildCount(data, contents.findChild("numchild"));
setWatchDataValueToolTip(data, contents.findChild("valuetooltip"));
setWatchDataValueDisabled(data, contents.findChild("valuedisabled"));
setWatchDataEditValue(data, contents.findChild("editvalue"));
if (qq->watchHandler()->isDisplayedIName(data.iname)) {
GdbMi editvalue = contents.findChild("editvalue");
if (editvalue.isValid()) {
setWatchDataEditValue(data, editvalue);
qq->watchHandler()->showEditValue(data);
}
}
if (!qq->watchHandler()->isExpandedIName(data.iname))
data.setChildrenUnneeded();
GdbMi children = contents.findChild("children");
if (children.isValid() || !qq->watchHandler()->isExpandedIName(data.iname))
data.setChildrenUnneeded();
data.setValueUnneeded();
// try not to repeat data too often
WatchData childtemplate;
setWatchDataType(childtemplate, contents.findChild("childtype"));
setWatchDataChildCount(childtemplate, contents.findChild("childnumchild"));
//qDebug() << "DATA: " << data.toString();
insertData(data);
foreach (GdbMi item, children.children()) {
WatchData data1 = childtemplate;
data1.name = item.findChild("name").data();
data1.iname = data.iname + "." + data1.name;
//qDebug() << "NAMEENCODED: " << item.findChild("nameencoded").data()
// << item.findChild("nameencoded").data()[1];
if (item.findChild("nameencoded").data()[0] == '1')
data1.name = QByteArray::fromBase64(data1.name.toUtf8());
QString key = item.findChild("key").data();
if (!key.isEmpty())
data1.name += " (" + key + ")";
setWatchDataType(data1, item.findChild("type"));
setWatchDataExpression(data1, item.findChild("exp"));
setWatchDataChildCount(data1, item.findChild("numchild"));
setWatchDataValue(data1, item.findChild("value"),
item.findChild("valueencoded").data().toInt());
setWatchDataAddress(data1, item.findChild("addr"));
setWatchDataValueToolTip(data1, item.findChild("valuetooltip"));
setWatchDataValueDisabled(data1, item.findChild("valuedisabled"));
if (!qq->watchHandler()->isExpandedIName(data1.iname))
data1.setChildrenUnneeded();
//qDebug() << "HANDLE CUSTOM SUBCONTENTS:" << data1.toString();
insertData(data1);
}
}
//qDebug() << "HANDLE CUSTOM VALUE CONTENTS: " << data.toString();
} else if (record.resultClass == GdbResultError) {
// FIXME: Should not happen here, i.e. could be removed
QString msg = record.data.findChild("msg").data();
//qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg;
if (msg.startsWith("The program being debugged was sig"))
msg = strNotInScope;
if (msg.startsWith("The program being debugged stopped while"))
msg = strNotInScope;
data.setError(msg);
insertData(data);
} else {
qDebug() << "STRANGE CUSTOM DUMPER RESULT DATA: " << data.toString(); qDebug() << "STRANGE CUSTOM DUMPER RESULT DATA: " << data.toString();
return;
}
GdbMi output = record.data.findChild("consolestreamoutput");
QByteArray out = output.data();
int markerPos = out.indexOf('"') + 1; // position of 'success marker'
if (markerPos == -1 || out.at(markerPos) == 'f') { // 't' or 'f'
// custom dumper produced no output
data.setError(strNotInScope);
insertData(data);
return;
}
out = out.mid(markerPos + 1);
out = out.left(out.lastIndexOf('"'));
out.replace("\\", "");
out = "dummy={" + out + "}";
GdbMi contents;
contents.fromString(out);
//qDebug() << "CONTENTS" << contents.toString(true);
if (!contents.isValid()) {
data.setError(strNotInScope);
insertData(data);
return;
}
setWatchDataType(data, contents.findChild("type"));
setWatchDataValue(data, contents.findChild("value"),
contents.findChild("valueencoded").data().toInt());
setWatchDataAddress(data, contents.findChild("addr"));
setWatchDataChildCount(data, contents.findChild("numchild"));
setWatchDataValueToolTip(data, contents.findChild("valuetooltip"));
setWatchDataValueDisabled(data, contents.findChild("valuedisabled"));
setWatchDataEditValue(data, contents.findChild("editvalue"));
if (qq->watchHandler()->isDisplayedIName(data.iname)) {
GdbMi editvalue = contents.findChild("editvalue");
if (editvalue.isValid()) {
setWatchDataEditValue(data, editvalue);
qq->watchHandler()->showEditValue(data);
}
}
if (!qq->watchHandler()->isExpandedIName(data.iname))
data.setChildrenUnneeded();
GdbMi children = contents.findChild("children");
if (children.isValid() || !qq->watchHandler()->isExpandedIName(data.iname))
data.setChildrenUnneeded();
data.setValueUnneeded();
// try not to repeat data too often
WatchData childtemplate;
setWatchDataType(childtemplate, contents.findChild("childtype"));
setWatchDataChildCount(childtemplate, contents.findChild("childnumchild"));
//qDebug() << "DATA: " << data.toString();
insertData(data);
foreach (GdbMi item, children.children()) {
WatchData data1 = childtemplate;
data1.name = item.findChild("name").data();
data1.iname = data.iname + "." + data1.name;
if (!data1.name.isEmpty() && data1.name.at(0).isDigit())
data1.name = '[' + data1.name + ']';
QString key = item.findChild("key").data();
if (!key.isEmpty()) {
if (item.findChild("keyencoded").data()[0] == '1')
key = '"' + QByteArray::fromBase64(key.toUtf8()) + '"';
data1.name += " (" + key + ")";
}
setWatchDataType(data1, item.findChild("type"));
setWatchDataExpression(data1, item.findChild("exp"));
setWatchDataChildCount(data1, item.findChild("numchild"));
setWatchDataValue(data1, item.findChild("value"),
item.findChild("valueencoded").data().toInt());
setWatchDataAddress(data1, item.findChild("addr"));
setWatchDataValueToolTip(data1, item.findChild("valuetooltip"));
setWatchDataValueDisabled(data1, item.findChild("valuedisabled"));
if (!qq->watchHandler()->isExpandedIName(data1.iname))
data1.setChildrenUnneeded();
//qDebug() << "HANDLE CUSTOM SUBCONTENTS:" << data1.toString();
insertData(data1);
} }
} }
void GdbEngine::updateLocals() void GdbEngine::updateLocals()
{ {
setTokenBarrier(); setTokenBarrier();
m_pendingRequests = 0; m_pendingRequests = 0;
PENDING_DEBUG("\nRESET PENDING"); PENDING_DEBUG("\nRESET PENDING");
m_toolTipCache.clear(); m_toolTipCache.clear();
m_toolTipExpression.clear(); m_toolTipExpression.clear();
qq->watchHandler()->reinitializeWatchers(); qq->watchHandler()->reinitializeWatchers();
int level = currentFrame(); int level = currentFrame();
// '2' is 'list with type and value' // '2' is 'list with type and value'
QString cmd = QString("-stack-list-arguments 2 %1 %2").arg(level).arg(level); QString cmd = QString("-stack-list-arguments 2 %1 %2").arg(level).arg(level);
sendSynchronizedCommand(cmd, StackListArguments); // stage 1/2 sendSynchronizedCommand(cmd, StackListArguments); // stage 1/2
// '2' is 'list with type and value' // '2' is 'list with type and value'
sendSynchronizedCommand("-stack-list-locals 2", StackListLocals); // stage 2/2 sendSynchronizedCommand("-stack-list-locals 2", StackListLocals); // stage 2/2
} }
void GdbEngine::handleStackListArguments(const GdbResultRecord &record) void GdbEngine::handleStackListArguments(const GdbResultRecord &record)
{ {
// stage 1/2 // stage 1/2
// Linux: // Linux:
// 12^done,stack-args= // 12^done,stack-args=
// [frame={level="0",args=[ // [frame={level="0",args=[
// {name="argc",type="int",value="1"}, // {name="argc",type="int",value="1"},
// {name="argv",type="char **",value="(char **) 0x7..."}]}] // {name="argv",type="char **",value="(char **) 0x7..."}]}]
// Mac: // Mac:
// 78^done,stack-args= // 78^done,stack-args=
// {frame={level="0",args={ // {frame={level="0",args={
// varobj= // varobj=
// {exp="this",value="0x38a2fab0",name="var21",numchild="3", // {exp="this",value="0x38a2fab0",name="var21",numchild="3",
// type="CurrentDocumentFind * const",typecode="PTR", // type="CurrentDocumentFind * const",typecode="PTR",
// dynamic_type="",in_scope="true",block_start_addr="0x3938e946", // dynamic_type="",in_scope="true",block_start_addr="0x3938e946",
// block_end_addr="0x3938eb2d"}, // block_end_addr="0x3938eb2d"},
// varobj= // varobj=
// {exp="before",value="@0xbfffb9f8: {d = 0x3a7f2a70}", // {exp="before",value="@0xbfffb9f8: {d = 0x3a7f2a70}",
// name="var22",numchild="1",type="const QString ...} }}} // name="var22",numchild="1",type="const QString ...} }}}
// //
// In both cases, iterating over the children of stack-args/frame/args // In both cases, iterating over the children of stack-args/frame/args
// is ok. // is ok.
m_currentFunctionArgs.clear(); m_currentFunctionArgs.clear();
if (record.resultClass == GdbResultDone) { if (record.resultClass == GdbResultDone) {
const GdbMi list = record.data.findChild("stack-args"); const GdbMi list = record.data.findChild("stack-args");
const GdbMi frame = list.findChild("frame"); const GdbMi frame = list.findChild("frame");
const GdbMi args = frame.findChild("args"); const GdbMi args = frame.findChild("args");
m_currentFunctionArgs = args.children(); m_currentFunctionArgs = args.children();
} else if (record.resultClass == GdbResultError) { } else if (record.resultClass == GdbResultError) {
qDebug() << "FIXME: GdbEngine::handleStackListArguments: should not happen"; qDebug() << "FIXME: GdbEngine::handleStackListArguments: should not happen";
} }
} }
void GdbEngine::handleStackListLocals(const GdbResultRecord &record) void GdbEngine::handleStackListLocals(const GdbResultRecord &record)
{ {
// stage 2/2 // stage 2/2
// There could be shadowed variables // There could be shadowed variables
QList<GdbMi> locals = record.data.findChild("locals").children(); QList<GdbMi> locals = record.data.findChild("locals").children();
locals += m_currentFunctionArgs; locals += m_currentFunctionArgs;
setLocals(locals); setLocals(locals);
} }
void GdbEngine::setLocals(const QList<GdbMi> &locals) void GdbEngine::setLocals(const QList<GdbMi> &locals)
{ {
//qDebug() << m_varToType; //qDebug() << m_varToType;
QHash<QString, int> seen; QHash<QString, int> seen;
foreach (const GdbMi &item, locals) { foreach (const GdbMi &item, locals) {
// Local variables of inlined code are reported as // Local variables of inlined code are reported as
// 26^done,locals={varobj={exp="this",value="",name="var4",exp="this", // 26^done,locals={varobj={exp="this",value="",name="var4",exp="this",
// numchild="1",type="const QtSharedPointer::Basic<CPlusPlus::..." // numchild="1",type="const QtSharedPointer::Basic<CPlusPlus::..."
// We do not want these at all. Current hypotheses is that those // We do not want these at all. Current hypotheses is that those
// "spurious" locals have _two_ "exp" field. Try to filter them: // "spurious" locals have _two_ "exp" field. Try to filter them:
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
int numExps = 0; int numExps = 0;
foreach (const GdbMi &child, item.children()) foreach (const GdbMi &child, item.children())
numExps += int(child.name() == "exp"); numExps += int(child.name() == "exp");
if (numExps > 1) if (numExps > 1)
continue; continue;
QString name = item.findChild("exp").data(); QString name = item.findChild("exp").data();
#else #else
QString name = item.findChild("name").data(); QString name = item.findChild("name").data();
#endif #endif
int n = seen.value(name); int n = seen.value(name);
if (n) { if (n) {
seen[name] = n + 1; seen[name] = n + 1;
WatchData data; WatchData data;
data.iname = "local." + name + QString::number(n + 1); data.iname = "local." + name + QString::number(n + 1);
data.name = name + QString(" <shadowed %1>").arg(n); data.name = name + QString(" <shadowed %1>").arg(n);
//data.setValue("<shadowed>"); //data.setValue("<shadowed>");
setWatchDataValue(data, item.findChild("value"));
data.setType("<shadowed>");
data.setChildCount(0);
insertData(data);
} else {
seen[name] = 1;
WatchData data;
data.iname = "local." + name;
data.name = name;
data.exp = name;
data.framekey = m_currentFrame + data.name;
setWatchDataType(data, item.findChild("type"));
// set value only directly if it is simple enough, otherwise
// pass through the insertData() machinery
if (isIntOrFloatType(data.type) || isPointerType(data.type))
setWatchDataValue(data, item.findChild("value")); setWatchDataValue(data, item.findChild("value"));
data.setType("<shadowed>"); if (!qq->watchHandler()->isExpandedIName(data.iname))
data.setChildCount(0); data.setChildrenUnneeded();
insertData(data); if (isPointerType(data.type) || data.name == "this")
} else { data.setChildCount(1);
seen[name] = 1; if (0 && m_varToType.contains(data.framekey)) {
WatchData data; qDebug() << "RE-USING " << m_varToType.value(data.framekey);
data.iname = "local." + name; data.setType(m_varToType.value(data.framekey));
data.name = name;
data.exp = name;
data.framekey = m_currentFrame + data.name;
setWatchDataType(data, item.findChild("type"));
// set value only directly if it is simple enough, otherwise
// pass through the insertData() machinery
if (isIntOrFloatType(data.type) || isPointerType(data.type))
setWatchDataValue(data, item.findChild("value"));
if (!qq->watchHandler()->isExpandedIName(data.iname))
data.setChildrenUnneeded();
if (isPointerType(data.type) || data.name == "this")
data.setChildCount(1);
if (0 && m_varToType.contains(data.framekey)) {
qDebug() << "RE-USING " << m_varToType.value(data.framekey);
data.setType(m_varToType.value(data.framekey));
}
insertData(data);
} }
insertData(data);
}
} }
} }

View File

@@ -134,6 +134,9 @@ private:
void loadSymbols(const QString &moduleName); void loadSymbols(const QString &moduleName);
void loadAllSymbols(); void loadAllSymbols();
void setDebugDumpers(bool on);
void setUseCustomDumpers(bool on);
// //
// Own stuff // Own stuff
// //
@@ -167,9 +170,6 @@ private:
void updateLocals(); void updateLocals();
private slots: private slots:
void setDebugDumpers(bool on);
void setCustomDumpersWanted(bool on);
void handleResponse(); void handleResponse();
void gdbProcError(QProcess::ProcessError error); void gdbProcError(QProcess::ProcessError error);

View File

@@ -86,6 +86,8 @@ public:
virtual void loadAllSymbols() = 0; virtual void loadAllSymbols() = 0;
virtual void reloadRegisters() = 0; virtual void reloadRegisters() = 0;
virtual void setDebugDumpers(bool on) = 0;
virtual void setUseCustomDumpers(bool on) = 0;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -101,6 +101,9 @@ private:
void loadSessionData() {} void loadSessionData() {}
void saveSessionData() {} void saveSessionData() {}
void setDebugDumpers(bool) {}
void setUseCustomDumpers(bool) {}
void assignValueInDebugger(const QString &expr, const QString &value); void assignValueInDebugger(const QString &expr, const QString &value);
void executeDebuggerCommand(const QString & command); void executeDebuggerCommand(const QString & command);

View File

@@ -255,7 +255,6 @@ QString WatchData::toString() const
return res; return res;
} }
static bool iNameSorter(const WatchData &d1, const WatchData &d2) static bool iNameSorter(const WatchData &d1, const WatchData &d2)
{ {
if (d1.level != d2.level) if (d1.level != d2.level)
@@ -265,19 +264,9 @@ static bool iNameSorter(const WatchData &d1, const WatchData &d2)
QString name1 = d1.iname.section('.', level, level); QString name1 = d1.iname.section('.', level, level);
QString name2 = d2.iname.section('.', level, level); QString name2 = d2.iname.section('.', level, level);
//MODEL_DEBUG(" SORT: " << name1 << name2 << (name1 < name2)); //MODEL_DEBUG(" SORT: " << name1 << name2 << (name1 < name2));
if (name1 != name2 && !name1.isEmpty() && !name2.isEmpty()) {
if (name1 != name2) { if (name1.at(0).isDigit() && name2.at(0).isDigit())
// This formerly used inames. in this case 'lastIndexOf' probably return name1.toInt() < name2.toInt();
// makes more sense.
if (name1.startsWith('[') && name2.startsWith('[')) {
return name1.mid(1, name1.indexOf(']') - 1).toInt()
< name2.mid(1, name2.indexOf(']') - 1).toInt();
// numbers should be sorted according to their numerical value
//int pos = d1.name.lastIndexOf('.');
//if (pos != -1 && pos + 1 != d1.name.size() && d1.name.at(pos + 1).isDigit())
// return d1.name.size() < d2.name.size();
// fall through
}
return name1 < name2; return name1 < name2;
} }
} }

View File

@@ -391,6 +391,7 @@ bool FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
return true; return true;
} }
m_mode = CommandMode; m_mode = CommandMode;
updateMiniBuffer();
return false; return false;
} }
@@ -436,6 +437,7 @@ void FakeVimHandler::Private::setupWidget()
m_plaintextedit->setLineWrapMode(QPlainTextEdit::NoWrap); m_plaintextedit->setLineWrapMode(QPlainTextEdit::NoWrap);
} }
m_wasReadOnly = EDITOR(isReadOnly()); m_wasReadOnly = EDITOR(isReadOnly());
//EDITOR(setReadOnly(true));
showBlackMessage("vi emulation mode."); showBlackMessage("vi emulation mode.");
updateMiniBuffer(); updateMiniBuffer();
} }
@@ -688,17 +690,27 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
indentRegion(m_tc.block(), m_tc.block().next()); indentRegion(m_tc.block(), m_tc.block().next());
finishMovement(); finishMovement();
} else if (m_submode == ZSubMode) { } else if (m_submode == ZSubMode) {
if (key == Key_Return) { //qDebug() << "Z_MODE " << cursorLineInDocument() << linesOnScreen();
// cursor line to top of window, cursor on first non-blank if (key == Key_Return || key == 't') { // cursor line to top of window
if (!m_mvcount.isEmpty())
m_tc.setPosition(positionForLine(count()));
scrollToLineInDocument(cursorLineInDocument()); scrollToLineInDocument(cursorLineInDocument());
moveToFirstNonBlankOnLine(); if (key == Key_Return)
moveToFirstNonBlankOnLine();
finishMovement(); finishMovement();
} else if (key == '.') { // center cursor line } else if (key == '.' || key == 'z') { // cursor line to center of window
if (!m_mvcount.isEmpty())
m_tc.setPosition(positionForLine(count()));
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2); scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
moveToFirstNonBlankOnLine(); if (key == '.')
moveToFirstNonBlankOnLine();
finishMovement(); finishMovement();
} else if (key == 'z') { // center cursor line } else if (key == '-' || key == 'b') { // cursor line to bottom of window
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2); if (!m_mvcount.isEmpty())
m_tc.setPosition(positionForLine(count()));
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() - 1);
if (key == '-')
moveToFirstNonBlankOnLine();
finishMovement(); finishMovement();
} else { } else {
qDebug() << "IGNORED Z_MODE " << key << text; qDebug() << "IGNORED Z_MODE " << key << text;
@@ -770,6 +782,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_commandHistoryIndex = m_commandHistory.size() - 1; m_commandHistoryIndex = m_commandHistory.size() - 1;
updateMiniBuffer(); updateMiniBuffer();
} else if (key == '/' || key == '?') { } else if (key == '/' || key == '?') {
enterExMode(); // to get the cursor disabled
m_mode = (key == '/') ? SearchForwardMode : SearchBackwardMode; m_mode = (key == '/') ? SearchForwardMode : SearchBackwardMode;
m_commandBuffer.clear(); m_commandBuffer.clear();
m_searchHistory.append(QString()); m_searchHistory.append(QString());
@@ -869,13 +882,12 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_opcount = m_mvcount; m_opcount = m_mvcount;
m_mvcount.clear(); m_mvcount.clear();
m_submode = DeleteSubMode; m_submode = DeleteSubMode;
} else if (key == 'd') { } else if (key == 'd' && m_visualMode == VisualLineMode) {
//setAnchor();
leaveVisualMode(); leaveVisualMode();
int beginLine = lineForPosition(m_marks['<']); int beginLine = lineForPosition(m_marks['<']);
int endLine = lineForPosition(m_marks['>']); int endLine = lineForPosition(m_marks['>']);
selectRange(beginLine, endLine); selectRange(beginLine, endLine);
recordRemoveSelectedText(); m_registers[m_register] = recordRemoveSelectedText();
} else if (key == 'D') { } else if (key == 'D') {
setAnchor(); setAnchor();
recordBeginGroup(); recordBeginGroup();
@@ -883,6 +895,13 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
moveDown(qMax(count() - 1, 0)); moveDown(qMax(count() - 1, 0));
moveRight(rightDist()); moveRight(rightDist());
finishMovement(); finishMovement();
} else if (key == control('d')) {
int sline = cursorLineOnScreen();
// FIXME: this should use the "scroll" option, and "count"
moveDown(linesOnScreen() / 2);
moveToFirstNonBlankOnLine();
scrollToLineInDocument(cursorLineInDocument() - sline);
finishMovement();
} else if (key == 'e') { } else if (key == 'e') {
m_moveType = MoveInclusive; m_moveType = MoveInclusive;
moveToWordBoundary(false, true); moveToWordBoundary(false, true);
@@ -1054,10 +1073,13 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_subsubdata = key; m_subsubdata = key;
} else if (key == 'u') { } else if (key == 'u') {
undo(); undo();
} else if (key == 'U') { } else if (key == control('u')) {
// FIXME: this is non-vim, but as Ctrl-R is taken globally int sline = cursorLineOnScreen();
// we have a substitute here // FIXME: this should use the "scroll" option, and "count"
redo(); moveUp(linesOnScreen() / 2);
moveToFirstNonBlankOnLine();
scrollToLineInDocument(cursorLineInDocument() - sline);
finishMovement();
} else if (key == 'v') { } else if (key == 'v') {
enterVisualMode(VisualCharMode); enterVisualMode(VisualCharMode);
} else if (key == 'V') { } else if (key == 'V') {
@@ -1088,7 +1110,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
if (leftDist() > 0) { if (leftDist() > 0) {
setAnchor(); setAnchor();
moveLeft(qMin(count(), leftDist())); moveLeft(qMin(count(), leftDist()));
recordRemoveSelectedText(); m_registers[m_register] = recordRemoveSelectedText();
} }
finishMovement(); finishMovement();
} else if (key == 'y' && m_visualMode == NoVisualMode) { } else if (key == 'y' && m_visualMode == NoVisualMode) {
@@ -1127,20 +1149,6 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
} }
recordInsertText(str); recordInsertText(str);
recordEndGroup(); recordEndGroup();
} else if (key == control('d')) {
int sline = cursorLineOnScreen();
// FIXME: this should use the "scroll" option, and "count"
moveDown(linesOnScreen() / 2);
moveToFirstNonBlankOnLine();
scrollToLineInDocument(cursorLineInDocument() - sline);
finishMovement();
} else if (key == control('u')) {
int sline = cursorLineOnScreen();
// FIXME: this should use the "scroll" option, and "count"
moveUp(linesOnScreen() / 2);
moveToFirstNonBlankOnLine();
scrollToLineInDocument(cursorLineInDocument() - sline);
finishMovement();
} else if (key == Key_PageDown || key == control('f')) { } else if (key == Key_PageDown || key == control('f')) {
moveDown(count() * (linesOnScreen() - 2)); moveDown(count() * (linesOnScreen() - 2));
finishMovement(); finishMovement();
@@ -1213,6 +1221,8 @@ bool FakeVimHandler::Private::handleInsertMode(int key, int, const QString &text
QString str = QString(m_config[ConfigTabStop].toInt(), ' '); QString str = QString(m_config[ConfigTabStop].toInt(), ' ');
m_lastInsertion.append(str); m_lastInsertion.append(str);
m_tc.insertText(str); m_tc.insertText(str);
} else if (key >= control('a') && key <= control('z')) {
// ignore these
} else if (!text.isEmpty()) { } else if (!text.isEmpty()) {
m_lastInsertion.append(text); m_lastInsertion.append(text);
if (m_submode == ReplaceSubMode) { if (m_submode == ReplaceSubMode) {
@@ -1572,10 +1582,15 @@ void FakeVimHandler::Private::search(const QString &needle0, bool forward)
if (forward) if (forward)
m_tc.movePosition(Right, MoveAnchor, 1); m_tc.movePosition(Right, MoveAnchor, 1);
int oldLine = cursorLineInDocument() - cursorLineOnScreen();
EDITOR(setTextCursor(m_tc)); EDITOR(setTextCursor(m_tc));
if (EDITOR(find(needle, flags))) { if (EDITOR(find(needle, flags))) {
m_tc = EDITOR(textCursor()); m_tc = EDITOR(textCursor());
m_tc.setPosition(m_tc.anchor()); m_tc.setPosition(m_tc.anchor());
// making this unconditional feels better, but is not "vim like"
if (oldLine != cursorLineInDocument() - cursorLineOnScreen())
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
return; return;
} }
@@ -1584,6 +1599,8 @@ void FakeVimHandler::Private::search(const QString &needle0, bool forward)
if (EDITOR(find(needle, flags))) { if (EDITOR(find(needle, flags))) {
m_tc = EDITOR(textCursor()); m_tc = EDITOR(textCursor());
m_tc.setPosition(m_tc.anchor()); m_tc.setPosition(m_tc.anchor());
if (oldLine != cursorLineInDocument() - cursorLineOnScreen())
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
if (forward) if (forward)
showRedMessage("search hit BOTTOM, continuing at TOP"); showRedMessage("search hit BOTTOM, continuing at TOP");
else else
@@ -2097,10 +2114,6 @@ FakeVimHandler::~FakeVimHandler()
bool FakeVimHandler::eventFilter(QObject *ob, QEvent *ev) bool FakeVimHandler::eventFilter(QObject *ob, QEvent *ev)
{ {
//if (ev->type() == QEvent::KeyPress || ev->type() == QEvent::ShortcutOverride)
// qDebug() << ob << ev->type() << qApp << d->editor()
// << QEvent::KeyPress << QEvent::ShortcutOverride;
if (ev->type() == QEvent::KeyPress && ob == d->editor()) if (ev->type() == QEvent::KeyPress && ob == d->editor())
return d->handleEvent(static_cast<QKeyEvent *>(ev)); return d->handleEvent(static_cast<QKeyEvent *>(ev));

View File

@@ -126,7 +126,6 @@ private slots:
private: private:
FakeVimPlugin *q; FakeVimPlugin *q;
QAction *m_installHandlerAction; QAction *m_installHandlerAction;
Core::ICore *m_core;
}; };
} // namespace Internal } // namespace Internal
@@ -136,7 +135,6 @@ FakeVimPluginPrivate::FakeVimPluginPrivate(FakeVimPlugin *plugin)
{ {
q = plugin; q = plugin;
m_installHandlerAction = 0; m_installHandlerAction = 0;
m_core = 0;
} }
FakeVimPluginPrivate::~FakeVimPluginPrivate() FakeVimPluginPrivate::~FakeVimPluginPrivate()
@@ -149,10 +147,7 @@ void FakeVimPluginPrivate::shutdown()
bool FakeVimPluginPrivate::initialize() bool FakeVimPluginPrivate::initialize()
{ {
m_core = Core::ICore::instance(); Core::ActionManager *actionManager = Core::ICore::instance()->actionManager();
QTC_ASSERT(m_core, return false);
Core::ActionManager *actionManager = m_core->actionManager();
QTC_ASSERT(actionManager, return false); QTC_ASSERT(actionManager, return false);
QList<int> globalcontext; QList<int> globalcontext;
@@ -174,7 +169,7 @@ bool FakeVimPluginPrivate::initialize()
this, SLOT(installHandlerOnCurrentEditor())); this, SLOT(installHandlerOnCurrentEditor()));
// EditorManager // EditorManager
QObject *editorManager = m_core->editorManager(); QObject *editorManager = Core::ICore::instance()->editorManager();
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)), connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
this, SLOT(editorAboutToClose(Core::IEditor*))); this, SLOT(editorAboutToClose(Core::IEditor*)));
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)), connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),
@@ -187,7 +182,7 @@ void FakeVimPluginPrivate::installHandler(Core::IEditor *editor)
{ {
QWidget *widget = editor->widget(); QWidget *widget = editor->widget();
FakeVimHandler *handler = new FakeVimHandler(widget, this); FakeVimHandler *handler = new FakeVimHandler(widget, widget);
connect(handler, SIGNAL(extraInformationChanged(QString)), connect(handler, SIGNAL(extraInformationChanged(QString)),
this, SLOT(showExtraInformation(QString))); this, SLOT(showExtraInformation(QString)));
@@ -239,9 +234,9 @@ void FakeVimPluginPrivate::writeFile(bool *handled,
if (editor && editor->file()->fileName() == fileName) { if (editor && editor->file()->fileName() == fileName) {
// Handle that as a special case for nicer interaction with core // Handle that as a special case for nicer interaction with core
Core::IFile *file = editor->file(); Core::IFile *file = editor->file();
m_core->fileManager()->blockFileChange(file); Core::ICore::instance()->fileManager()->blockFileChange(file);
file->save(fileName); file->save(fileName);
m_core->fileManager()->unblockFileChange(file); Core::ICore::instance()->fileManager()->unblockFileChange(file);
*handled = true; *handled = true;
} }
} }
@@ -258,33 +253,17 @@ void FakeVimPluginPrivate::removeHandler()
void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor) void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor)
{ {
Q_UNUSED(editor);
//qDebug() << "OPENING: " << editor << editor->widget(); //qDebug() << "OPENING: " << editor << editor->widget();
//installHandler(editor);
#if 1
QSettings *s = ICore::instance()->settings(); QSettings *s = ICore::instance()->settings();
bool automatic = s->value("textInteractionSettings/UseVim").toBool(); bool automatic = s->value("textInteractionSettings/UseVim").toBool();
//qDebug() << "USE VIM: " << automatic;
if (automatic) if (automatic)
installHandler(editor); installHandler(editor);
#endif
#if 0
QWidget *widget = editor->widget();
if (BaseTextEditor *bt = qobject_cast<BaseTextEditor *>(widget)) {
InteractionSettings settings = bt->interactionSettings();
qDebug() << "USE VIM: " << settings.m_useVim;
if (settings.m_useVim)
installHandler(editor);
}
#endif
} }
void FakeVimPluginPrivate::editorAboutToClose(Core::IEditor *editor) void FakeVimPluginPrivate::editorAboutToClose(Core::IEditor *editor)
{ {
//qDebug() << "CLOSING: " << editor << editor->widget();
Q_UNUSED(editor); Q_UNUSED(editor);
//qDebug() << "CLOSING: " << editor;
} }
void FakeVimPluginPrivate::showCommandBuffer(const QString &contents) void FakeVimPluginPrivate::showCommandBuffer(const QString &contents)

View File

@@ -61,6 +61,8 @@
#include <QtHelp/QHelpEngine> #include <QtHelp/QHelpEngine>
#include <coreplugin/coreconstants.h>
using namespace Help::Internal; using namespace Help::Internal;
namespace { namespace {
@@ -228,20 +230,23 @@ void CentralWidget::setSource(const QUrl &url)
void CentralWidget::setLastShownPages() void CentralWidget::setLastShownPages()
{ {
const QStringList lastShownPageList = helpEngine->customValue(QLatin1String("LastShownPages")). const QStringList lastShownPageList =
toString().split(QLatin1Char('|'), QString::SkipEmptyParts); helpEngine->customValue(QLatin1String("LastShownPages")). toString().
split(QLatin1Char('|'), QString::SkipEmptyParts);
if (!lastShownPageList.isEmpty()) { if (!lastShownPageList.isEmpty()) {
foreach (const QString page, lastShownPageList) foreach (const QString& page, lastShownPageList)
setSourceInNewTab(page); setSourceInNewTab(page);
tabWidget->setCurrentIndex(helpEngine->customValue(QLatin1String("LastTabPage"), 0).toInt()); tabWidget->setCurrentIndex(helpEngine->
customValue(QLatin1String("LastTabPage"), 0).toInt());
} else { } else {
QUrl url = helpEngine->findFile(QUrl("qthelp://com.trolltech.qt.440/qdoc/index.html")); QUrl url(helpEngine->findFile(QUrl("qthelp://com.trolltech.qt.440/qdoc/index.html")));
if (url.isValid()) if (!url.isValid()) {
setSource(url); url.setUrl(QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html").
else arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
setSource(QUrl("qthelp://com.trolltech.qt.440/qdoc/index.html")); }
setSource(url);
} }
updateBrowserFont(); updateBrowserFont();
@@ -392,19 +397,33 @@ void CentralWidget::setGlobalActions(const QList<QAction*> &actions)
{ {
globalActionList = actions; globalActionList = actions;
} }
void CentralWidget::setSourceInNewTab(const QUrl &url) void CentralWidget::setSourceInNewTab(const QUrl &url)
{ {
HelpViewer* viewer = new HelpViewer(helpEngine, this); HelpViewer* viewer = new HelpViewer(helpEngine, this);
viewer->installEventFilter(this); viewer->installEventFilter(this);
viewer->setSource(url); viewer->setSource(url);
viewer->setFocus(Qt::OtherFocusReason); viewer->setFocus(Qt::OtherFocusReason);
tabWidget->setCurrentIndex(tabWidget->addTab(viewer, viewer->documentTitle())); tabWidget->setCurrentIndex(tabWidget->addTab(viewer,
quoteTabTitle(viewer->documentTitle())));
#if defined(QT_NO_WEBIT)
QFont font = qApp->font(); QFont font = qApp->font();
if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool()) if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool())
font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont"))); font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont")));
viewer->setFont(font); viewer->setFont(font);
#else
QWebView* view = qobject_cast<QWebView*> (viewer);
if (view) {
QWebSettings* settings = QWebSettings::globalSettings();
int fontSize = settings->fontSize(QWebSettings::DefaultFontSize);
QString fontFamily = settings->fontFamily(QWebSettings::StandardFont);
settings = view->settings();
settings->setFontSize(QWebSettings::DefaultFontSize, fontSize);
settings->setFontFamily(QWebSettings::StandardFont, fontFamily);
}
#endif
connectSignals(); connectSignals();
} }
@@ -492,7 +511,7 @@ void CentralWidget::currentPageChanged(int index)
bool enabled = false; bool enabled = false;
if (viewer) if (viewer)
enabled = tabWidget->count() > 1; enabled = tabWidget->count() > 1;
tabWidget->setTabsClosable(enabled); tabWidget->setTabsClosable(enabled);
tabWidget->cornerWidget(Qt::TopLeftCorner)->setEnabled(true); tabWidget->cornerWidget(Qt::TopLeftCorner)->setEnabled(true);
@@ -595,6 +614,7 @@ bool CentralWidget::eventFilter(QObject *object, QEvent *e)
void CentralWidget::updateBrowserFont() void CentralWidget::updateBrowserFont()
{ {
#if defined(QT_NO_WEBKIT)
QFont font = qApp->font(); QFont font = qApp->font();
if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool()) if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool())
font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont"))); font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont")));
@@ -605,9 +625,25 @@ void CentralWidget::updateBrowserFont()
if (widget->font() != font) if (widget->font() != font)
widget->setFont(font); widget->setFont(font);
} }
#else
QWebSettings* settings = QWebSettings::globalSettings();
int fontSize = settings->fontSize(QWebSettings::DefaultFontSize);
QString fontFamily = settings->fontFamily(QWebSettings::StandardFont);
QWebView* widget = 0;
for (int i = 0; i < tabWidget->count(); ++i) {
widget = qobject_cast<QWebView*> (tabWidget->widget(i));
if (widget) {
settings = widget->settings();
settings->setFontSize(QWebSettings::DefaultFontSize, fontSize);
settings->setFontFamily(QWebSettings::StandardFont, fontFamily);
}
}
#endif
} }
bool CentralWidget::find(const QString &txt, QTextDocument::FindFlags findFlags, bool incremental) bool CentralWidget::find(const QString &txt, QTextDocument::FindFlags findFlags,
bool incremental)
{ {
HelpViewer* viewer = currentHelpViewer(); HelpViewer* viewer = currentHelpViewer();
@@ -666,7 +702,7 @@ bool CentralWidget::find(const QString &txt, QTextDocument::FindFlags findFlags,
} }
void CentralWidget::showTopicChooser(const QMap<QString, QUrl> &links, void CentralWidget::showTopicChooser(const QMap<QString, QUrl> &links,
const QString &keyword) const QString &keyword)
{ {
TopicChooser tc(this, keyword, links); TopicChooser tc(this, keyword, links);
if (tc.exec() == QDialog::Accepted) if (tc.exec() == QDialog::Accepted)

View File

@@ -136,5 +136,11 @@ bool DocSettingsPage::applyChanges()
} }
++it; ++it;
} }
return m_registeredDocs || m_removeDocs.count();
bool success = m_registeredDocs || m_removeDocs.count();
m_removeDocs.clear();
m_registeredDocs = false;
return success;
} }

View File

@@ -98,7 +98,7 @@ void HelpManager::registerDocumentation(const QStringList &fileNames)
} }
} }
if (needsSetup) if (needsSetup)
qDebug() << m_helpEngine->setupData(); m_helpEngine->setupData();
} }
HelpPlugin::HelpPlugin() : HelpPlugin::HelpPlugin() :
@@ -395,6 +395,11 @@ void HelpPlugin::rightPaneForward()
m_helpViewerForSideBar->forward(); m_helpViewerForSideBar->forward();
} }
void HelpPlugin::activateHelpMode()
{
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
}
void HelpPlugin::switchToHelpMode() void HelpPlugin::switchToHelpMode()
{ {
switchToHelpMode(m_helpViewerForSideBar->source()); switchToHelpMode(m_helpViewerForSideBar->source());
@@ -403,14 +408,14 @@ void HelpPlugin::switchToHelpMode()
void HelpPlugin::switchToHelpMode(const QUrl &source) void HelpPlugin::switchToHelpMode(const QUrl &source)
{ {
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); activateHelpMode();
m_centralWidget->setSource(source); m_centralWidget->setSource(source);
m_centralWidget->setFocus(); m_centralWidget->setFocus();
} }
void HelpPlugin::switchToHelpMode(const QMap<QString, QUrl> &urls, const QString &keyword) void HelpPlugin::switchToHelpMode(const QMap<QString, QUrl> &urls, const QString &keyword)
{ {
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); activateHelpMode();
m_centralWidget->showTopicChooser(urls, keyword); m_centralWidget->showTopicChooser(urls, keyword);
} }
@@ -450,9 +455,12 @@ void HelpPlugin::extensionsInitialized()
#endif #endif
QHelpEngineCore hc(fi.absoluteFilePath()); QHelpEngineCore hc(fi.absoluteFilePath());
hc.setupData(); hc.setupData();
if (!hc.registerDocumentation(qchFileName)) QString fileNamespace = QHelpEngineCore::namespaceName(qchFileName);
qDebug() << hc.error(); if (!fileNamespace.isEmpty() && !hc.registeredDocumentations().contains(fileNamespace)) {
needsSetup = true; if (!hc.registerDocumentation(qchFileName))
qDebug() << hc.error();
needsSetup = true;
}
} }
int i = m_helpEngine->customValue( int i = m_helpEngine->customValue(
@@ -558,7 +566,7 @@ void HelpPlugin::activateContext()
viewer = m_helpViewerForSideBar; viewer = m_helpViewerForSideBar;
} else { } else {
viewer = m_centralWidget->currentHelpViewer(); viewer = m_centralWidget->currentHelpViewer();
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); activateHelpMode();
} }
if (viewer) { if (viewer) {
@@ -576,7 +584,7 @@ void HelpPlugin::activateContext()
viewer = m_helpViewerForSideBar; viewer = m_helpViewerForSideBar;
} else { } else {
viewer = m_centralWidget->currentHelpViewer(); viewer = m_centralWidget->currentHelpViewer();
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); activateHelpMode();
} }
if (viewer) { if (viewer) {
@@ -590,19 +598,19 @@ void HelpPlugin::activateContext()
void HelpPlugin::activateIndex() void HelpPlugin::activateIndex()
{ {
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); activateHelpMode();
m_sideBar->activateItem(m_indexItem); m_sideBar->activateItem(m_indexItem);
} }
void HelpPlugin::activateContents() void HelpPlugin::activateContents()
{ {
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); activateHelpMode();
m_sideBar->activateItem(m_contentItem); m_sideBar->activateItem(m_contentItem);
} }
void HelpPlugin::activateSearch() void HelpPlugin::activateSearch()
{ {
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); activateHelpMode();
m_sideBar->activateItem(m_searchItem); m_sideBar->activateItem(m_searchItem);
} }
@@ -677,7 +685,7 @@ void HelpPlugin::addNewBookmark(const QString &title, const QString &url)
void HelpPlugin::openGettingStarted() void HelpPlugin::openGettingStarted()
{ {
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP)); activateHelpMode();
m_centralWidget->setSource( m_centralWidget->setSource(
QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html") QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html")
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR)); .arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));

View File

@@ -134,6 +134,7 @@ private slots:
private: private:
QToolBar *createToolBar(); QToolBar *createToolBar();
void createRightPaneSideBar(); void createRightPaneSideBar();
void activateHelpMode();
Core::ICore *m_core; Core::ICore *m_core;
QHelpEngine *m_helpEngine; QHelpEngine *m_helpEngine;

View File

@@ -519,10 +519,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R")));
mbuild->addAction(cmd, Constants::G_BUILD_RUN); mbuild->addAction(cmd, Constants::G_BUILD_RUN);
m_runActionContextMenu = new QAction(runIcon, tr("Run"), this);
cmd = am->registerAction(m_runActionContextMenu, Constants::RUNCONTEXTMENU, globalcontext);
mproject->addAction(cmd, Constants::G_PROJECT_RUN);
Core::ActionContainer *mrc = am->createMenu(Constants::RUNCONFIGURATIONMENU); Core::ActionContainer *mrc = am->createMenu(Constants::RUNCONFIGURATIONMENU);
m_runConfigurationMenu = mrc->menu(); m_runConfigurationMenu = mrc->menu();
m_runConfigurationMenu->setTitle(tr("Set Run Configuration")); m_runConfigurationMenu->setTitle(tr("Set Run Configuration"));
@@ -536,6 +532,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
modeManager->addAction(cmd, Constants::P_ACTION_RUN, m_runConfigurationMenu); modeManager->addAction(cmd, Constants::P_ACTION_RUN, m_runConfigurationMenu);
m_runActionContextMenu = new QAction(runIcon, tr("Run"), this);
cmd = am->registerAction(m_runActionContextMenu, Constants::RUNCONTEXTMENU, globalcontext);
mproject->addAction(cmd, Constants::G_PROJECT_RUN);
// jump to next task // jump to next task
m_taskAction = new QAction(tr("Go to Task Window"), this); m_taskAction = new QAction(tr("Go to Task Window"), this);
m_taskAction->setIcon(QIcon(Core::Constants::ICON_NEXT)); m_taskAction->setIcon(QIcon(Core::Constants::ICON_NEXT));

View File

@@ -48,6 +48,7 @@
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
#include <QtGui/QToolButton> #include <QtGui/QToolButton>
#include <QtGui/QFocusEvent> #include <QtGui/QFocusEvent>
#include <QtGui/QPalette>
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal; using namespace ProjectExplorer::Internal;
@@ -73,8 +74,6 @@ public:
setContextMenuPolicy(Qt::CustomContextMenu); setContextMenuPolicy(Qt::CustomContextMenu);
setUniformRowHeights(true); setUniformRowHeights(true);
setTextElideMode(Qt::ElideNone); setTextElideMode(Qt::ElideNone);
setAlternatingRowColors(true);
setProperty("AlternateEmpty", true); // Let Manhattan to override style default
// setExpandsOnDoubleClick(false); // setExpandsOnDoubleClick(false);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 613 B

After

Width:  |  Height:  |  Size: 623 B

View File

@@ -104,6 +104,7 @@ bool QMakeStep::init(const QString &name)
m_buildConfiguration = name; m_buildConfiguration = name;
const QtVersion *qtVersion = m_pro->qtVersion(name); const QtVersion *qtVersion = m_pro->qtVersion(name);
if (!qtVersion->isValid()) { if (!qtVersion->isValid()) {
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
emit addToOutputWindow(tr("\n<font color=\"#ff0000\"><b>No valid Qt version set. Set one in Preferences </b></font>\n")); emit addToOutputWindow(tr("\n<font color=\"#ff0000\"><b>No valid Qt version set. Set one in Preferences </b></font>\n"));

View File

@@ -46,6 +46,7 @@
#include <QtGui/QFormLayout> #include <QtGui/QFormLayout>
#include <QtGui/QInputDialog> #include <QtGui/QInputDialog>
#include <QtGui/QLabel>
using namespace Qt4ProjectManager::Internal; using namespace Qt4ProjectManager::Internal;
using namespace Qt4ProjectManager; using namespace Qt4ProjectManager;
@@ -54,17 +55,27 @@ using ProjectExplorer::PersistentSettingsReader;
using ProjectExplorer::PersistentSettingsWriter; using ProjectExplorer::PersistentSettingsWriter;
Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, QString proFilePath) Qt4RunConfiguration::Qt4RunConfiguration(Qt4Project *pro, QString proFilePath)
: ApplicationRunConfiguration(pro), m_proFilePath(proFilePath), m_userSetName(false) : ApplicationRunConfiguration(pro),
m_proFilePath(proFilePath),
m_userSetName(false),
m_configWidget(0),
m_executableLabel(0),
m_workingDirectoryLabel(0)
{ {
setName(tr("Qt4RunConfiguration")); setName(tr("Qt4RunConfiguration"));
if (!m_proFilePath.isEmpty()) { if (!m_proFilePath.isEmpty()) {
updateCachedValues(); updateCachedValues();
setName(QFileInfo(m_proFilePath).baseName()); setName(QFileInfo(m_proFilePath).baseName());
} }
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
this, SIGNAL(effectiveExecutableChanged()));
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
this, SIGNAL(effectiveWorkingDirectoryChanged()));
} }
Qt4RunConfiguration::~Qt4RunConfiguration() Qt4RunConfiguration::~Qt4RunConfiguration()
{ {
} }
QString Qt4RunConfiguration::type() const QString Qt4RunConfiguration::type() const
@@ -72,37 +83,92 @@ QString Qt4RunConfiguration::type() const
return "Qt4ProjectManager.Qt4RunConfiguration"; return "Qt4ProjectManager.Qt4RunConfiguration";
} }
QWidget *Qt4RunConfiguration::configurationWidget()
//////
/// Qt4RunConfigurationWidget
/////
Qt4RunConfigurationWidget::Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4RunConfiguration, QWidget *parent)
: QWidget(parent), m_qt4RunConfiguration(qt4RunConfiguration), m_ignoreChange(false)
{ {
QWidget *configWidget = new QWidget; QFormLayout *toplayout = new QFormLayout(this);
QFormLayout *toplayout = new QFormLayout(configWidget);
toplayout->setMargin(0); toplayout->setMargin(0);
QLabel *nameLabel = new QLabel(tr("Name:")); QLabel *nameLabel = new QLabel(tr("Name:"));
QLineEdit *nameLineEdit = new QLineEdit(name()); m_nameLineEdit = new QLineEdit(m_qt4RunConfiguration->name());
nameLabel->setBuddy(nameLineEdit); nameLabel->setBuddy(m_nameLineEdit);
toplayout->addRow(nameLabel, nameLineEdit); toplayout->addRow(nameLabel, m_nameLineEdit);
QLabel *executableLabel = new QLabel(tr("Executable:")); m_executableLabel = new QLabel(m_qt4RunConfiguration->executable());
QLabel *executableLabel2 = new QLabel(executable()); toplayout->addRow(tr("Executable:"), m_executableLabel);
toplayout->addRow(executableLabel, executableLabel2);
QLabel *workingDirectoryLabel = new QLabel(tr("Working Directory:")); m_workingDirectoryLabel = new QLabel(m_qt4RunConfiguration->workingDirectory());
QLabel *workingDirectoryLabel2 = new QLabel(workingDirectory()); toplayout->addRow(tr("Working Directory:"), m_workingDirectoryLabel);
toplayout->addRow(workingDirectoryLabel, workingDirectoryLabel2);
QLabel *argumentsLabel = new QLabel(tr("&Arguments:")); QLabel *argumentsLabel = new QLabel(tr("&Arguments:"));
QLineEdit *argumentsLineEdit = new QLineEdit(ProjectExplorer::Environment::joinArgumentList(commandLineArguments())); m_argumentsLineEdit = new QLineEdit(ProjectExplorer::Environment::joinArgumentList(qt4RunConfiguration->commandLineArguments()));
argumentsLabel->setBuddy(argumentsLineEdit); argumentsLabel->setBuddy(m_argumentsLineEdit);
toplayout->addRow(argumentsLabel, argumentsLineEdit); toplayout->addRow(argumentsLabel, m_argumentsLineEdit);
connect(argumentsLineEdit, SIGNAL(textEdited(const QString&)), connect(m_argumentsLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(setCommandLineArguments(const QString&))); this, SLOT(setCommandLineArguments(const QString&)));
connect(nameLineEdit, SIGNAL(textEdited(const QString&)), connect(m_nameLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(nameEdited(const QString&))); this, SLOT(nameEdited(const QString&)));
return configWidget; connect(qt4RunConfiguration, SIGNAL(commandLineArgumentsChanged(QString)),
this, SLOT(commandLineArgumentsChanged(QString)));
connect(qt4RunConfiguration, SIGNAL(nameChanged(QString)),
this, SLOT(nameChanged(QString)));
connect(qt4RunConfiguration, SIGNAL(effectiveExecutableChanged()),
this, SLOT(effectiveExecutableChanged()));
connect(qt4RunConfiguration, SIGNAL(effectiveWorkingDirectoryChanged()),
this, SLOT(effectiveWorkingDirectoryChanged()));
}
void Qt4RunConfigurationWidget::setCommandLineArguments(const QString &args)
{
m_ignoreChange = true;
m_qt4RunConfiguration->setCommandLineArguments(args);
m_ignoreChange = false;
}
void Qt4RunConfigurationWidget::nameEdited(const QString &name)
{
m_ignoreChange = true;
m_qt4RunConfiguration->nameEdited(name);
m_ignoreChange = false;
}
void Qt4RunConfigurationWidget::commandLineArgumentsChanged(const QString &args)
{
if (!m_ignoreChange)
m_argumentsLineEdit->setText(args);
}
void Qt4RunConfigurationWidget::nameChanged(const QString &name)
{
if (!m_ignoreChange)
m_nameLineEdit->setText(name);
}
void Qt4RunConfigurationWidget::effectiveExecutableChanged()
{
m_executableLabel->setText(m_qt4RunConfiguration->executable());
}
void Qt4RunConfigurationWidget::effectiveWorkingDirectoryChanged()
{
m_workingDirectoryLabel->setText(m_qt4RunConfiguration->workingDirectory());
}
////// TODO c&p above
QWidget *Qt4RunConfiguration::configurationWidget()
{
return new Qt4RunConfigurationWidget(this, 0);
} }
void Qt4RunConfiguration::save(PersistentSettingsWriter &writer) const void Qt4RunConfiguration::save(PersistentSettingsWriter &writer) const
@@ -156,6 +222,7 @@ ProjectExplorer::Environment Qt4RunConfiguration::environment() const
void Qt4RunConfiguration::setCommandLineArguments(const QString &argumentsString) void Qt4RunConfiguration::setCommandLineArguments(const QString &argumentsString)
{ {
m_commandLineArguments = ProjectExplorer::Environment::parseCombinedArgString(argumentsString); m_commandLineArguments = ProjectExplorer::Environment::parseCombinedArgString(argumentsString);
emit commandLineArgumentsChanged(argumentsString);
} }
void Qt4RunConfiguration::nameEdited(const QString &name) void Qt4RunConfiguration::nameEdited(const QString &name)
@@ -167,6 +234,7 @@ void Qt4RunConfiguration::nameEdited(const QString &name)
setName(name); setName(name);
m_userSetName = true; m_userSetName = true;
} }
emit nameChanged(name);
} }
QString Qt4RunConfiguration::proFilePath() const QString Qt4RunConfiguration::proFilePath() const
@@ -222,6 +290,9 @@ void Qt4RunConfiguration::updateCachedValues()
m_runMode = ProjectExplorer::ApplicationRunConfiguration::Gui; m_runMode = ProjectExplorer::ApplicationRunConfiguration::Gui;
delete reader; delete reader;
emit effectiveExecutableChanged();
emit effectiveWorkingDirectoryChanged();
} }
QString Qt4RunConfiguration::resolveVariables(const QString &buildConfiguration, const QString& in) const QString Qt4RunConfiguration::resolveVariables(const QString &buildConfiguration, const QString& in) const
@@ -310,7 +381,7 @@ QString Qt4RunConfiguration::qmakeBuildConfigFromBuildConfiguration(const QStrin
else else
return "release"; return "release";
} else { } else {
// Old sytle always CONFIG+=debug_and_release // Old style always CONFIG+=debug_and_release
if (qobject_cast<Qt4Project *>(project())->qtVersion(buildConfigurationName)->defaultBuildConfig() & QtVersion::DebugBuild) if (qobject_cast<Qt4Project *>(project())->qtVersion(buildConfigurationName)->defaultBuildConfig() & QtVersion::DebugBuild)
return "debug"; return "debug";
else else

View File

@@ -36,6 +36,11 @@
#include <projectexplorer/applicationrunconfiguration.h> #include <projectexplorer/applicationrunconfiguration.h>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include <QtGui/QWidget>
class QWidget;
class QLabel;
class QLineEdit;
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
@@ -45,9 +50,13 @@ namespace Internal {
class Qt4ProFileNode; class Qt4ProFileNode;
class Qt4RunConfiguration : public ProjectExplorer::ApplicationRunConfiguration class Qt4RunConfiguration : public ProjectExplorer::ApplicationRunConfiguration
{ {
Q_OBJECT Q_OBJECT
// to change the name and arguments
friend class Qt4RunConfigurationWidget;
public: public:
Qt4RunConfiguration(Qt4Project *pro, QString proFilePath); Qt4RunConfiguration(Qt4Project *pro, QString proFilePath);
virtual ~Qt4RunConfiguration(); virtual ~Qt4RunConfiguration();
@@ -68,6 +77,14 @@ public:
// Should just be called from qt4project, since that knows that the file changed on disc // Should just be called from qt4project, since that knows that the file changed on disc
void updateCachedValues(); void updateCachedValues();
signals:
void nameChanged(const QString&);
void commandLineArgumentsChanged(const QString&);
// note those signals might not emited for every change
void effectiveExecutableChanged();
void effectiveWorkingDirectoryChanged();
private slots: private slots:
void setCommandLineArguments(const QString &argumentsString); void setCommandLineArguments(const QString &argumentsString);
void nameEdited(const QString&); void nameEdited(const QString&);
@@ -88,6 +105,31 @@ private:
QString m_workingDir; QString m_workingDir;
ProjectExplorer::ApplicationRunConfiguration::RunMode m_runMode; ProjectExplorer::ApplicationRunConfiguration::RunMode m_runMode;
bool m_userSetName; bool m_userSetName;
QWidget *m_configWidget;
QLabel *m_executableLabel;
QLabel *m_workingDirectoryLabel;
};
class Qt4RunConfigurationWidget : public QWidget
{
Q_OBJECT
public:
Qt4RunConfigurationWidget(Qt4RunConfiguration *qt4runconfigration, QWidget *parent);
private slots:
void setCommandLineArguments(const QString &arguments);
void nameEdited(const QString &name);
// TODO connect to signals from qt4runconfiguration for changed arguments and names
void commandLineArgumentsChanged(const QString &args);
void nameChanged(const QString &name);
void effectiveExecutableChanged();
void effectiveWorkingDirectoryChanged();
private:
Qt4RunConfiguration *m_qt4RunConfiguration;
bool m_ignoreChange;
QLabel *m_executableLabel;
QLabel *m_workingDirectoryLabel;
QLineEdit *m_nameLineEdit;
QLineEdit *m_argumentsLineEdit;
}; };
class Qt4RunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory class Qt4RunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory

View File

@@ -33,8 +33,8 @@
#include "qtestlibplugin.h" #include "qtestlibplugin.h"
//#include <Qt4IProjectManagers> #include <coreplugin/icore.h>
//#include <texteditor/TextEditorInterfaces> #include <texteditor/itexteditor.h>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtCore/QDir> #include <QtCore/QDir>
@@ -116,28 +116,27 @@ static QTestFunction::MessageType stringToMessageType(const QString &str)
} }
// ----------------------------------- // -----------------------------------
QTestLibPlugin::QTestLibPlugin() : QTestLibPlugin::QTestLibPlugin()
m_projectExplorer(0), : m_projectExplorer(0), m_outputPane(0)
m_core(0),
m_outputPane(0)
{ {
} }
QTestLibPlugin::~QTestLibPlugin() QTestLibPlugin::~QTestLibPlugin()
{ {
if (m_core && m_outputPane) if (m_outputPane)
m_core->pluginManager()->removeObject(m_outputPane); ExtensionSystem::PluginManager::instance()->removeObject(m_outputPane);
} }
bool QTestLibPlugin::init(ExtensionSystem::PluginManagerInterface *app, QString *errorMessage) bool QTestLibPlugin::init(const QStringList &arguments, QString *errorMessage)
{ {
Q_UNUSED(arguments);
Q_UNUSED(errorMessage); Q_UNUSED(errorMessage);
m_projectExplorer = app->getObject<ProjectExplorer::ProjectExplorerPlugin>(); m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
connect(m_projectExplorer->qObject(), SIGNAL(aboutToExecuteProject(ProjectExplorer::Project *)), connect(m_projectExplorer, SIGNAL(aboutToExecuteProject(ProjectExplorer::Project *)),
this, SLOT(projectRunHook(ProjectExplorer::Project *))); this, SLOT(projectRunHook(ProjectExplorer::Project *)));
m_outputPane = new QTestOutputPane(this); m_outputPane = new QTestOutputPane(this);
app->addObject(m_outputPane); ExtensionSystem::PluginManager::instance()->addObject(m_outputPane);
return true; return true;
} }
@@ -169,10 +168,10 @@ void QTestLibPlugin::projectRunHook(ProjectExplorer::Project *proj)
//NBS proj->setCustomApplicationOutputHandler(this); //NBS proj->setCustomApplicationOutputHandler(this);
//NBS proj->setExtraApplicationRunArguments(QStringList() << QLatin1String("-xml") << QLatin1String("-o") << m_outputFile); //NBS proj->setExtraApplicationRunArguments(QStringList() << QLatin1String("-xml") << QLatin1String("-o") << m_outputFile);
const QString proFile = proj->fileName(); // const QString proFile = proj->fileName();
const QFileInfo fi(proFile); // const QFileInfo fi(proFile);
if (QFile::exists(fi.absolutePath())) // if (QFile::exists(fi.absolutePath()))
m_projectDirectory = fi.absolutePath(); // m_projectDirectory = fi.absolutePath();
} }
void QTestLibPlugin::clear() void QTestLibPlugin::clear()
@@ -319,9 +318,11 @@ bool QTestFunction::indexHasIncidents(const QModelIndex &function, IncidentType
return false; return false;
} }
// -------------- QTestOutputPane // -------------- QTestOutputPane
QTestOutputPane::QTestOutputPane(QTestLibPlugin *plugin) :
QObject(plugin), QTestOutputPane::QTestOutputPane(QTestLibPlugin *plugin)
: QObject(plugin),
m_plugin(plugin), m_plugin(plugin),
m_widget(0), m_widget(0),
m_model(new QStandardItemModel(this)) m_model(new QStandardItemModel(this))
@@ -485,8 +486,8 @@ void QTestOutputWidget::gotoLocation(QModelIndex index)
QTestLocation loc = tag.value<QTestLocation>(); QTestLocation loc = tag.value<QTestLocation>();
m_coreInterface->editorManager()->openEditor(loc.file); Core::ICore::instance()->editorManager()->openEditor(loc.file);
Core::EditorInterface *edtIface = m_coreInterface->editorManager()->currentEditor(); Core::EditorInterface *edtIface = Core::ICore::instance()->editorManager()->currentEditor();
if (!edtIface) if (!edtIface)
return; return;
TextEditor::ITextEditor *editor = TextEditor::ITextEditor *editor =

View File

@@ -35,18 +35,19 @@
#define QTESTLIBPLUGIN_H #define QTESTLIBPLUGIN_H
#include <coreplugin/ioutputpane.h> #include <coreplugin/ioutputpane.h>
//#include <projectexplorer/ProjectExplorerInterfaces> #include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <QtGui/QPixmap> #include <QtGui/QPixmap>
#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QStandardItem> #include <QtGui/QStandardItem>
#include <QtGui/QWidget> #include <QtGui/QWidget>
#include <QtGui/QSortFilterProxyModel>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QStandardItemModel;
class QTreeView;
class QTextEdit;
class QComboBox; class QComboBox;
class QStandardItemModel;
class QTextEdit;
class QTreeView;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace QTestLib { namespace QTestLib {
@@ -101,7 +102,7 @@ public:
class QTestOutputPane : public Core::IOutputPane class QTestOutputPane : public Core::IOutputPane
{ {
Q_OBJECT Q_OBJECT
//Q_INTERFACES(Core::IOutputPane)
public: public:
QTestOutputPane(QTestLibPlugin *plugin); QTestOutputPane(QTestLibPlugin *plugin);
@@ -116,8 +117,13 @@ public:
void show(); void show();
Q_SIGNALS: // FIXME:
//signals virtual int priorityInStatusBar() const { return 0;}
virtual void setFocus() {}
virtual bool hasFocus() { return false;}
virtual bool canFocus() { return false;}
signals:
void showPage(); void showPage();
private: private:
@@ -165,19 +171,15 @@ private:
QTestOutputFilter *m_filterModel; QTestOutputFilter *m_filterModel;
}; };
class QTestLibPlugin : public QObject, class QTestLibPlugin : public QObject
public ExtensionSystem::PluginInterface,
public ProjectExplorer::IApplicationOutput
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(ExtensionSystem::PluginInterface
ProjectExplorer::IApplicationOutput)
public: public:
QTestLibPlugin(); QTestLibPlugin();
virtual ~QTestLibPlugin(); virtual ~QTestLibPlugin();
bool init(ExtensionSystem::PluginManagerInterface *app, QString *error_message); bool init(const QStringList &args, QString *error_message);
void extensionsInitialized(); void extensionsInitialized();
// IApplicationOutput // IApplicationOutput

View File

@@ -0,0 +1 @@
This is dead code for now.

View File

@@ -50,8 +50,7 @@ const QIcon SnippetsCompletion::m_fileIcon = QIcon(":/snippets/images/file.png")
SnippetsCompletion::SnippetsCompletion(QObject *parent) SnippetsCompletion::SnippetsCompletion(QObject *parent)
: ICompletionCollector(parent) : ICompletionCollector(parent)
{ {
m_core = SnippetsPlugin::core(); m_snippetsWindow = SnippetsPlugin::snippetsWindow();
m_snippetsWnd = SnippetsPlugin::snippetsWindow();
updateCompletions(); updateCompletions();
} }
@@ -66,9 +65,9 @@ void SnippetsCompletion::updateCompletions()
{ {
qDeleteAll(m_autoCompletions.values()); qDeleteAll(m_autoCompletions.values());
m_autoCompletions.clear(); m_autoCompletions.clear();
#if 0
int index = 0; int index = 0;
foreach (SnippetSpec *spec, m_snippetsWnd->snippets()) { foreach (SnippetSpec *spec, m_snippetsWindow->snippets()) {
if (!spec->completionShortcut().isEmpty()) { if (!spec->completionShortcut().isEmpty()) {
TextEditor::CompletionItem *item = new TextEditor::CompletionItem; TextEditor::CompletionItem *item = new TextEditor::CompletionItem;
item->m_key = spec->name(); item->m_key = spec->name();
@@ -79,6 +78,7 @@ void SnippetsCompletion::updateCompletions()
++index; ++index;
} }
} }
#endif
} }
bool SnippetsCompletion::triggersCompletion(TextEditor::ITextEditable *editor) bool SnippetsCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
@@ -96,29 +96,36 @@ int SnippetsCompletion::startCompletion(TextEditor::ITextEditable *editor)
return m_startPosition; return m_startPosition;
} }
void SnippetsCompletion::completions(QList<TextEditor::CompletionItem *> *completions) #if 0
void SnippetsCompletion::completions(const QList<TextEditor::CompletionItem *> &completions)
{ {
const int length = m_editor->position() - m_startPosition; const int length = m_editor->position() - m_startPosition;
if (length >= 2) { if (length >= 2) {
QString key = m_editor->textAt(m_startPosition, length); QString key = m_editor->textAt(m_startPosition, length);
foreach (TextEditor::CompletionItem* item, m_autoCompletions.values()) { foreach (TextEditor::CompletionItem* item, m_autoCompletions.values()) {
if (item->m_key.startsWith(key, Qt::CaseInsensitive)) { if (item->m_key.startsWith(key, Qt::CaseInsensitive))
(*completions) << item; completions->append(item);
}
} }
} }
} }
#endif
QString SnippetsCompletion::text(TextEditor::CompletionItem *item) const QString SnippetsCompletion::text(TextEditor::CompletionItem *item) const
{ {
const SnippetSpec *spec = m_snippetsWnd->snippets().at(item->m_index); #if 0
const SnippetSpec *spec = m_snippetsWindow->snippets().at(item->m_index);
return spec->name(); return spec->name();
#endif
return QString();
} }
QString SnippetsCompletion::details(TextEditor::CompletionItem *item) const QString SnippetsCompletion::details(TextEditor::CompletionItem *item) const
{ {
const SnippetSpec *spec = m_snippetsWnd->snippets().at(item->m_index); #if 0
const SnippetSpec *spec = m_snippetsWindow->snippets().at(item->m_index);
return spec->description(); return spec->description();
#endif
return QString();
} }
QIcon SnippetsCompletion::icon(TextEditor::CompletionItem *) const QIcon SnippetsCompletion::icon(TextEditor::CompletionItem *) const
@@ -126,18 +133,20 @@ QIcon SnippetsCompletion::icon(TextEditor::CompletionItem *) const
return m_fileIcon; return m_fileIcon;
} }
void SnippetsCompletion::complete(TextEditor::CompletionItem *item) void SnippetsCompletion::complete(const TextEditor::CompletionItem &item)
{ {
SnippetSpec *spec = m_snippetsWnd->snippets().at(item->m_index); #if 0
SnippetSpec *spec = m_snippetsWindow->snippets().at(item->m_index);
int length = m_editor->position() - m_startPosition; int length = m_editor->position() - m_startPosition;
m_editor->setCurPos(m_startPosition); m_editor->setCurPos(m_startPosition);
m_editor->remove(length); m_editor->remove(length);
m_snippetsWnd->insertSnippet(m_editor, spec); m_snippetsWindow->insertSnippet(m_editor, spec);
#endif
} }
bool SnippetsCompletion::partiallyComplete() bool SnippetsCompletion::partiallyComplete(const myns::QList<TextEditor::CompletionItem>&)
{ {
return false; return false;
} }

View File

@@ -36,15 +36,11 @@
#include <texteditor/icompletioncollector.h> #include <texteditor/icompletioncollector.h>
#include <QtCore/QObject>
#include <QtCore/QMap>
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QMap>
#include <QtCore/QObject>
#include <QtGui/QIcon> #include <QtGui/QIcon>
namespace Core {
class ICore;
}
namespace TextEditor { namespace TextEditor {
class ITextEditable; class ITextEditable;
class ITextEditor; class ITextEditor;
@@ -72,10 +68,12 @@ public:
QString details(TextEditor::CompletionItem *item) const; QString details(TextEditor::CompletionItem *item) const;
QIcon icon(TextEditor::CompletionItem *item) const; QIcon icon(TextEditor::CompletionItem *item) const;
void complete(TextEditor::CompletionItem *item); void complete(const TextEditor::CompletionItem &item);
bool partiallyComplete(); bool partiallyComplete(const QList<TextEditor::CompletionItem> &);
void cleanup(); void cleanup();
void completions(QList<TextEditor::CompletionItem>*);
private slots: private slots:
void updateCompletions(); void updateCompletions();
@@ -83,10 +81,9 @@ private:
static int findStartOfName(const TextEditor::ITextEditor *editor); static int findStartOfName(const TextEditor::ITextEditor *editor);
TextEditor::ITextEditable *m_editor; TextEditor::ITextEditable *m_editor;
int m_startPosition; // Position of the cursor from which completion started int m_startPosition; // Position of the cursor from which completion started
SnippetsWindow *m_snippetsWnd; SnippetsWindow *m_snippetsWindow;
Core::ICore *m_core;
QMultiMap<QString, TextEditor::CompletionItem *> m_autoCompletions; QMultiMap<QString, TextEditor::CompletionItem *> m_autoCompletions;

View File

@@ -36,16 +36,18 @@
#include "snippetsplugin.h" #include "snippetsplugin.h"
#include "snippetspec.h" #include "snippetspec.h"
#include <QtCore/QtPlugin>
#include <QtCore/QDebug> #include <QtCore/QDebug>
#include <QtGui/QShortcut> #include <QtCore/QtPlugin>
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QtGui/QShortcut>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <coreplugin/uniqueidmanager.h> #include <coreplugin/uniqueidmanager.h>
#include <coreplugin/actionmanager/actionmanagerinterface.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/CoreTools> #include <coreplugin/baseview.h>
#include <coreplugin/icore.h>
#include <coreplugin/iview.h>
#include <texteditor/itexteditable.h> #include <texteditor/itexteditable.h>
#include <texteditor/texteditorconstants.h> #include <texteditor/texteditorconstants.h>
@@ -56,6 +58,7 @@ SnippetsPlugin *SnippetsPlugin::m_instance = 0;
SnippetsPlugin::SnippetsPlugin() SnippetsPlugin::SnippetsPlugin()
{ {
m_instance = this; m_instance = this;
m_snippetsCompletion = 0;
} }
SnippetsPlugin::~SnippetsPlugin() SnippetsPlugin::~SnippetsPlugin()
@@ -78,17 +81,20 @@ bool SnippetsPlugin::initialize(const QStringList &arguments, QString *)
context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
m_snippetWnd = new SnippetsWindow(); m_snippetWnd = new SnippetsWindow();
addAutoReleasedObject(new Core::BaseView("Snippets.SnippetsTree", Core::BaseView *view = new Core::BaseView;
m_snippetWnd, view->setUniqueViewName("Snippets.SnippetsTree");
QList<int>() << core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window")) view->setWidget(m_snippetWnd);
<< core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR), view->setContext(QList<int>()
Qt::RightDockWidgetArea)); << core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window"))
<< core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR));
//view->setDefaultPosition(Qt::RightDockWidgetArea));
addAutoReleasedObject(view);
m_snippetsCompletion = new SnippetsCompletion(this); m_snippetsCompletion = new SnippetsCompletion(this);
addObject(m_snippetsCompletion); addObject(m_snippetsCompletion);
foreach (SnippetSpec *snippet, m_snippetWnd->snippets()) { foreach (SnippetSpec *snippet, m_snippetWnd->snippets()) {
QShortcut *sc = new QShortcut(m_snippetWnd); QShortcut *sc = new QShortcut(m_snippetWnd);
Core::ICommand *cmd = am->registerShortcut(sc, simplifySnippetName(snippet), context); Core::Command *cmd = am->registerShortcut(sc, simplifySnippetName(snippet), context);
cmd->setCategory(tr("Snippets")); cmd->setCategory(tr("Snippets"));
connect(sc, SIGNAL(activated()), this, SLOT(snippetActivated())); connect(sc, SIGNAL(activated()), this, SLOT(snippetActivated()));
m_shortcuts.insert(sc, snippet); m_shortcuts.insert(sc, snippet);

View File

@@ -59,8 +59,6 @@ Q_DECLARE_METATYPE(Snippets::Internal::SnippetSpec *)
SnippetsWindow::SnippetsWindow() SnippetsWindow::SnippetsWindow()
{ {
m_core = SnippetsPlugin::core();
setWindowTitle(tr("Snippets")); setWindowTitle(tr("Snippets"));
setWindowIcon(QIcon(":/snippets/images/snippets.png")); setWindowIcon(QIcon(":/snippets/images/snippets.png"));
setOrientation(Qt::Vertical); setOrientation(Qt::Vertical);
@@ -79,7 +77,7 @@ SnippetsWindow::SnippetsWindow()
if (!initSnippetsDir()) if (!initSnippetsDir())
setDisabled(true); setDisabled(true);
else { else {
QDir defaultDir(m_core->resourcePath() + QLatin1String("/snippets")); QDir defaultDir(Core::ICore::instance()->resourcePath() + QLatin1String("/snippets"));
if (defaultDir.exists()) if (defaultDir.exists())
initSnippets(defaultDir); initSnippets(defaultDir);
initSnippets(m_snippetsDir); initSnippets(m_snippetsDir);
@@ -110,9 +108,9 @@ void SnippetsWindow::activateSnippet(QTreeWidgetItem *item, int column)
return; return;
TextEditor::ITextEditable *editor = 0; TextEditor::ITextEditable *editor = 0;
if (m_core->editorManager()->currentEditor()) if (Core::ICore::instance()->editorManager()->currentEditor())
editor = qobject_cast<TextEditor::ITextEditable *>( editor = qobject_cast<TextEditor::ITextEditable *>(
m_core->editorManager()->currentEditor()); Core::ICore::instance()->editorManager()->currentEditor());
if (editor) { if (editor) {
SnippetSpec* spec = qVariantValue<SnippetSpec*>(item->data(0, Qt::UserRole)); SnippetSpec* spec = qVariantValue<SnippetSpec*>(item->data(0, Qt::UserRole));
insertSnippet(editor, spec); insertSnippet(editor, spec);
@@ -229,9 +227,9 @@ void SnippetsWindow::showInputWidget(bool canceled, const QString &value)
return; return;
TextEditor::ITextEditor *te = 0; TextEditor::ITextEditor *te = 0;
if (m_core->editorManager()->currentEditor()) if (Core::ICore::instance()->editorManager()->currentEditor())
te = qobject_cast<TextEditor::ITextEditor*>( te = qobject_cast<TextEditor::ITextEditor*>(
m_core->editorManager()->currentEditor()); Core::ICore::instance()->editorManager()->currentEditor());
int arg = m_requiredArgs.takeFirst(); int arg = m_requiredArgs.takeFirst();
if (arg != -1) if (arg != -1)

View File

@@ -44,10 +44,6 @@ class QDir;
class QLabel; class QLabel;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Core {
class ICore;
}
namespace TextEditor { namespace TextEditor {
class ITextEditable; class ITextEditable;
class ITextEditor; class ITextEditor;
@@ -97,7 +93,6 @@ private:
SnippetSpec *m_currentSnippet; SnippetSpec *m_currentSnippet;
TextEditor::ITextEditable *m_currentEditor; TextEditor::ITextEditable *m_currentEditor;
Core::ICore *m_core;
QDir m_snippetsDir; QDir m_snippetsDir;
SnippetsTree *m_snippetsTree; SnippetsTree *m_snippetsTree;

View File

@@ -0,0 +1,187 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include "behaviorsettingspage.h"
#include "interactionsettings.h"
#include "storagesettings.h"
#include "tabsettings.h"
#include "ui_behaviorsettingspage.h"
#include <coreplugin/icore.h>
#include <QtCore/QSettings>
using namespace TextEditor;
struct BehaviorSettingsPage::BehaviorSettingsPagePrivate
{
explicit BehaviorSettingsPagePrivate(const BehaviorSettingsPageParameters &p);
const BehaviorSettingsPageParameters m_parameters;
Ui::BehaviorSettingsPage m_page;
TabSettings m_tabSettings;
StorageSettings m_storageSettings;
InteractionSettings m_interactionSettings;
};
BehaviorSettingsPage::BehaviorSettingsPagePrivate::BehaviorSettingsPagePrivate
(const BehaviorSettingsPageParameters &p)
: m_parameters(p)
{
if (const QSettings *s = Core::ICore::instance()->settings()) {
m_tabSettings.fromSettings(m_parameters.settingsPrefix, s);
m_storageSettings.fromSettings(m_parameters.settingsPrefix, s);
m_interactionSettings.fromSettings(m_parameters.settingsPrefix, s);
}
}
BehaviorSettingsPage::BehaviorSettingsPage(const BehaviorSettingsPageParameters &p,
QObject *parent)
: Core::IOptionsPage(parent),
m_d(new BehaviorSettingsPagePrivate(p))
{
}
BehaviorSettingsPage::~BehaviorSettingsPage()
{
delete m_d;
}
QString BehaviorSettingsPage::name() const
{
return m_d->m_parameters.name;
}
QString BehaviorSettingsPage::category() const
{
return m_d->m_parameters.category;
}
QString BehaviorSettingsPage::trCategory() const
{
return m_d->m_parameters.trCategory;
}
QWidget *BehaviorSettingsPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_d->m_page.setupUi(w);
settingsToUI();
return w;
}
void BehaviorSettingsPage::apply()
{
TabSettings newTabSettings;
StorageSettings newStorageSettings;
InteractionSettings newInteractionSettings;
settingsFromUI(newTabSettings, newStorageSettings, newInteractionSettings);
Core::ICore *core = Core::ICore::instance();
QSettings *s = core->settings();
if (newTabSettings != m_d->m_tabSettings) {
m_d->m_tabSettings = newTabSettings;
if (s)
m_d->m_tabSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
emit tabSettingsChanged(newTabSettings);
}
if (newStorageSettings != m_d->m_storageSettings) {
m_d->m_storageSettings = newStorageSettings;
if (s)
m_d->m_storageSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
emit storageSettingsChanged(newStorageSettings);
}
if (newInteractionSettings != m_d->m_interactionSettings) {
m_d->m_interactionSettings = newInteractionSettings;
if (s)
m_d->m_interactionSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
}
}
void BehaviorSettingsPage::settingsFromUI(TabSettings &tabSettings,
StorageSettings &storageSettings,
InteractionSettings &interactionSettings) const
{
tabSettings.m_spacesForTabs = m_d->m_page.insertSpaces->isChecked();
tabSettings.m_autoIndent = m_d->m_page.autoIndent->isChecked();
tabSettings.m_smartBackspace = m_d->m_page.smartBackspace->isChecked();
tabSettings.m_tabSize = m_d->m_page.tabSize->value();
tabSettings.m_indentSize = m_d->m_page.indentSize->value();
storageSettings.m_cleanWhitespace = m_d->m_page.cleanWhitespace->isChecked();
storageSettings.m_inEntireDocument = m_d->m_page.inEntireDocument->isChecked();
storageSettings.m_cleanIndentation = m_d->m_page.cleanIndentation->isChecked();
storageSettings.m_addFinalNewLine = m_d->m_page.addFinalNewLine->isChecked();
interactionSettings.m_useVim = m_d->m_page.useVim->isChecked();
}
void BehaviorSettingsPage::settingsToUI()
{
const TabSettings &tabSettings = m_d->m_tabSettings;
m_d->m_page.insertSpaces->setChecked(tabSettings.m_spacesForTabs);
m_d->m_page.autoIndent->setChecked(tabSettings.m_autoIndent);
m_d->m_page.smartBackspace->setChecked(tabSettings.m_smartBackspace);
m_d->m_page.tabSize->setValue(tabSettings.m_tabSize);
m_d->m_page.indentSize->setValue(tabSettings.m_indentSize);
const StorageSettings &storageSettings = m_d->m_storageSettings;
m_d->m_page.cleanWhitespace->setChecked(storageSettings.m_cleanWhitespace);
m_d->m_page.inEntireDocument->setChecked(storageSettings.m_inEntireDocument);
m_d->m_page.cleanIndentation->setChecked(storageSettings.m_cleanIndentation);
m_d->m_page.addFinalNewLine->setChecked(storageSettings.m_addFinalNewLine);
const InteractionSettings &interactionSettings = m_d->m_interactionSettings;
m_d->m_page.useVim->setChecked(interactionSettings.m_useVim);
}
TabSettings BehaviorSettingsPage::tabSettings() const
{
return m_d->m_tabSettings;
}
StorageSettings BehaviorSettingsPage::storageSettings() const
{
return m_d->m_storageSettings;
}
InteractionSettings BehaviorSettingsPage::interactionSettings() const
{
return m_d->m_interactionSettings;
}

View File

@@ -31,8 +31,8 @@
** **
***************************************************************************/ ***************************************************************************/
#ifndef GENERALSETTINGSPAGE_H #ifndef BEHAVIORSETTINGSPAGE_H
#define GENERALSETTINGSPAGE_H #define BEHAVIORSETTINGSPAGE_H
#include "texteditor_global.h" #include "texteditor_global.h"
@@ -44,10 +44,9 @@ namespace TextEditor {
struct TabSettings; struct TabSettings;
struct StorageSettings; struct StorageSettings;
struct DisplaySettings;
struct InteractionSettings; struct InteractionSettings;
struct TEXTEDITOR_EXPORT GeneralSettingsPageParameters struct BehaviorSettingsPageParameters
{ {
QString name; QString name;
QString category; QString category;
@@ -55,13 +54,13 @@ struct TEXTEDITOR_EXPORT GeneralSettingsPageParameters
QString settingsPrefix; QString settingsPrefix;
}; };
class TEXTEDITOR_EXPORT GeneralSettingsPage : public Core::IOptionsPage class BehaviorSettingsPage : public Core::IOptionsPage
{ {
Q_OBJECT Q_OBJECT
public: public:
GeneralSettingsPage(const GeneralSettingsPageParameters &p, QObject *parent); BehaviorSettingsPage(const BehaviorSettingsPageParameters &p, QObject *parent);
virtual ~GeneralSettingsPage(); virtual ~BehaviorSettingsPage();
// IOptionsPage // IOptionsPage
QString name() const; QString name() const;
@@ -74,27 +73,21 @@ public:
TabSettings tabSettings() const; TabSettings tabSettings() const;
StorageSettings storageSettings() const; StorageSettings storageSettings() const;
DisplaySettings displaySettings() const;
InteractionSettings interactionSettings() const; InteractionSettings interactionSettings() const;
void setDisplaySettings(const DisplaySettings &);
signals: signals:
void tabSettingsChanged(const TextEditor::TabSettings &); void tabSettingsChanged(const TextEditor::TabSettings &);
void storageSettingsChanged(const TextEditor::StorageSettings &); void storageSettingsChanged(const TextEditor::StorageSettings &);
void displaySettingsChanged(const TextEditor::DisplaySettings &);
private: private:
void settingsFromUI(TabSettings &rc, void settingsFromUI(TabSettings &rc,
StorageSettings &storageSettings, StorageSettings &storageSettings,
DisplaySettings &displaySettings, InteractionSettings &interactionSettings) const;
InteractionSettings &interactionSettings
) const;
void settingsToUI(); void settingsToUI();
struct GeneralSettingsPagePrivate; struct BehaviorSettingsPagePrivate;
GeneralSettingsPagePrivate *m_d; BehaviorSettingsPagePrivate *m_d;
}; };
} // namespace TextEditor } // namespace TextEditor
#endif // GENERALSETTINGSPAGE_H #endif // BEHAVIORSETTINGSPAGE_H

View File

@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>TextEditor::generalSettingsPage</class> <class>TextEditor::BehaviorSettingsPage</class>
<widget class="QWidget" name="TextEditor::generalSettingsPage"> <widget class="QWidget" name="TextEditor::BehaviorSettingsPage">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>514</width> <width>484</width>
<height>475</height> <height>398</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -255,71 +255,6 @@
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QGroupBox" name="groupBoxDisplaySettings">
<property name="title">
<string>Display Settings</string>
</property>
<layout class="QGridLayout">
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="showWrapColumn">
<property name="text">
<string>Display right &amp;margin at column</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="wrapColumn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximum">
<number>999</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="enableTextWrapping">
<property name="text">
<string>Enable text &amp;wrapping</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="displayLineNumbers">
<property name="text">
<string>Display line &amp;numbers</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="visualizeWhitespace">
<property name="text">
<string>&amp;Visualize whitespace</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="displayFoldingMarkers">
<property name="text">
<string>Display &amp;folding markers</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="highlightCurrentLine">
<property name="text">
<string>Highlight current &amp;line</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="groupBoxInteractionSettings"> <widget class="QGroupBox" name="groupBoxInteractionSettings">
<property name="title"> <property name="title">
<string>Interaction Settings</string> <string>Interaction Settings</string>
@@ -335,7 +270,7 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="3" column="0">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@@ -373,20 +308,14 @@
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
<receiver>cleanIndentation</receiver> <receiver>cleanIndentation</receiver>
<slot>setEnabled(bool)</slot> <slot>setEnabled(bool)</slot>
</connection>
<connection>
<sender>showWrapColumn</sender>
<signal>toggled(bool)</signal>
<receiver>wrapColumn</receiver>
<slot>setEnabled(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>399</x> <x>20</x>
<y>308</y> <y>20</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>474</x> <x>20</x>
<y>308</y> <y>20</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>

View File

@@ -0,0 +1,153 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include "displaysettingspage.h"
#include "displaysettings.h"
#include "ui_displaysettingspage.h"
#include <coreplugin/icore.h>
#include <QtCore/QSettings>
using namespace TextEditor;
struct DisplaySettingsPage::DisplaySettingsPagePrivate
{
explicit DisplaySettingsPagePrivate(const DisplaySettingsPageParameters &p);
const DisplaySettingsPageParameters m_parameters;
Ui::DisplaySettingsPage m_page;
DisplaySettings m_displaySettings;
};
DisplaySettingsPage::DisplaySettingsPagePrivate::DisplaySettingsPagePrivate
(const DisplaySettingsPageParameters &p)
: m_parameters(p)
{
if (const QSettings *s = Core::ICore::instance()->settings()) {
m_displaySettings.fromSettings(m_parameters.settingsPrefix, s);
}
}
DisplaySettingsPage::DisplaySettingsPage(const DisplaySettingsPageParameters &p,
QObject *parent)
: Core::IOptionsPage(parent),
m_d(new DisplaySettingsPagePrivate(p))
{
}
DisplaySettingsPage::~DisplaySettingsPage()
{
delete m_d;
}
QString DisplaySettingsPage::name() const
{
return m_d->m_parameters.name;
}
QString DisplaySettingsPage::category() const
{
return m_d->m_parameters.category;
}
QString DisplaySettingsPage::trCategory() const
{
return m_d->m_parameters.trCategory;
}
QWidget *DisplaySettingsPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_d->m_page.setupUi(w);
settingsToUI();
return w;
}
void DisplaySettingsPage::apply()
{
DisplaySettings newDisplaySettings;
settingsFromUI(newDisplaySettings);
Core::ICore *core = Core::ICore::instance();
QSettings *s = core->settings();
if (newDisplaySettings != m_d->m_displaySettings) {
m_d->m_displaySettings = newDisplaySettings;
if (s)
m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s);
emit displaySettingsChanged(newDisplaySettings);
}
}
void DisplaySettingsPage::settingsFromUI(DisplaySettings &displaySettings) const
{
displaySettings.m_displayLineNumbers = m_d->m_page.displayLineNumbers->isChecked();
displaySettings.m_textWrapping = m_d->m_page.enableTextWrapping->isChecked();
displaySettings.m_showWrapColumn = m_d->m_page.showWrapColumn->isChecked();
displaySettings.m_wrapColumn = m_d->m_page.wrapColumn->value();
displaySettings.m_visualizeWhitespace = m_d->m_page.visualizeWhitespace->isChecked();
displaySettings.m_displayFoldingMarkers = m_d->m_page.displayFoldingMarkers->isChecked();
displaySettings.m_highlightCurrentLine = m_d->m_page.highlightCurrentLine->isChecked();
}
void DisplaySettingsPage::settingsToUI()
{
const DisplaySettings &displaySettings = m_d->m_displaySettings;
m_d->m_page.displayLineNumbers->setChecked(displaySettings.m_displayLineNumbers);
m_d->m_page.enableTextWrapping->setChecked(displaySettings.m_textWrapping);
m_d->m_page.showWrapColumn->setChecked(displaySettings.m_showWrapColumn);
m_d->m_page.wrapColumn->setValue(displaySettings.m_wrapColumn);
m_d->m_page.visualizeWhitespace->setChecked(displaySettings.m_visualizeWhitespace);
m_d->m_page.displayFoldingMarkers->setChecked(displaySettings.m_displayFoldingMarkers);
m_d->m_page.highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine);
}
DisplaySettings DisplaySettingsPage::displaySettings() const
{
return m_d->m_displaySettings;
}
void DisplaySettingsPage::setDisplaySettings(const DisplaySettings &newDisplaySettings)
{
if (newDisplaySettings != m_d->m_displaySettings) {
m_d->m_displaySettings = newDisplaySettings;
Core::ICore *core = Core::ICore::instance();
if (QSettings *s = core->settings())
m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s);
emit displaySettingsChanged(newDisplaySettings);
}
}

View File

@@ -0,0 +1,87 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef DISPLAYSETTINGSPAGE_H
#define DISPLAYSETTINGSPAGE_H
#include "texteditor_global.h"
#include <coreplugin/dialogs/ioptionspage.h>
#include <QtCore/QObject>
namespace TextEditor {
struct DisplaySettings;
struct DisplaySettingsPageParameters
{
QString name;
QString category;
QString trCategory;
QString settingsPrefix;
};
class DisplaySettingsPage : public Core::IOptionsPage
{
Q_OBJECT
public:
DisplaySettingsPage(const DisplaySettingsPageParameters &p, QObject *parent);
virtual ~DisplaySettingsPage();
// IOptionsPage
QString name() const;
QString category() const;
QString trCategory() const;
QWidget *createPage(QWidget *parent);
void apply();
void finish() { }
DisplaySettings displaySettings() const;
void setDisplaySettings(const DisplaySettings &);
signals:
void displaySettingsChanged(const TextEditor::DisplaySettings &);
private:
void settingsFromUI(DisplaySettings &displaySettings) const;
void settingsToUI();
struct DisplaySettingsPagePrivate;
DisplaySettingsPagePrivate *m_d;
};
} // namespace TextEditor
#endif // DISPLAYSETTINGSPAGE_H

View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TextEditor::DisplaySettingsPage</class>
<widget class="QWidget" name="TextEditor::DisplaySettingsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<height>194</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBoxDisplaySettings">
<property name="title">
<string>Display Settings</string>
</property>
<layout class="QGridLayout">
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="showWrapColumn">
<property name="text">
<string>Display right &amp;margin at column</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="wrapColumn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximum">
<number>999</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="enableTextWrapping">
<property name="text">
<string>Enable text &amp;wrapping</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="displayLineNumbers">
<property name="text">
<string>Display line &amp;numbers</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="visualizeWhitespace">
<property name="text">
<string>&amp;Visualize whitespace</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="displayFoldingMarkers">
<property name="text">
<string>Display &amp;folding markers</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="highlightCurrentLine">
<property name="text">
<string>Highlight current &amp;line</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>showWrapColumn</sender>
<signal>toggled(bool)</signal>
<receiver>wrapColumn</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>399</x>
<y>308</y>
</hint>
<hint type="destinationlabel">
<x>474</x>
<y>308</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -1,237 +0,0 @@
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#include "displaysettings.h"
#include "generalsettingspage.h"
#include "interactionsettings.h"
#include "storagesettings.h"
#include "tabsettings.h"
#include "ui_generalsettingspage.h"
#include <coreplugin/icore.h>
#include <QtCore/QSettings>
#include <QtCore/QDebug>
using namespace TextEditor;
struct GeneralSettingsPage::GeneralSettingsPagePrivate
{
explicit GeneralSettingsPagePrivate(const GeneralSettingsPageParameters &p);
const GeneralSettingsPageParameters m_parameters;
Ui::generalSettingsPage m_page;
TabSettings m_tabSettings;
StorageSettings m_storageSettings;
DisplaySettings m_displaySettings;
InteractionSettings m_interactionSettings;
};
GeneralSettingsPage::GeneralSettingsPagePrivate::GeneralSettingsPagePrivate
(const GeneralSettingsPageParameters &p)
: m_parameters(p)
{
if (const QSettings *s = Core::ICore::instance()->settings()) {
m_tabSettings.fromSettings(m_parameters.settingsPrefix, s);
m_storageSettings.fromSettings(m_parameters.settingsPrefix, s);
m_displaySettings.fromSettings(m_parameters.settingsPrefix, s);
m_interactionSettings.fromSettings(m_parameters.settingsPrefix, s);
}
}
GeneralSettingsPage::GeneralSettingsPage(const GeneralSettingsPageParameters &p,
QObject *parent)
: Core::IOptionsPage(parent),
m_d(new GeneralSettingsPagePrivate(p))
{
}
GeneralSettingsPage::~GeneralSettingsPage()
{
delete m_d;
}
QString GeneralSettingsPage::name() const
{
return m_d->m_parameters.name;
}
QString GeneralSettingsPage::category() const
{
return m_d->m_parameters.category;
}
QString GeneralSettingsPage::trCategory() const
{
return m_d->m_parameters.trCategory;
}
QWidget *GeneralSettingsPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_d->m_page.setupUi(w);
settingsToUI();
return w;
}
void GeneralSettingsPage::apply()
{
TabSettings newTabSettings;
StorageSettings newStorageSettings;
DisplaySettings newDisplaySettings;
InteractionSettings newInteractionSettings;
settingsFromUI(newTabSettings, newStorageSettings, newDisplaySettings,
newInteractionSettings);
Core::ICore *core = Core::ICore::instance();
QSettings *s = core->settings();
if (newTabSettings != m_d->m_tabSettings) {
m_d->m_tabSettings = newTabSettings;
if (s)
m_d->m_tabSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
emit tabSettingsChanged(newTabSettings);
}
if (newStorageSettings != m_d->m_storageSettings) {
m_d->m_storageSettings = newStorageSettings;
if (s)
m_d->m_storageSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
emit storageSettingsChanged(newStorageSettings);
}
if (newDisplaySettings != m_d->m_displaySettings) {
m_d->m_displaySettings = newDisplaySettings;
if (s)
m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s);
emit displaySettingsChanged(newDisplaySettings);
}
if (newInteractionSettings != m_d->m_interactionSettings) {
m_d->m_interactionSettings = newInteractionSettings;
if (s)
m_d->m_interactionSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
}
}
void GeneralSettingsPage::settingsFromUI(TabSettings &rc,
StorageSettings &storageSettings,
DisplaySettings &displaySettings,
InteractionSettings &interactionSettings) const
{
rc.m_spacesForTabs = m_d->m_page.insertSpaces->isChecked();
rc.m_autoIndent = m_d->m_page.autoIndent->isChecked();
rc.m_smartBackspace = m_d->m_page.smartBackspace->isChecked();
rc.m_tabSize = m_d->m_page.tabSize->value();
rc.m_indentSize = m_d->m_page.indentSize->value();
storageSettings.m_cleanWhitespace = m_d->m_page.cleanWhitespace->isChecked();
storageSettings.m_inEntireDocument = m_d->m_page.inEntireDocument->isChecked();
storageSettings.m_cleanIndentation = m_d->m_page.cleanIndentation->isChecked();
storageSettings.m_addFinalNewLine = m_d->m_page.addFinalNewLine->isChecked();
displaySettings.m_displayLineNumbers = m_d->m_page.displayLineNumbers->isChecked();
displaySettings.m_textWrapping = m_d->m_page.enableTextWrapping->isChecked();
displaySettings.m_showWrapColumn = m_d->m_page.showWrapColumn->isChecked();
displaySettings.m_wrapColumn = m_d->m_page.wrapColumn->value();
displaySettings.m_visualizeWhitespace = m_d->m_page.visualizeWhitespace->isChecked();
displaySettings.m_displayFoldingMarkers = m_d->m_page.displayFoldingMarkers->isChecked();
displaySettings.m_highlightCurrentLine = m_d->m_page.highlightCurrentLine->isChecked();
interactionSettings.m_useVim = m_d->m_page.useVim->isChecked();
}
void GeneralSettingsPage::settingsToUI()
{
TabSettings rc = m_d->m_tabSettings;
m_d->m_page.insertSpaces->setChecked(rc.m_spacesForTabs);
m_d->m_page.autoIndent->setChecked(rc.m_autoIndent);
m_d->m_page.smartBackspace->setChecked(rc.m_smartBackspace);
m_d->m_page.tabSize->setValue(rc.m_tabSize);
m_d->m_page.indentSize->setValue(rc.m_indentSize);
StorageSettings storageSettings = m_d->m_storageSettings;
m_d->m_page.cleanWhitespace->setChecked(storageSettings.m_cleanWhitespace);
m_d->m_page.inEntireDocument->setChecked(storageSettings.m_inEntireDocument);
m_d->m_page.cleanIndentation->setChecked(storageSettings.m_cleanIndentation);
m_d->m_page.addFinalNewLine->setChecked(storageSettings.m_addFinalNewLine);
DisplaySettings displaySettings = m_d->m_displaySettings;
m_d->m_page.displayLineNumbers->setChecked(displaySettings.m_displayLineNumbers);
m_d->m_page.enableTextWrapping->setChecked(displaySettings.m_textWrapping);
m_d->m_page.showWrapColumn->setChecked(displaySettings.m_showWrapColumn);
m_d->m_page.wrapColumn->setValue(displaySettings.m_wrapColumn);
m_d->m_page.visualizeWhitespace->setChecked(displaySettings.m_visualizeWhitespace);
m_d->m_page.displayFoldingMarkers->setChecked(displaySettings.m_displayFoldingMarkers);
m_d->m_page.highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine);
InteractionSettings interactionSettings = m_d->m_interactionSettings;
m_d->m_page.useVim->setChecked(interactionSettings.m_useVim);
}
TabSettings GeneralSettingsPage::tabSettings() const
{
return m_d->m_tabSettings;
}
StorageSettings GeneralSettingsPage::storageSettings() const
{
return m_d->m_storageSettings;
}
DisplaySettings GeneralSettingsPage::displaySettings() const
{
return m_d->m_displaySettings;
}
InteractionSettings GeneralSettingsPage::interactionSettings() const
{
return m_d->m_interactionSettings;
}
void GeneralSettingsPage::setDisplaySettings(const DisplaySettings &newDisplaySettings)
{
if (newDisplaySettings != m_d->m_displaySettings) {
m_d->m_displaySettings = newDisplaySettings;
Core::ICore *core = Core::ICore::instance();
if (QSettings *s = core->settings())
m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s);
emit displaySettingsChanged(newDisplaySettings);
}
}

View File

@@ -9,6 +9,7 @@ SOURCES += texteditorplugin.cpp \
plaintexteditorfactory.cpp \ plaintexteditorfactory.cpp \
basetextdocument.cpp \ basetextdocument.cpp \
basetexteditor.cpp \ basetexteditor.cpp \
behaviorsettingspage.cpp \
texteditoractionhandler.cpp \ texteditoractionhandler.cpp \
completionsupport.cpp \ completionsupport.cpp \
completionwidget.cpp \ completionwidget.cpp \
@@ -17,10 +18,10 @@ SOURCES += texteditorplugin.cpp \
tabsettings.cpp \ tabsettings.cpp \
storagesettings.cpp \ storagesettings.cpp \
displaysettings.cpp \ displaysettings.cpp \
displaysettingspage.cpp \
fontsettings.cpp \ fontsettings.cpp \
textblockiterator.cpp \ textblockiterator.cpp \
linenumberfilter.cpp \ linenumberfilter.cpp \
generalsettingspage.cpp \
basetextmark.cpp \ basetextmark.cpp \
findinfiles.cpp \ findinfiles.cpp \
basefilefind.cpp \ basefilefind.cpp \
@@ -32,6 +33,7 @@ HEADERS += texteditorplugin.h \
plaintexteditorfactory.h \ plaintexteditorfactory.h \
basetexteditor_p.h \ basetexteditor_p.h \
basetextdocument.h \ basetextdocument.h \
behaviorsettingspage.h \
completionsupport.h \ completionsupport.h \
completionwidget.h \ completionwidget.h \
basetexteditor.h \ basetexteditor.h \
@@ -43,18 +45,19 @@ HEADERS += texteditorplugin.h \
tabsettings.h \ tabsettings.h \
storagesettings.h \ storagesettings.h \
displaysettings.h \ displaysettings.h \
displaysettingspage.h \
fontsettings.h \ fontsettings.h \
textblockiterator.h \ textblockiterator.h \
itexteditable.h \ itexteditable.h \
itexteditor.h \ itexteditor.h \
linenumberfilter.h \ linenumberfilter.h \
texteditor_global.h \ texteditor_global.h \
generalsettingspage.h \
basetextmark.h \ basetextmark.h \
findinfiles.h \ findinfiles.h \
basefilefind.h \ basefilefind.h \
texteditorsettings.h \ texteditorsettings.h \
codecselector.h codecselector.h
FORMS += fontsettingspage.ui \ FORMS += behaviorsettingspage.ui \
generalsettingspage.ui displaysettingspage.ui \
fontsettingspage.ui
RESOURCES += texteditor.qrc RESOURCES += texteditor.qrc

View File

@@ -33,8 +33,9 @@
#include "texteditorsettings.h" #include "texteditorsettings.h"
#include "behaviorsettingspage.h"
#include "displaysettings.h" #include "displaysettings.h"
#include "generalsettingspage.h" #include "displaysettingspage.h"
#include "fontsettingspage.h" #include "fontsettingspage.h"
#include "storagesettings.h" #include "storagesettings.h"
#include "tabsettings.h" #include "tabsettings.h"
@@ -93,34 +94,43 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
m_fontSettingsPage = new FontSettingsPage(formatDescriptions, m_fontSettingsPage = new FontSettingsPage(formatDescriptions,
QLatin1String("TextEditor"), QLatin1String("TextEditor"),
tr("Text Editor")); tr("Text Editor"),
this);
pm->addObject(m_fontSettingsPage); pm->addObject(m_fontSettingsPage);
// Add the GUI used to configure the tab, storage and display settings // Add the GUI used to configure the tab, storage and interaction settings
TextEditor::GeneralSettingsPageParameters generalSettingsPageParameters; TextEditor::BehaviorSettingsPageParameters behaviorSettingsPageParameters;
generalSettingsPageParameters.name = tr("General"); behaviorSettingsPageParameters.name = tr("Behavior");
generalSettingsPageParameters.category = QLatin1String("TextEditor"); behaviorSettingsPageParameters.category = QLatin1String("TextEditor");
generalSettingsPageParameters.trCategory = tr("Text Editor"); behaviorSettingsPageParameters.trCategory = tr("Text Editor");
generalSettingsPageParameters.settingsPrefix = QLatin1String("text"); behaviorSettingsPageParameters.settingsPrefix = QLatin1String("text");
m_generalSettingsPage = new GeneralSettingsPage(generalSettingsPageParameters, this); m_behaviorSettingsPage = new BehaviorSettingsPage(behaviorSettingsPageParameters, this);
pm->addObject(m_generalSettingsPage); pm->addObject(m_behaviorSettingsPage);
TextEditor::DisplaySettingsPageParameters displaySettingsPageParameters;
displaySettingsPageParameters.name = tr("Display");
displaySettingsPageParameters.category = QLatin1String("TextEditor");
displaySettingsPageParameters.trCategory = tr("Text Editor");
displaySettingsPageParameters.settingsPrefix = QLatin1String("text");
m_displaySettingsPage = new DisplaySettingsPage(displaySettingsPageParameters, this);
pm->addObject(m_displaySettingsPage);
connect(m_fontSettingsPage, SIGNAL(changed(TextEditor::FontSettings)), connect(m_fontSettingsPage, SIGNAL(changed(TextEditor::FontSettings)),
this, SIGNAL(fontSettingsChanged(TextEditor::FontSettings))); this, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)));
connect(m_generalSettingsPage, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)), connect(m_behaviorSettingsPage, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)),
this, SIGNAL(tabSettingsChanged(TextEditor::TabSettings))); this, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)));
connect(m_generalSettingsPage, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)), connect(m_behaviorSettingsPage, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)),
this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings))); this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)));
connect(m_generalSettingsPage, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)), connect(m_displaySettingsPage, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings))); this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)));
} }
TextEditorSettings::~TextEditorSettings() TextEditorSettings::~TextEditorSettings()
{ {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
pm->removeObject(m_generalSettingsPage);
pm->removeObject(m_fontSettingsPage); pm->removeObject(m_fontSettingsPage);
delete m_fontSettingsPage; pm->removeObject(m_behaviorSettingsPage);
pm->removeObject(m_displaySettingsPage);
m_instance = 0; m_instance = 0;
} }
@@ -137,15 +147,15 @@ FontSettings TextEditorSettings::fontSettings() const
TabSettings TextEditorSettings::tabSettings() const TabSettings TextEditorSettings::tabSettings() const
{ {
return m_generalSettingsPage->tabSettings(); return m_behaviorSettingsPage->tabSettings();
} }
StorageSettings TextEditorSettings::storageSettings() const StorageSettings TextEditorSettings::storageSettings() const
{ {
return m_generalSettingsPage->storageSettings(); return m_behaviorSettingsPage->storageSettings();
} }
DisplaySettings TextEditorSettings::displaySettings() const DisplaySettings TextEditorSettings::displaySettings() const
{ {
return m_generalSettingsPage->displaySettings(); return m_displaySettingsPage->displaySettings();
} }

View File

@@ -40,7 +40,8 @@
namespace TextEditor { namespace TextEditor {
class GeneralSettingsPage; class BehaviorSettingsPage;
class DisplaySettingsPage;
class FontSettingsPage; class FontSettingsPage;
class FontSettings; class FontSettings;
struct TabSettings; struct TabSettings;
@@ -74,8 +75,9 @@ signals:
void displaySettingsChanged(const TextEditor::DisplaySettings &); void displaySettingsChanged(const TextEditor::DisplaySettings &);
private: private:
TextEditor::FontSettingsPage *m_fontSettingsPage; FontSettingsPage *m_fontSettingsPage;
TextEditor::GeneralSettingsPage *m_generalSettingsPage; BehaviorSettingsPage *m_behaviorSettingsPage;
DisplaySettingsPage *m_displaySettingsPage;
static TextEditorSettings *m_instance; static TextEditorSettings *m_instance;
}; };

View File

@@ -151,21 +151,28 @@ void QrcEditor::updateCurrent()
const bool isValid = m_treeview->currentIndex().isValid(); const bool isValid = m_treeview->currentIndex().isValid();
const bool isPrefix = m_treeview->isPrefix(m_treeview->currentIndex()) && isValid; const bool isPrefix = m_treeview->isPrefix(m_treeview->currentIndex()) && isValid;
const bool isFile = !isPrefix && isValid; const bool isFile = !isPrefix && isValid;
int cursorPosition;
m_ui.aliasLabel->setEnabled(isFile); m_ui.aliasLabel->setEnabled(isFile);
m_ui.aliasText->setEnabled(isFile); m_ui.aliasText->setEnabled(isFile);
m_currentAlias = m_treeview->currentAlias(); m_currentAlias = m_treeview->currentAlias();
cursorPosition = m_ui.aliasText->cursorPosition();
m_ui.aliasText->setText(m_currentAlias); m_ui.aliasText->setText(m_currentAlias);
m_ui.aliasText->setCursorPosition(cursorPosition);
m_ui.prefixLabel->setEnabled(isPrefix); m_ui.prefixLabel->setEnabled(isPrefix);
m_ui.prefixText->setEnabled(isPrefix); m_ui.prefixText->setEnabled(isPrefix);
m_currentPrefix = m_treeview->currentPrefix(); m_currentPrefix = m_treeview->currentPrefix();
cursorPosition = m_ui.prefixText->cursorPosition();
m_ui.prefixText->setText(m_currentPrefix); m_ui.prefixText->setText(m_currentPrefix);
m_ui.prefixText->setCursorPosition(cursorPosition);
m_ui.languageLabel->setEnabled(isPrefix); m_ui.languageLabel->setEnabled(isPrefix);
m_ui.languageText->setEnabled(isPrefix); m_ui.languageText->setEnabled(isPrefix);
m_currentLanguage = m_treeview->currentLanguage(); m_currentLanguage = m_treeview->currentLanguage();
cursorPosition = m_ui.languageText->cursorPosition();
m_ui.languageText->setText(m_currentLanguage); m_ui.languageText->setText(m_currentLanguage);
m_ui.languageText->setCursorPosition(cursorPosition);
m_ui.addButton->setEnabled(true); m_ui.addButton->setEnabled(true);
m_addFileAction->setEnabled(isValid); m_addFileAction->setEnabled(isValid);

View File

@@ -17,8 +17,8 @@ class Proxy : public QObject
Q_OBJECT Q_OBJECT
public: public:
Proxy(QWidget *widget, QObject *parent = 0) Proxy(QWidget *widget, QMainWindow *mw, QObject *parent = 0)
: QObject(parent), m_widget(widget) : QObject(parent), m_widget(widget), m_mainWindow(mw)
{} {}
public slots: public slots:
@@ -30,13 +30,35 @@ public slots:
ed->setExtraSelections(s); ed->setExtraSelections(s);
} }
void changeStatusData(const QString &info)
{
m_statusData = info;
updateStatusBar();
}
void changeStatusMessage(const QString &info)
{
m_statusMessage = info;
updateStatusBar();
}
void changeExtraInformation(const QString &info) void changeExtraInformation(const QString &info)
{ {
QMessageBox::information(m_widget, "Information", info); QMessageBox::information(m_widget, "Information", info);
} }
void updateStatusBar()
{
int slack = 80 - m_statusMessage.size() - m_statusData.size();
QString msg = m_statusMessage + QString(slack, QChar(' ')) + m_statusData;
m_mainWindow->statusBar()->showMessage(msg);
}
private: private:
QWidget *m_widget; QWidget *m_widget;
QMainWindow *m_mainWindow;
QString m_statusMessage;
QString m_statusData;
}; };
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@@ -64,11 +86,11 @@ int main(int argc, char *argv[])
//widget->resize(450, 350); //widget->resize(450, 350);
widget->setFocus(); widget->setFocus();
Proxy proxy(widget); QMainWindow mw;
Proxy proxy(widget, &mw);
FakeVimHandler handler(widget, 0); FakeVimHandler handler(widget, 0);
QMainWindow mw;
mw.setWindowTitle("Fakevim (" + title + ")"); mw.setWindowTitle("Fakevim (" + title + ")");
mw.setCentralWidget(widget); mw.setCentralWidget(widget);
mw.resize(600, 650); mw.resize(600, 650);
@@ -85,15 +107,16 @@ int main(int argc, char *argv[])
mw.statusBar()->setFont(font); mw.statusBar()->setFont(font);
QObject::connect(&handler, SIGNAL(commandBufferChanged(QString)), QObject::connect(&handler, SIGNAL(commandBufferChanged(QString)),
mw.statusBar(), SLOT(showMessage(QString))); &proxy, SLOT(changeStatusMessage(QString)));
QObject::connect(&handler, SIGNAL(quitRequested()), QObject::connect(&handler, SIGNAL(quitRequested()),
&app, SLOT(quit())); &app, SLOT(quit()));
QObject::connect(&handler, QObject::connect(&handler,
SIGNAL(selectionChanged(QList<QTextEdit::ExtraSelection>)), SIGNAL(selectionChanged(QList<QTextEdit::ExtraSelection>)),
&proxy, SLOT(changeSelection(QList<QTextEdit::ExtraSelection>))); &proxy, SLOT(changeSelection(QList<QTextEdit::ExtraSelection>)));
QObject::connect(&handler, QObject::connect(&handler, SIGNAL(extraInformationChanged(QString)),
SIGNAL(extraInformationChanged(QString)),
&proxy, SLOT(changeExtraInformation(QString))); &proxy, SLOT(changeExtraInformation(QString)));
QObject::connect(&handler, SIGNAL(statusDataChanged(QString)),
&proxy, SLOT(changeStatusData(QString)));
handler.setupWidget(); handler.setupWidget();
if (args.size() >= 1) if (args.size() >= 1)

View File

@@ -145,14 +145,33 @@ void testQByteArray()
void testQHash() void testQHash()
{ {
#if 1
QHash<int, float> hgg0; QHash<int, float> hgg0;
hgg0[11] = 11.0; hgg0[11] = 11.0;
hgg0[22] = 22.0; hgg0[22] = 22.0;
hgg0[22] = 22.0;
hgg0[22] = 22.0;
hgg0[22] = 22.0;
hgg0[22] = 22.0;
hgg0[22] = 22.0;
#endif
#if 1
QHash<QString, float> hgg1; QHash<QString, float> hgg1;
hgg1["22.0"] = 22.0; hgg1["22.0"] = 22.0;
hgg1["23.0"] = 22.0;
hgg1["24.0"] = 22.0;
hgg1["25.0"] = 22.0;
hgg1["26.0"] = 22.0;
hgg1["27.0"] = 27.0;
hgg1["28.0"] = 28.0;
hgg1["29.0"] = 29.0;
#endif
#if 1
QHash<int, QString> hgg2; QHash<int, QString> hgg2;
hgg2[22] = "22.0"; hgg2[22] = "22.0";
@@ -165,6 +184,7 @@ void testQHash()
hash.insert("Hallo", QPointer<QObject>(&ob)); hash.insert("Hallo", QPointer<QObject>(&ob));
hash.insert("Welt", QPointer<QObject>(&ob)); hash.insert("Welt", QPointer<QObject>(&ob));
hash.insert(".", QPointer<QObject>(&ob)); hash.insert(".", QPointer<QObject>(&ob));
#endif
} }
void testQImage() void testQImage()
@@ -224,7 +244,6 @@ void testQLinkedList()
f.append(Foo(1)); f.append(Foo(1));
f.append(Foo(2)); f.append(Foo(2));
#endif #endif
QLinkedList<std::string> v; QLinkedList<std::string> v;
v.push_back("aa"); v.push_back("aa");
v.push_back("bb"); v.push_back("bb");
@@ -238,7 +257,7 @@ void testQList()
QList<int> li; QList<int> li;
QList<uint> lu; QList<uint> lu;
for (int i = 0; i != 3; ++i) { for (int i = 0; i != 30; ++i) {
li.append(i); li.append(i);
} }
li.append(101); li.append(101);