Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
Conflicts: src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -109,7 +109,7 @@ int qtGhVersion = QT_VERSION;
|
||||
|
||||
|
||||
'P(d, name, value)' roughly expands to:
|
||||
d << (name) << "='" << value << "'";
|
||||
d << (name) << "=\"" << value << "\"";
|
||||
|
||||
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)
|
||||
{
|
||||
return isSimpleType(type) || isEqual(type, "QString");
|
||||
return isSimpleType(type) || isEqual(type, NS"QString");
|
||||
}
|
||||
|
||||
static bool isMovableType(const char *type)
|
||||
@@ -551,11 +551,11 @@ void QDumper::addCommaIfNeeded()
|
||||
if (pos == 0)
|
||||
return;
|
||||
char c = qDumpOutBuffer[pos - 1];
|
||||
if (c == '}' || c == '\'' || c == ']')
|
||||
if (c == '}' || c == '"' || c == ']')
|
||||
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"
|
||||
"ghijklmn" "opqrstuv" "wxyz0123" "456789+/";
|
||||
@@ -630,7 +630,7 @@ void QDumper::endHash()
|
||||
void QDumper::putEllipsis()
|
||||
{
|
||||
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) \
|
||||
do { \
|
||||
dumper.addCommaIfNeeded(); \
|
||||
dumper << (name) << "='" << value << "'"; \
|
||||
dumper << (name) << "=\"" << value << "\""; \
|
||||
} while (0)
|
||||
|
||||
// simple string property
|
||||
@@ -704,44 +704,44 @@ static void qDumpUnknown(QDumper &d)
|
||||
}
|
||||
|
||||
static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr,
|
||||
const char *key = "value")
|
||||
const char *field = "value")
|
||||
{
|
||||
type = stripNamespace(type);
|
||||
switch (type[1]) {
|
||||
case 'l':
|
||||
if (isEqual(type, "float"))
|
||||
P(d, key, *(float*)addr);
|
||||
P(d, field, *(float*)addr);
|
||||
return;
|
||||
case 'n':
|
||||
if (isEqual(type, "int"))
|
||||
P(d, key, *(int*)addr);
|
||||
P(d, field, *(int*)addr);
|
||||
else if (isEqual(type, "unsigned"))
|
||||
P(d, key, *(unsigned int*)addr);
|
||||
P(d, field, *(unsigned int*)addr);
|
||||
else if (isEqual(type, "unsigned int"))
|
||||
P(d, key, *(unsigned int*)addr);
|
||||
P(d, field, *(unsigned int*)addr);
|
||||
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"))
|
||||
P(d, key, *(qulonglong*)addr);
|
||||
P(d, field, *(qulonglong*)addr);
|
||||
return;
|
||||
case 'o':
|
||||
if (isEqual(type, "bool"))
|
||||
switch (*(bool*)addr) {
|
||||
case 0: P(d, key, "false"); break;
|
||||
case 1: P(d, key, "true"); break;
|
||||
default: P(d, key, *(bool*)addr); break;
|
||||
case 0: P(d, field, "false"); break;
|
||||
case 1: P(d, field, "true"); break;
|
||||
default: P(d, field, *(bool*)addr); break;
|
||||
}
|
||||
else if (isEqual(type, "double"))
|
||||
P(d, key, *(double*)addr);
|
||||
P(d, field, *(double*)addr);
|
||||
else if (isEqual(type, "long"))
|
||||
P(d, key, *(long*)addr);
|
||||
P(d, field, *(long*)addr);
|
||||
else if (isEqual(type, "long long"))
|
||||
P(d, key, *(qulonglong*)addr);
|
||||
P(d, field, *(qulonglong*)addr);
|
||||
return;
|
||||
case 'B':
|
||||
if (isEqual(type, "QByteArray")) {
|
||||
d << key << "encoded='1',";
|
||||
P(d, key, *(QByteArray*)addr);
|
||||
d << field << "encoded=\"1\",";
|
||||
P(d, field, *(QByteArray*)addr);
|
||||
}
|
||||
return;
|
||||
case 'L':
|
||||
@@ -769,8 +769,8 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr
|
||||
return;
|
||||
case 'S':
|
||||
if (isEqual(type, "QString")) {
|
||||
d << key << "encoded='1',";
|
||||
P(d, key, *(QString*)addr);
|
||||
d << field << "encoded=\"1\",";
|
||||
P(d, field, *(QString*)addr);
|
||||
}
|
||||
return;
|
||||
default:
|
||||
@@ -839,7 +839,7 @@ static void qDumpQByteArray(QDumper &d)
|
||||
unsigned char u = (isprint(c) && c != '\'' && c != '"') ? c : '?';
|
||||
sprintf(buf, "%02x (%u '%c')", c, c, u);
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "name", i);
|
||||
P(d, "value", buf);
|
||||
d.endHash();
|
||||
}
|
||||
@@ -1104,14 +1104,14 @@ static void qDumpQHash(QDumper &d)
|
||||
while (node != end) {
|
||||
d.beginHash();
|
||||
if (simpleKey) {
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "name", i);
|
||||
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
|
||||
if (simpleValue)
|
||||
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
|
||||
P(d, "type", valueType);
|
||||
P(d, "addr", addOffset(node, valueOffset));
|
||||
} else {
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "name", i);
|
||||
//P(d, "exp", "*(char*)" << node);
|
||||
P(d, "exp", "*('"NS"QHashNode<" << keyType << "," << valueType << " >'*)" << node);
|
||||
P(d, "type", "'"NS"QHashNode<" << keyType << "," << valueType << " >'");
|
||||
@@ -1215,7 +1215,7 @@ static void qDumpQList(QDumper &d)
|
||||
d << ",children=[";
|
||||
for (int i = 0; i != n; ++i) {
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "name", i);
|
||||
if (innerTypeIsPointer) {
|
||||
void *p = ldata.d->array + i + pdata->begin;
|
||||
if (p) {
|
||||
@@ -1275,7 +1275,7 @@ static void qDumpQLinkedList(QDumper &d)
|
||||
const void *p = deref(ldata);
|
||||
for (int i = 0; i != n; ++i) {
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "name", i);
|
||||
const void *addr = addOffset(p, 2 * sizeof(void*));
|
||||
qDumpInnerValueOrPointer(d, d.innertype, stripped, addr);
|
||||
p = deref(p);
|
||||
@@ -1414,7 +1414,7 @@ static void qDumpQMap(QDumper &d)
|
||||
|
||||
while (node != end) {
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "name", i);
|
||||
if (simpleKey) {
|
||||
P(d, "type", valueType);
|
||||
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
|
||||
@@ -1660,7 +1660,7 @@ static void qDumpQObjectMethodList(QDumper &d)
|
||||
const QMetaMethod & method = mo->method(i);
|
||||
int mt = method.methodType();
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "] " << mo->indexOfMethod(method.signature())
|
||||
P(d, "name", i << " " << mo->indexOfMethod(method.signature())
|
||||
<< " " << method.signature());
|
||||
P(d, "value", (mt == QMetaMethod::Signal ? "<Signal>" : "<Slot>") << " (" << mt << ")");
|
||||
d.endHash();
|
||||
@@ -1712,11 +1712,11 @@ static void qDumpQObjectSignal(QDumper &d)
|
||||
for (int i = 0; i != connList.size(); ++i) {
|
||||
const QObjectPrivate::Connection &conn = connList.at(i);
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "] receiver");
|
||||
P(d, "name", i << " receiver");
|
||||
qDumpInnerValueHelper(d, NS"QObject *", conn.receiver);
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "] slot");
|
||||
P(d, "name", i << " slot");
|
||||
P(d, "type", "");
|
||||
if (conn.receiver)
|
||||
P(d, "value", conn.receiver->metaObject()->method(conn.method).signature());
|
||||
@@ -1725,7 +1725,7 @@ static void qDumpQObjectSignal(QDumper &d)
|
||||
P(d, "numchild", "0");
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "] type");
|
||||
P(d, "name", i << " type");
|
||||
P(d, "type", "");
|
||||
P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>");
|
||||
P(d, "numchild", "0");
|
||||
@@ -1756,7 +1756,7 @@ static void qDumpQObjectSignalList(QDumper &d)
|
||||
int k = mo->indexOfSignal(method.signature());
|
||||
const QObjectPrivate::ConnectionList &connList = qConnectionList(ob, k);
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << k << "]");
|
||||
P(d, "name", k);
|
||||
P(d, "value", method.signature());
|
||||
P(d, "numchild", connList.size());
|
||||
//P(d, "numchild", "1");
|
||||
@@ -1796,17 +1796,17 @@ static void qDumpQObjectSlot(QDumper &d)
|
||||
const QMetaMethod & method =
|
||||
sender.sender->metaObject()->method(sender.signal);
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << s << "] sender");
|
||||
P(d, "name", s << " sender");
|
||||
qDumpInnerValueHelper(d, NS"QObject *", sender.sender);
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << s << "] signal");
|
||||
P(d, "name", s << " signal");
|
||||
P(d, "type", "");
|
||||
P(d, "value", method.signature());
|
||||
P(d, "numchild", "0");
|
||||
d.endHash();
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << s << "] type");
|
||||
P(d, "name", s << " type");
|
||||
P(d, "type", "");
|
||||
P(d, "value", "<" << qConnectionTypes[conn.method] << " connection>");
|
||||
P(d, "numchild", "0");
|
||||
@@ -1843,7 +1843,7 @@ static void qDumpQObjectSlotList(QDumper &d)
|
||||
if (method.methodType() == QMetaMethod::Slot) {
|
||||
d.beginHash();
|
||||
int k = mo->indexOfSlot(method.signature());
|
||||
P(d, "name", "[" << k << "]");
|
||||
P(d, "name", k);
|
||||
P(d, "value", method.signature());
|
||||
|
||||
// count senders. expensive...
|
||||
@@ -1911,7 +1911,7 @@ static void qDumpQSet(QDumper &d)
|
||||
for (int bucket = 0; bucket != hd->numBuckets && i <= 10000; ++bucket) {
|
||||
for (node = hd->buckets[bucket]; node->next; node = node->next) {
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "name", i);
|
||||
P(d, "type", d.innertype);
|
||||
P(d, "exp", "(('"NS"QHashNode<" << d.innertype
|
||||
<< ","NS"QHashDummyValue>'*)"
|
||||
@@ -1970,7 +1970,7 @@ static void qDumpQStringList(QDumper &d)
|
||||
d << ",children=[";
|
||||
for (int i = 0; i != n; ++i) {
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "name", i);
|
||||
P(d, "value", list[i]);
|
||||
P(d, "valueencoded", "1");
|
||||
d.endHash();
|
||||
@@ -2008,7 +2008,7 @@ static void qDumpQVariantHelper(const void *data, QString *value,
|
||||
*numchild = 0;
|
||||
break;
|
||||
case QVariant::String:
|
||||
*value = QLatin1Char('\'') + v.toString() + QLatin1Char('\'');
|
||||
*value = QLatin1Char('"') + v.toString() + QLatin1Char('"');
|
||||
*numchild = 0;
|
||||
break;
|
||||
case QVariant::StringList:
|
||||
@@ -2108,7 +2108,7 @@ static void qDumpQVector(QDumper &d)
|
||||
d << ",children=[";
|
||||
for (int i = 0; i != n; ++i) {
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "name", i);
|
||||
qDumpInnerValueOrPointer(d, d.innertype, stripped,
|
||||
addOffset(v, i * innersize + typeddatasize));
|
||||
d.endHash();
|
||||
@@ -2156,7 +2156,7 @@ static void qDumpStdList(QDumper &d)
|
||||
it = list.begin();
|
||||
for (int i = 0; i < 1000 && it != list.end(); ++i, ++it) {
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "name", i);
|
||||
qDumpInnerValueOrPointer(d, d.innertype, stripped, it.operator->());
|
||||
d.endHash();
|
||||
}
|
||||
@@ -2218,7 +2218,7 @@ static void qDumpStdMap(QDumper &d)
|
||||
d.endHash();
|
||||
} else {
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "name", i);
|
||||
P(d, "addr", it.operator->());
|
||||
P(d, "type", pairType);
|
||||
d.endHash();
|
||||
@@ -2240,9 +2240,9 @@ static void qDumpStdString(QDumper &d)
|
||||
qCheckAccess(str.c_str() + str.size() - 1);
|
||||
}
|
||||
|
||||
d << ",value='";
|
||||
d << ",value=\"";
|
||||
d.putBase64Encoded(str.c_str(), str.size());
|
||||
d << "'";
|
||||
d << "\"";
|
||||
P(d, "valueencoded", "1");
|
||||
P(d, "type", "std::string");
|
||||
P(d, "numchild", "0");
|
||||
@@ -2305,7 +2305,7 @@ static void qDumpStdVector(QDumper &d)
|
||||
d << ",children=[";
|
||||
for (int i = 0; i != n; ++i) {
|
||||
d.beginHash();
|
||||
P(d, "name", "[" << i << "]");
|
||||
P(d, "name", i);
|
||||
qDumpInnerValueOrPointer(d, d.innertype, stripped,
|
||||
addOffset(v->start, i * innersize));
|
||||
d.endHash();
|
||||
@@ -2482,54 +2482,54 @@ void qDumpObjectData440(
|
||||
// They are mentioned here nevertheless. For types that not listed
|
||||
// here, dumpers won't be used.
|
||||
d << "dumpers=["
|
||||
"'"NS"QByteArray',"
|
||||
"'"NS"QDateTime',"
|
||||
"'"NS"QDir',"
|
||||
"'"NS"QFile',"
|
||||
"'"NS"QFileInfo',"
|
||||
"'"NS"QHash',"
|
||||
"'"NS"QHashNode',"
|
||||
"'"NS"QImage',"
|
||||
"'"NS"QLinkedList',"
|
||||
"'"NS"QList',"
|
||||
"'"NS"QLocale',"
|
||||
"'"NS"QMap',"
|
||||
"'"NS"QMapNode',"
|
||||
"'"NS"QModelIndex',"
|
||||
"\""NS"QByteArray\","
|
||||
"\""NS"QDateTime\","
|
||||
"\""NS"QDir\","
|
||||
"\""NS"QFile\","
|
||||
"\""NS"QFileInfo\","
|
||||
"\""NS"QHash\","
|
||||
"\""NS"QHashNode\","
|
||||
"\""NS"QImage\","
|
||||
"\""NS"QLinkedList\","
|
||||
"\""NS"QList\","
|
||||
"\""NS"QLocale\","
|
||||
"\""NS"QMap\","
|
||||
"\""NS"QMapNode\","
|
||||
"\""NS"QModelIndex\","
|
||||
#if QT_VERSION >= 0x040500
|
||||
"'"NS"QMultiMap',"
|
||||
"\""NS"QMultiMap\","
|
||||
#endif
|
||||
"'"NS"QObject',"
|
||||
"'"NS"QObjectMethodList'," // hack to get nested properties display
|
||||
"'"NS"QObjectPropertyList',"
|
||||
"\""NS"QObject\","
|
||||
"\""NS"QObjectMethodList\"," // hack to get nested properties display
|
||||
"\""NS"QObjectPropertyList\","
|
||||
#if PRIVATE_OBJECT_ALLOWED
|
||||
"'"NS"QObjectSignal',"
|
||||
"'"NS"QObjectSignalList',"
|
||||
"'"NS"QObjectSlot',"
|
||||
"'"NS"QObjectSlotList',"
|
||||
"\""NS"QObjectSignal\","
|
||||
"\""NS"QObjectSignalList\","
|
||||
"\""NS"QObjectSlot\","
|
||||
"\""NS"QObjectSlotList\","
|
||||
#endif // PRIVATE_OBJECT_ALLOWED
|
||||
// << "'"NS"QRegion',"
|
||||
"'"NS"QSet',"
|
||||
"'"NS"QString',"
|
||||
"'"NS"QStringList',"
|
||||
"'"NS"QTextCodec',"
|
||||
"'"NS"QVariant',"
|
||||
"'"NS"QVector',"
|
||||
"'"NS"QWidget',"
|
||||
"'string',"
|
||||
"'wstring',"
|
||||
"'std::basic_string',"
|
||||
"'std::list',"
|
||||
"'std::map',"
|
||||
"'std::string',"
|
||||
"'std::vector',"
|
||||
"'std::wstring',"
|
||||
// << "\""NS"QRegion\","
|
||||
"\""NS"QSet\","
|
||||
"\""NS"QString\","
|
||||
"\""NS"QStringList\","
|
||||
"\""NS"QTextCodec\","
|
||||
"\""NS"QVariant\","
|
||||
"\""NS"QVector\","
|
||||
"\""NS"QWidget\","
|
||||
"\"string\","
|
||||
"\"wstring\","
|
||||
"\"std::basic_string\","
|
||||
"\"std::list\","
|
||||
"\"std::map\","
|
||||
"\"std::string\","
|
||||
"\"std::vector\","
|
||||
"\"std::wstring\","
|
||||
"]";
|
||||
d << ",qtversion=["
|
||||
"'" << ((QT_VERSION >> 16) & 255) << "',"
|
||||
"'" << ((QT_VERSION >> 8) & 255) << "',"
|
||||
"'" << ((QT_VERSION) & 255) << "']";
|
||||
d << ",namespace='"NS"'";
|
||||
"\"" << ((QT_VERSION >> 16) & 255) << "\","
|
||||
"\"" << ((QT_VERSION >> 8) & 255) << "\","
|
||||
"\"" << ((QT_VERSION) & 255) << "\"]";
|
||||
d << ",namespace=\""NS"\"";
|
||||
d.disarm();
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@ macx {
|
||||
QMAKE_INFO_PLIST = $$PWD/qtcreator/Info.plist
|
||||
}
|
||||
|
||||
win32 {
|
||||
win32|linux-* {
|
||||
# make sure the resources are in place
|
||||
!exists($$OUT_PWD/app.pro) {
|
||||
unix:SEPARATOR = ;
|
||||
@@ -28,10 +28,11 @@ win32 {
|
||||
designer \
|
||||
schemes \
|
||||
gdbmacros
|
||||
COPYDEST = $${OUT_PWD}/../../bin
|
||||
COPYDEST = $${OUT_PWD}/../../share/qtcreator
|
||||
win32:COPYDEST ~= s|/+|\|
|
||||
QMAKE_POST_LINK += $${QMAKE_MKDIR} $$COPYDEST $$SEPARATOR
|
||||
for(tmp,COPYSRC) {
|
||||
REALSRC = $$PWD/$$tmp
|
||||
REALSRC = $$PWD/qtcreator/$$tmp
|
||||
REALDEST = $$COPYDEST/$$tmp
|
||||
win32:tmp ~= s|/+|\|
|
||||
win32:REALSRC ~= s|/+|\|
|
||||
|
@@ -51,10 +51,9 @@
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
|
||||
EditorSplitter::EditorSplitter(ICore *core, QWidget *parent)
|
||||
EditorSplitter::EditorSplitter(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_curGroup(0),
|
||||
m_core(core)
|
||||
m_curGroup(0)
|
||||
{
|
||||
registerActions();
|
||||
createRootGroup();
|
||||
@@ -69,9 +68,9 @@ void EditorSplitter::registerActions()
|
||||
{
|
||||
QList<int> gc = QList<int>() << Constants::C_GLOBAL_ID;
|
||||
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);
|
||||
Command *cmd;
|
||||
|
||||
@@ -541,13 +540,13 @@ QWidget *EditorSplitter::recreateGroupTree(QWidget *node)
|
||||
|
||||
void EditorSplitter::saveCurrentLayout()
|
||||
{
|
||||
QSettings *settings = m_core->settings();
|
||||
QSettings *settings = ICore::instance()->settings();
|
||||
settings->setValue("EditorManager/Splitting", saveState());
|
||||
}
|
||||
|
||||
void EditorSplitter::restoreDefaultLayout()
|
||||
{
|
||||
QSettings *settings = m_core->settings();
|
||||
QSettings *settings = ICore::instance()->settings();
|
||||
if (settings->contains("EditorManager/Splitting"))
|
||||
restoreState(settings->value("EditorManager/Splitting").toByteArray());
|
||||
}
|
||||
@@ -659,12 +658,12 @@ EditorGroup *EditorSplitter::createGroup()
|
||||
this, SLOT(updateActions()));
|
||||
connect(group, SIGNAL(editorAdded(Core::IEditor *)),
|
||||
this, SLOT(updateActions()));
|
||||
m_core->addContextObject(group->contextObject());
|
||||
ICore::instance()->addContextObject(group->contextObject());
|
||||
return group;
|
||||
}
|
||||
|
||||
void EditorSplitter::deleteGroup(EditorGroup *group)
|
||||
{
|
||||
m_core->removeContextObject(group->contextObject());
|
||||
ICore::instance()->removeContextObject(group->contextObject());
|
||||
delete group;
|
||||
}
|
||||
|
@@ -45,7 +45,6 @@
|
||||
namespace Core {
|
||||
|
||||
class EditorGroup;
|
||||
class ICore;
|
||||
class IEditor;
|
||||
|
||||
namespace Internal {
|
||||
@@ -55,7 +54,7 @@ class EditorSplitter : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
EditorSplitter(ICore *core, QWidget *parent = 0);
|
||||
explicit EditorSplitter(QWidget *parent = 0);
|
||||
~EditorSplitter();
|
||||
|
||||
void setCurrentGroup(Core::EditorGroup *group);
|
||||
@@ -114,7 +113,6 @@ private:
|
||||
|
||||
QWidget *m_root;
|
||||
EditorGroup *m_curGroup;
|
||||
ICore *m_core;
|
||||
|
||||
QAction *m_horizontalSplitAction;
|
||||
QAction *m_verticalSplitAction;
|
||||
|
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 472 B |
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 434 B |
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 483 B |
Before Width: | Height: | Size: 439 B After Width: | Height: | Size: 518 B |
Before Width: | Height: | Size: 440 B After Width: | Height: | Size: 466 B |
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 436 B |
@@ -120,7 +120,7 @@ MainWindow::MainWindow() :
|
||||
m_editorManager(0),
|
||||
m_fileManager(new FileManager(this)),
|
||||
m_progressManager(new ProgressManagerPrivate()),
|
||||
m_scriptManager(new ScriptManagerPrivate(this, m_coreImpl)),
|
||||
m_scriptManager(new ScriptManagerPrivate(this)),
|
||||
m_variableManager(new VariableManager(this)),
|
||||
m_vcsManager(new VCSManager()),
|
||||
m_viewManager(0),
|
||||
|
@@ -518,7 +518,8 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
|
||||
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
}
|
||||
#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);
|
||||
painter->fillRect(rect, lighter);
|
||||
painter->drawLine(rect.topRight(), rect.bottomRight());
|
||||
|
@@ -519,7 +519,7 @@ void OutputPaneToggleButton::paintEvent(QPaintEvent *event)
|
||||
QPushButton::paintEvent(event);
|
||||
|
||||
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);
|
||||
|
||||
QPainter p(this);
|
||||
|
@@ -99,6 +99,7 @@ void ProgressView::deleteTask(FutureProgress *progress)
|
||||
m_type.remove(progress);
|
||||
m_keep.remove(progress);
|
||||
layout()->removeWidget(progress);
|
||||
progress->hide();
|
||||
progress->deleteLater();
|
||||
}
|
||||
|
||||
|
@@ -181,10 +181,8 @@ static QScriptValue fileBox(QScriptContext *context, QScriptEngine *engine)
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
|
||||
ScriptManagerPrivate::ScriptManagerPrivate(QObject *parent, ICore *core) :
|
||||
ScriptManager(parent),
|
||||
m_core(core),
|
||||
m_initialized(false)
|
||||
ScriptManagerPrivate::ScriptManagerPrivate(QObject *parent)
|
||||
: ScriptManager(parent), m_initialized(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -250,7 +248,6 @@ void ScriptManagerPrivate::ensureEngineInitialized()
|
||||
{
|
||||
if (m_initialized)
|
||||
return;
|
||||
QTC_ASSERT(m_core, return);
|
||||
// register QObjects that occur as properties
|
||||
SharedTools::registerQObject<QMainWindow>(m_engine);
|
||||
SharedTools::registerQObject<QStatusBar>(m_engine);
|
||||
@@ -274,7 +271,7 @@ void ScriptManagerPrivate::ensureEngineInitialized()
|
||||
// SharedTools::registerQObjectInterface<Core::ICore, CorePrototype>(m_engine);
|
||||
|
||||
// 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);
|
||||
|
||||
|
@@ -37,13 +37,9 @@
|
||||
#include <coreplugin/scriptmanager/scriptmanager.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QList>
|
||||
#include <QtScript/QScriptEngine>
|
||||
|
||||
namespace Core {
|
||||
|
||||
class ICore;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class ScriptManagerPrivate : public Core::ScriptManager
|
||||
@@ -51,12 +47,11 @@ class ScriptManagerPrivate : public Core::ScriptManager
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ScriptManagerPrivate(QObject *parent, ICore *core);
|
||||
explicit ScriptManagerPrivate(QObject *parent);
|
||||
|
||||
virtual QScriptEngine &scriptEngine();
|
||||
|
||||
virtual bool runScript(const QString &script, QString *errorMessage, Stack *stack);
|
||||
virtual bool runScript(const QString &script, QString *errorMessage);
|
||||
QScriptEngine &scriptEngine();
|
||||
bool runScript(const QString &script, QString *errorMessage, Stack *stack);
|
||||
bool runScript(const QString &script, QString *errorMessage);
|
||||
|
||||
static QString engineError(QScriptEngine &scriptEngine);
|
||||
|
||||
@@ -64,7 +59,6 @@ private:
|
||||
void ensureEngineInitialized();
|
||||
|
||||
QScriptEngine m_engine;
|
||||
ICore *m_core;
|
||||
bool m_initialized;
|
||||
};
|
||||
|
||||
|
@@ -133,5 +133,6 @@
|
||||
<glob pattern="*.cxx"/>
|
||||
<glob pattern="*.c++"/>
|
||||
<glob pattern="*.C"/>
|
||||
<glob pattern="*.inl"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
|
@@ -15,33 +15,42 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="caseSensitive">
|
||||
<property name="text">
|
||||
<string>&Case-sensitive completion</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoInsertBraces">
|
||||
<property name="text">
|
||||
<string>&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 &prefix</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Completion Settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="caseSensitive">
|
||||
<property name="text">
|
||||
<string>&Case-sensitive completion</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoInsertBraces">
|
||||
<property name="text">
|
||||
<string>&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 &prefix</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@@ -74,9 +74,10 @@ using namespace CPlusPlus;
|
||||
namespace CppTools {
|
||||
namespace Internal {
|
||||
|
||||
class FunctionArgumentWidget : public QLabel {
|
||||
class FunctionArgumentWidget : public QLabel
|
||||
{
|
||||
public:
|
||||
FunctionArgumentWidget(Core::ICore *core);
|
||||
FunctionArgumentWidget();
|
||||
void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot);
|
||||
|
||||
protected:
|
||||
@@ -183,10 +184,10 @@ protected:
|
||||
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
FunctionArgumentWidget::FunctionArgumentWidget(Core::ICore *core)
|
||||
FunctionArgumentWidget::FunctionArgumentWidget()
|
||||
: m_item(0)
|
||||
{
|
||||
QObject *editorObject = core->editorManager()->currentEditor();
|
||||
QObject *editorObject = Core::ICore::instance()->editorManager()->currentEditor();
|
||||
m_editor = qobject_cast<TextEditor::ITextEditor *>(editorObject);
|
||||
|
||||
m_popupFrame = new QFrame(0, Qt::ToolTip|Qt::WindowStaysOnTopHint);
|
||||
@@ -311,9 +312,8 @@ void FunctionArgumentWidget::updateHintText()
|
||||
setText(text);
|
||||
}
|
||||
|
||||
CppCodeCompletion::CppCodeCompletion(CppModelManager *manager, Core::ICore *core)
|
||||
CppCodeCompletion::CppCodeCompletion(CppModelManager *manager)
|
||||
: ICompletionCollector(manager),
|
||||
m_core(core),
|
||||
m_manager(manager),
|
||||
m_caseSensitivity(Qt::CaseSensitive),
|
||||
m_autoInsertBraces(true),
|
||||
@@ -1030,7 +1030,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
|
||||
Function *function = symbol->type()->asFunction();
|
||||
QTC_ASSERT(function, return);
|
||||
|
||||
m_functionArgumentWidget = new FunctionArgumentWidget(m_core);
|
||||
m_functionArgumentWidget = new FunctionArgumentWidget();
|
||||
m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot());
|
||||
}
|
||||
} else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) {
|
||||
|
@@ -34,23 +34,17 @@
|
||||
#ifndef CPPCODECOMPLETION_H
|
||||
#define CPPCODECOMPLETION_H
|
||||
|
||||
// C++ front-end
|
||||
#include <ASTfwd.h>
|
||||
#include <FullySpecifiedType.h>
|
||||
#include <cplusplus/Icons.h>
|
||||
#include <cplusplus/Overview.h>
|
||||
#include <cplusplus/TypeOfExpression.h>
|
||||
|
||||
// Qt Creator
|
||||
#include <texteditor/icompletioncollector.h>
|
||||
|
||||
// Qt
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QPointer>
|
||||
|
||||
namespace Core {
|
||||
class ICore;
|
||||
}
|
||||
|
||||
namespace TextEditor {
|
||||
class ITextEditor;
|
||||
@@ -66,7 +60,7 @@ class CppCodeCompletion : public TextEditor::ICompletionCollector
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CppCodeCompletion(CppModelManager *manager, Core::ICore *core);
|
||||
explicit CppCodeCompletion(CppModelManager *manager);
|
||||
|
||||
bool triggersCompletion(TextEditor::ITextEditable *editor);
|
||||
int startCompletion(TextEditor::ITextEditable *editor);
|
||||
@@ -131,7 +125,6 @@ private:
|
||||
TextEditor::ITextEditable *m_editor;
|
||||
int m_startPosition; // Position of the cursor from which completion started
|
||||
|
||||
Core::ICore *m_core;
|
||||
CppModelManager *m_manager;
|
||||
Qt::CaseSensitivity m_caseSensitivity;
|
||||
bool m_autoInsertBraces;
|
||||
|
@@ -87,7 +87,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
// Objects
|
||||
m_modelManager = new CppModelManager(this);
|
||||
addAutoReleasedObject(m_modelManager);
|
||||
m_completion = new CppCodeCompletion(m_modelManager, core);
|
||||
m_completion = new CppCodeCompletion(m_modelManager);
|
||||
addAutoReleasedObject(m_completion);
|
||||
CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager,
|
||||
core->editorManager());
|
||||
|
@@ -888,7 +888,9 @@ void DebuggerManager::executeDebuggerCommand(const QString &command)
|
||||
|
||||
void DebuggerManager::sessionLoaded()
|
||||
{
|
||||
exitDebugger();
|
||||
cleanupViews();
|
||||
setStatus(DebuggerProcessNotReady);
|
||||
setBusyCursor(false);
|
||||
loadSessionData();
|
||||
}
|
||||
|
||||
@@ -1092,6 +1094,28 @@ bool DebuggerManager::useFastStart() const
|
||||
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,
|
||||
QObject **object)
|
||||
{
|
||||
|
@@ -167,8 +167,6 @@ private:
|
||||
virtual WatchHandler *watchHandler() = 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 debugDumpers() const = 0;
|
||||
virtual bool useCustomDumpers() const = 0;
|
||||
@@ -283,6 +281,11 @@ public slots:
|
||||
|
||||
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:
|
||||
void showDebuggerOutput(const QString &prefix, const QString &msg);
|
||||
void showDebuggerInput(const QString &prefix, const QString &msg);
|
||||
@@ -312,9 +315,7 @@ private:
|
||||
StackHandler *stackHandler() { return m_stackHandler; }
|
||||
ThreadsHandler *threadsHandler() { return m_threadsHandler; }
|
||||
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 debugDumpers() const;
|
||||
bool useCustomDumpers() const;
|
||||
|
@@ -61,6 +61,7 @@
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/session.h>
|
||||
|
||||
@@ -85,8 +86,6 @@
|
||||
#include <QtGui/QTextCursor>
|
||||
|
||||
|
||||
namespace ExtensionSystem { class PluginManager; }
|
||||
|
||||
using namespace Core;
|
||||
using namespace Debugger::Constants;
|
||||
using namespace Debugger::Internal;
|
||||
@@ -144,6 +143,11 @@ const char * const ADD_TO_WATCH_KEY = "Ctrl+Alt+Q";
|
||||
} // namespace Debugger
|
||||
|
||||
|
||||
static ProjectExplorer::SessionManager *sessionManager()
|
||||
{
|
||||
return ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DebugMode
|
||||
@@ -251,6 +255,7 @@ public:
|
||||
void finish() {} // automatically calls "apply"
|
||||
|
||||
private:
|
||||
friend class DebuggerPlugin;
|
||||
Ui::GdbOptionPage m_ui;
|
||||
|
||||
DebuggerSettings m_settings;
|
||||
@@ -300,6 +305,10 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
|
||||
|
||||
//m_dumpLogAction = new QAction(this);
|
||||
//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;
|
||||
}
|
||||
|
||||
@@ -334,7 +343,6 @@ void GdbOptionPage::apply()
|
||||
|
||||
DebuggerPlugin::DebuggerPlugin()
|
||||
{
|
||||
m_pm = 0;
|
||||
m_generalOptionPage = 0;
|
||||
m_locationMark = 0;
|
||||
m_manager = 0;
|
||||
@@ -385,8 +393,6 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
||||
|
||||
m_manager = new DebuggerManager;
|
||||
|
||||
m_pm = ExtensionSystem::PluginManager::instance();
|
||||
|
||||
ICore *core = ICore::instance();
|
||||
QTC_ASSERT(core, return false);
|
||||
|
||||
@@ -560,10 +566,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
||||
connect(resetToSimpleAction, SIGNAL(triggered()),
|
||||
m_manager, SLOT(setSimpleDockWidgetArrangement()));
|
||||
|
||||
|
||||
m_generalOptionPage = 0;
|
||||
|
||||
// FIXME:
|
||||
// FIXME:
|
||||
m_generalOptionPage = new GdbOptionPage(this);
|
||||
addObject(m_generalOptionPage);
|
||||
|
||||
@@ -661,9 +664,9 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
||||
//
|
||||
|
||||
// ProjectExplorer
|
||||
connect(projectExplorer()->session(), SIGNAL(sessionLoaded()),
|
||||
connect(sessionManager(), SIGNAL(sessionLoaded()),
|
||||
m_manager, SLOT(sessionLoaded()));
|
||||
connect(projectExplorer()->session(), SIGNAL(aboutToSaveSession()),
|
||||
connect(sessionManager(), SIGNAL(aboutToSaveSession()),
|
||||
m_manager, SLOT(aboutToSaveSession()));
|
||||
|
||||
// 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. */
|
||||
void DebuggerPlugin::activatePreviousMode()
|
||||
{
|
||||
@@ -820,17 +818,14 @@ void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
|
||||
void DebuggerPlugin::setSessionValue(const QString &name, const QVariant &value)
|
||||
{
|
||||
//qDebug() << "SET SESSION VALUE" << name << value;
|
||||
ProjectExplorerPlugin *pe = projectExplorer();
|
||||
if (pe->session())
|
||||
pe->session()->setValue(name, value);
|
||||
else
|
||||
qDebug() << "FIXME: Session does not exist yet";
|
||||
QTC_ASSERT(sessionManager(), return);
|
||||
sessionManager()->setValue(name, value);
|
||||
}
|
||||
|
||||
void DebuggerPlugin::querySessionValue(const QString &name, QVariant *value)
|
||||
{
|
||||
ProjectExplorerPlugin *pe = projectExplorer();
|
||||
*value = pe->session()->value(name);
|
||||
QTC_ASSERT(sessionManager(), return);
|
||||
*value = sessionManager()->value(name);
|
||||
//qDebug() << "GET SESSION VALUE: " << name << value;
|
||||
}
|
||||
|
||||
|
@@ -34,19 +34,26 @@
|
||||
#ifndef DEBUGGERPLUGIN_H
|
||||
#define DEBUGGERPLUGIN_H
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAbstractItemView;
|
||||
class QAction;
|
||||
class QCursor;
|
||||
class QAbstractItemView;
|
||||
class QMenu;
|
||||
class QPoint;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core { class IEditor; }
|
||||
namespace TextEditor { class ITextEditor; }
|
||||
namespace Core {
|
||||
class IEditor;
|
||||
class IMode;
|
||||
}
|
||||
|
||||
namespace TextEditor {
|
||||
class ITextEditor;
|
||||
}
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
@@ -99,12 +106,9 @@ private:
|
||||
friend class GdbOptionPage;
|
||||
friend class DebugMode; // FIXME: Just a hack now so that it can access the views
|
||||
|
||||
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;
|
||||
|
||||
DebuggerManager *m_manager;
|
||||
DebugMode *m_debugMode;
|
||||
|
||||
ExtensionSystem::PluginManager *m_pm;
|
||||
GdbOptionPage *m_generalOptionPage;
|
||||
|
||||
QString m_previousMode;
|
||||
|
@@ -253,6 +253,7 @@ void GdbEngine::init()
|
||||
m_gdbVersion = 100;
|
||||
m_shared = 0;
|
||||
m_outputCodec = QTextCodec::codecForLocale();
|
||||
m_dataDumperState = DataDumperUninitialized;
|
||||
|
||||
m_oldestAcceptableToken = -1;
|
||||
|
||||
@@ -733,7 +734,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record)
|
||||
--m_pendingRequests;
|
||||
PENDING_DEBUG(" TYPE " << cmd.type << " DECREMENTS PENDING TO: "
|
||||
<< m_pendingRequests << cmd.command);
|
||||
if (m_pendingRequests == 0)
|
||||
if (m_pendingRequests <= 0)
|
||||
updateWatchModel2();
|
||||
} else {
|
||||
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;
|
||||
case 1: // base64 encoded 8 bit data
|
||||
ba = QByteArray::fromBase64(mi.data());
|
||||
ba = '"' + ba + '"';
|
||||
break;
|
||||
case 2: // base64 encoded 16 bit data
|
||||
ba = QByteArray::fromBase64(mi.data());
|
||||
ba = QString::fromUtf16((ushort *)ba.data(), ba.size() / 2).toUtf8();
|
||||
ba = '"' + ba + '"';
|
||||
break;
|
||||
case 3: // base64 encoded 32 bit data
|
||||
ba = QByteArray::fromBase64(mi.data());
|
||||
ba = QString::fromUcs4((uint *)ba.data(), ba.size() / 4).toUtf8();
|
||||
ba = '"' + ba + '"';
|
||||
break;
|
||||
}
|
||||
data.setValue(ba);
|
||||
@@ -2889,11 +2885,11 @@ static QString sizeofTypeExpression(const QString &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);
|
||||
// FIXME: a bit too harsh, but otherwise the treeview
|
||||
// sometimes look funny
|
||||
// FIXME: a bit too harsh, but otherwise the treeview sometimes look funny
|
||||
//m_expandedINames.clear();
|
||||
updateLocals();
|
||||
}
|
||||
@@ -3060,15 +3056,15 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
||||
|
||||
//qDebug() << "CMD: " << cmd;
|
||||
|
||||
sendSynchronizedCommand(cmd, WatchDumpCustomValue1, QVariant::fromValue(data));
|
||||
QVariant var;
|
||||
var.setValue(data);
|
||||
sendSynchronizedCommand(cmd, WatchDumpCustomValue1, var);
|
||||
|
||||
q->showStatusMessage(
|
||||
tr("Retrieving data for watch view (%1 requests pending)...")
|
||||
.arg(m_pendingRequests + 1), 10000);
|
||||
|
||||
// retrieve response
|
||||
QVariant var;
|
||||
var.setValue(data);
|
||||
sendSynchronizedCommand("p (char*)qDumpOutBuffer", WatchDumpCustomValue2, var);
|
||||
}
|
||||
|
||||
@@ -3276,7 +3272,7 @@ void GdbEngine::updateWatchModel2()
|
||||
return;
|
||||
}
|
||||
|
||||
PENDING_DEBUG("REBUILDING MODEL")
|
||||
PENDING_DEBUG("REBUILDING MODEL");
|
||||
emit gdbInputAvailable(QString(),
|
||||
"[" + currentTime() + "] <Rebuild Watchmodel>");
|
||||
q->showStatusMessage(tr("Finished retrieving data."), 400);
|
||||
@@ -3307,7 +3303,8 @@ void GdbEngine::handleQueryDataDumper2(const GdbResultRecord &record)
|
||||
QByteArray out = output.data();
|
||||
out = out.mid(out.indexOf('"') + 2); // + 1 is success marker
|
||||
out = out.left(out.lastIndexOf('"'));
|
||||
out = out.replace('\'', '"');
|
||||
//out.replace('\'', '"');
|
||||
out.replace("\\", "");
|
||||
out = "dummy={" + out + "}";
|
||||
//qDebug() << "OUTPUT: " << out;
|
||||
|
||||
@@ -3461,7 +3458,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
|
||||
} else if (record.resultClass == GdbResultError) {
|
||||
// Record an extra result, as the socket result will be lost
|
||||
// in transmission
|
||||
--m_pendingRequests;
|
||||
//--m_pendingRequests;
|
||||
QString msg = record.data.findChild("msg").data();
|
||||
//qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg;
|
||||
#ifdef QT_DEBUG
|
||||
@@ -3476,12 +3473,12 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
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);
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3492,219 +3489,208 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
|
||||
QTC_ASSERT(data.isValid(), return);
|
||||
//qDebug() << "CUSTOM VALUE RESULT: " << record.toString();
|
||||
//qDebug() << "FOR DATA: " << data.toString() << record.resultClass;
|
||||
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 {
|
||||
if (record.resultClass != GdbResultDone) {
|
||||
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()
|
||||
{
|
||||
setTokenBarrier();
|
||||
setTokenBarrier();
|
||||
|
||||
m_pendingRequests = 0;
|
||||
PENDING_DEBUG("\nRESET PENDING");
|
||||
m_toolTipCache.clear();
|
||||
m_toolTipExpression.clear();
|
||||
qq->watchHandler()->reinitializeWatchers();
|
||||
m_pendingRequests = 0;
|
||||
PENDING_DEBUG("\nRESET PENDING");
|
||||
m_toolTipCache.clear();
|
||||
m_toolTipExpression.clear();
|
||||
qq->watchHandler()->reinitializeWatchers();
|
||||
|
||||
int level = currentFrame();
|
||||
// '2' is 'list with type and value'
|
||||
QString cmd = QString("-stack-list-arguments 2 %1 %2").arg(level).arg(level);
|
||||
sendSynchronizedCommand(cmd, StackListArguments); // stage 1/2
|
||||
// '2' is 'list with type and value'
|
||||
sendSynchronizedCommand("-stack-list-locals 2", StackListLocals); // stage 2/2
|
||||
int level = currentFrame();
|
||||
// '2' is 'list with type and value'
|
||||
QString cmd = QString("-stack-list-arguments 2 %1 %2").arg(level).arg(level);
|
||||
sendSynchronizedCommand(cmd, StackListArguments); // stage 1/2
|
||||
// '2' is 'list with type and value'
|
||||
sendSynchronizedCommand("-stack-list-locals 2", StackListLocals); // stage 2/2
|
||||
}
|
||||
|
||||
void GdbEngine::handleStackListArguments(const GdbResultRecord &record)
|
||||
{
|
||||
// stage 1/2
|
||||
// stage 1/2
|
||||
|
||||
// Linux:
|
||||
// 12^done,stack-args=
|
||||
// [frame={level="0",args=[
|
||||
// {name="argc",type="int",value="1"},
|
||||
// {name="argv",type="char **",value="(char **) 0x7..."}]}]
|
||||
// Mac:
|
||||
// 78^done,stack-args=
|
||||
// {frame={level="0",args={
|
||||
// varobj=
|
||||
// {exp="this",value="0x38a2fab0",name="var21",numchild="3",
|
||||
// type="CurrentDocumentFind * const",typecode="PTR",
|
||||
// dynamic_type="",in_scope="true",block_start_addr="0x3938e946",
|
||||
// block_end_addr="0x3938eb2d"},
|
||||
// varobj=
|
||||
// {exp="before",value="@0xbfffb9f8: {d = 0x3a7f2a70}",
|
||||
// name="var22",numchild="1",type="const QString ...} }}}
|
||||
//
|
||||
// In both cases, iterating over the children of stack-args/frame/args
|
||||
// is ok.
|
||||
m_currentFunctionArgs.clear();
|
||||
if (record.resultClass == GdbResultDone) {
|
||||
const GdbMi list = record.data.findChild("stack-args");
|
||||
const GdbMi frame = list.findChild("frame");
|
||||
const GdbMi args = frame.findChild("args");
|
||||
m_currentFunctionArgs = args.children();
|
||||
} else if (record.resultClass == GdbResultError) {
|
||||
qDebug() << "FIXME: GdbEngine::handleStackListArguments: should not happen";
|
||||
}
|
||||
// Linux:
|
||||
// 12^done,stack-args=
|
||||
// [frame={level="0",args=[
|
||||
// {name="argc",type="int",value="1"},
|
||||
// {name="argv",type="char **",value="(char **) 0x7..."}]}]
|
||||
// Mac:
|
||||
// 78^done,stack-args=
|
||||
// {frame={level="0",args={
|
||||
// varobj=
|
||||
// {exp="this",value="0x38a2fab0",name="var21",numchild="3",
|
||||
// type="CurrentDocumentFind * const",typecode="PTR",
|
||||
// dynamic_type="",in_scope="true",block_start_addr="0x3938e946",
|
||||
// block_end_addr="0x3938eb2d"},
|
||||
// varobj=
|
||||
// {exp="before",value="@0xbfffb9f8: {d = 0x3a7f2a70}",
|
||||
// name="var22",numchild="1",type="const QString ...} }}}
|
||||
//
|
||||
// In both cases, iterating over the children of stack-args/frame/args
|
||||
// is ok.
|
||||
m_currentFunctionArgs.clear();
|
||||
if (record.resultClass == GdbResultDone) {
|
||||
const GdbMi list = record.data.findChild("stack-args");
|
||||
const GdbMi frame = list.findChild("frame");
|
||||
const GdbMi args = frame.findChild("args");
|
||||
m_currentFunctionArgs = args.children();
|
||||
} else if (record.resultClass == GdbResultError) {
|
||||
qDebug() << "FIXME: GdbEngine::handleStackListArguments: should not happen";
|
||||
}
|
||||
}
|
||||
|
||||
void GdbEngine::handleStackListLocals(const GdbResultRecord &record)
|
||||
{
|
||||
// stage 2/2
|
||||
// stage 2/2
|
||||
|
||||
// There could be shadowed variables
|
||||
QList<GdbMi> locals = record.data.findChild("locals").children();
|
||||
locals += m_currentFunctionArgs;
|
||||
// There could be shadowed variables
|
||||
QList<GdbMi> locals = record.data.findChild("locals").children();
|
||||
locals += m_currentFunctionArgs;
|
||||
|
||||
setLocals(locals);
|
||||
setLocals(locals);
|
||||
}
|
||||
|
||||
void GdbEngine::setLocals(const QList<GdbMi> &locals)
|
||||
{
|
||||
//qDebug() << m_varToType;
|
||||
QHash<QString, int> seen;
|
||||
//qDebug() << m_varToType;
|
||||
QHash<QString, int> seen;
|
||||
|
||||
foreach (const GdbMi &item, locals) {
|
||||
// Local variables of inlined code are reported as
|
||||
// 26^done,locals={varobj={exp="this",value="",name="var4",exp="this",
|
||||
// numchild="1",type="const QtSharedPointer::Basic<CPlusPlus::..."
|
||||
// We do not want these at all. Current hypotheses is that those
|
||||
// "spurious" locals have _two_ "exp" field. Try to filter them:
|
||||
#ifdef Q_OS_MAC
|
||||
int numExps = 0;
|
||||
foreach (const GdbMi &child, item.children())
|
||||
numExps += int(child.name() == "exp");
|
||||
if (numExps > 1)
|
||||
continue;
|
||||
QString name = item.findChild("exp").data();
|
||||
#else
|
||||
QString name = item.findChild("name").data();
|
||||
#endif
|
||||
int n = seen.value(name);
|
||||
if (n) {
|
||||
seen[name] = n + 1;
|
||||
WatchData data;
|
||||
data.iname = "local." + name + QString::number(n + 1);
|
||||
data.name = name + QString(" <shadowed %1>").arg(n);
|
||||
//data.setValue("<shadowed>");
|
||||
foreach (const GdbMi &item, locals) {
|
||||
// Local variables of inlined code are reported as
|
||||
// 26^done,locals={varobj={exp="this",value="",name="var4",exp="this",
|
||||
// numchild="1",type="const QtSharedPointer::Basic<CPlusPlus::..."
|
||||
// We do not want these at all. Current hypotheses is that those
|
||||
// "spurious" locals have _two_ "exp" field. Try to filter them:
|
||||
#ifdef Q_OS_MAC
|
||||
int numExps = 0;
|
||||
foreach (const GdbMi &child, item.children())
|
||||
numExps += int(child.name() == "exp");
|
||||
if (numExps > 1)
|
||||
continue;
|
||||
QString name = item.findChild("exp").data();
|
||||
#else
|
||||
QString name = item.findChild("name").data();
|
||||
#endif
|
||||
int n = seen.value(name);
|
||||
if (n) {
|
||||
seen[name] = n + 1;
|
||||
WatchData data;
|
||||
data.iname = "local." + name + QString::number(n + 1);
|
||||
data.name = name + QString(" <shadowed %1>").arg(n);
|
||||
//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"));
|
||||
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"));
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -134,6 +134,9 @@ private:
|
||||
void loadSymbols(const QString &moduleName);
|
||||
void loadAllSymbols();
|
||||
|
||||
void setDebugDumpers(bool on);
|
||||
void setUseCustomDumpers(bool on);
|
||||
|
||||
//
|
||||
// Own stuff
|
||||
//
|
||||
@@ -167,9 +170,6 @@ private:
|
||||
void updateLocals();
|
||||
|
||||
private slots:
|
||||
void setDebugDumpers(bool on);
|
||||
void setCustomDumpersWanted(bool on);
|
||||
|
||||
void handleResponse();
|
||||
|
||||
void gdbProcError(QProcess::ProcessError error);
|
||||
|
@@ -86,6 +86,8 @@ public:
|
||||
virtual void loadAllSymbols() = 0;
|
||||
|
||||
virtual void reloadRegisters() = 0;
|
||||
virtual void setDebugDumpers(bool on) = 0;
|
||||
virtual void setUseCustomDumpers(bool on) = 0;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -101,6 +101,9 @@ private:
|
||||
void loadSessionData() {}
|
||||
void saveSessionData() {}
|
||||
|
||||
void setDebugDumpers(bool) {}
|
||||
void setUseCustomDumpers(bool) {}
|
||||
|
||||
void assignValueInDebugger(const QString &expr, const QString &value);
|
||||
void executeDebuggerCommand(const QString & command);
|
||||
|
||||
|
@@ -255,7 +255,6 @@ QString WatchData::toString() const
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static bool iNameSorter(const WatchData &d1, const WatchData &d2)
|
||||
{
|
||||
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 name2 = d2.iname.section('.', level, level);
|
||||
//MODEL_DEBUG(" SORT: " << name1 << name2 << (name1 < name2));
|
||||
|
||||
if (name1 != name2) {
|
||||
// This formerly used inames. in this case 'lastIndexOf' probably
|
||||
// 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
|
||||
}
|
||||
if (name1 != name2 && !name1.isEmpty() && !name2.isEmpty()) {
|
||||
if (name1.at(0).isDigit() && name2.at(0).isDigit())
|
||||
return name1.toInt() < name2.toInt();
|
||||
return name1 < name2;
|
||||
}
|
||||
}
|
||||
|
@@ -391,6 +391,7 @@ bool FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
|
||||
return true;
|
||||
}
|
||||
m_mode = CommandMode;
|
||||
updateMiniBuffer();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -436,6 +437,7 @@ void FakeVimHandler::Private::setupWidget()
|
||||
m_plaintextedit->setLineWrapMode(QPlainTextEdit::NoWrap);
|
||||
}
|
||||
m_wasReadOnly = EDITOR(isReadOnly());
|
||||
//EDITOR(setReadOnly(true));
|
||||
showBlackMessage("vi emulation mode.");
|
||||
updateMiniBuffer();
|
||||
}
|
||||
@@ -688,17 +690,27 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
||||
indentRegion(m_tc.block(), m_tc.block().next());
|
||||
finishMovement();
|
||||
} else if (m_submode == ZSubMode) {
|
||||
if (key == Key_Return) {
|
||||
// cursor line to top of window, cursor on first non-blank
|
||||
//qDebug() << "Z_MODE " << cursorLineInDocument() << linesOnScreen();
|
||||
if (key == Key_Return || key == 't') { // cursor line to top of window
|
||||
if (!m_mvcount.isEmpty())
|
||||
m_tc.setPosition(positionForLine(count()));
|
||||
scrollToLineInDocument(cursorLineInDocument());
|
||||
moveToFirstNonBlankOnLine();
|
||||
if (key == Key_Return)
|
||||
moveToFirstNonBlankOnLine();
|
||||
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);
|
||||
moveToFirstNonBlankOnLine();
|
||||
if (key == '.')
|
||||
moveToFirstNonBlankOnLine();
|
||||
finishMovement();
|
||||
} else if (key == 'z') { // center cursor line
|
||||
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
|
||||
} else if (key == '-' || key == 'b') { // cursor line to bottom of window
|
||||
if (!m_mvcount.isEmpty())
|
||||
m_tc.setPosition(positionForLine(count()));
|
||||
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() - 1);
|
||||
if (key == '-')
|
||||
moveToFirstNonBlankOnLine();
|
||||
finishMovement();
|
||||
} else {
|
||||
qDebug() << "IGNORED Z_MODE " << key << text;
|
||||
@@ -770,6 +782,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
||||
m_commandHistoryIndex = m_commandHistory.size() - 1;
|
||||
updateMiniBuffer();
|
||||
} else if (key == '/' || key == '?') {
|
||||
enterExMode(); // to get the cursor disabled
|
||||
m_mode = (key == '/') ? SearchForwardMode : SearchBackwardMode;
|
||||
m_commandBuffer.clear();
|
||||
m_searchHistory.append(QString());
|
||||
@@ -869,13 +882,12 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
||||
m_opcount = m_mvcount;
|
||||
m_mvcount.clear();
|
||||
m_submode = DeleteSubMode;
|
||||
} else if (key == 'd') {
|
||||
//setAnchor();
|
||||
} else if (key == 'd' && m_visualMode == VisualLineMode) {
|
||||
leaveVisualMode();
|
||||
int beginLine = lineForPosition(m_marks['<']);
|
||||
int endLine = lineForPosition(m_marks['>']);
|
||||
selectRange(beginLine, endLine);
|
||||
recordRemoveSelectedText();
|
||||
m_registers[m_register] = recordRemoveSelectedText();
|
||||
} else if (key == 'D') {
|
||||
setAnchor();
|
||||
recordBeginGroup();
|
||||
@@ -883,6 +895,13 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
||||
moveDown(qMax(count() - 1, 0));
|
||||
moveRight(rightDist());
|
||||
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') {
|
||||
m_moveType = MoveInclusive;
|
||||
moveToWordBoundary(false, true);
|
||||
@@ -1054,10 +1073,13 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
||||
m_subsubdata = key;
|
||||
} else if (key == 'u') {
|
||||
undo();
|
||||
} else if (key == 'U') {
|
||||
// FIXME: this is non-vim, but as Ctrl-R is taken globally
|
||||
// we have a substitute here
|
||||
redo();
|
||||
} 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 == 'v') {
|
||||
enterVisualMode(VisualCharMode);
|
||||
} else if (key == 'V') {
|
||||
@@ -1088,7 +1110,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
||||
if (leftDist() > 0) {
|
||||
setAnchor();
|
||||
moveLeft(qMin(count(), leftDist()));
|
||||
recordRemoveSelectedText();
|
||||
m_registers[m_register] = recordRemoveSelectedText();
|
||||
}
|
||||
finishMovement();
|
||||
} else if (key == 'y' && m_visualMode == NoVisualMode) {
|
||||
@@ -1127,20 +1149,6 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
|
||||
}
|
||||
recordInsertText(str);
|
||||
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')) {
|
||||
moveDown(count() * (linesOnScreen() - 2));
|
||||
finishMovement();
|
||||
@@ -1213,6 +1221,8 @@ bool FakeVimHandler::Private::handleInsertMode(int key, int, const QString &text
|
||||
QString str = QString(m_config[ConfigTabStop].toInt(), ' ');
|
||||
m_lastInsertion.append(str);
|
||||
m_tc.insertText(str);
|
||||
} else if (key >= control('a') && key <= control('z')) {
|
||||
// ignore these
|
||||
} else if (!text.isEmpty()) {
|
||||
m_lastInsertion.append(text);
|
||||
if (m_submode == ReplaceSubMode) {
|
||||
@@ -1572,10 +1582,15 @@ void FakeVimHandler::Private::search(const QString &needle0, bool forward)
|
||||
if (forward)
|
||||
m_tc.movePosition(Right, MoveAnchor, 1);
|
||||
|
||||
int oldLine = cursorLineInDocument() - cursorLineOnScreen();
|
||||
|
||||
EDITOR(setTextCursor(m_tc));
|
||||
if (EDITOR(find(needle, flags))) {
|
||||
m_tc = EDITOR(textCursor());
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1584,6 +1599,8 @@ void FakeVimHandler::Private::search(const QString &needle0, bool forward)
|
||||
if (EDITOR(find(needle, flags))) {
|
||||
m_tc = EDITOR(textCursor());
|
||||
m_tc.setPosition(m_tc.anchor());
|
||||
if (oldLine != cursorLineInDocument() - cursorLineOnScreen())
|
||||
scrollToLineInDocument(cursorLineInDocument() - linesOnScreen() / 2);
|
||||
if (forward)
|
||||
showRedMessage("search hit BOTTOM, continuing at TOP");
|
||||
else
|
||||
@@ -2097,10 +2114,6 @@ FakeVimHandler::~FakeVimHandler()
|
||||
|
||||
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())
|
||||
return d->handleEvent(static_cast<QKeyEvent *>(ev));
|
||||
|
||||
|
@@ -126,7 +126,6 @@ private slots:
|
||||
private:
|
||||
FakeVimPlugin *q;
|
||||
QAction *m_installHandlerAction;
|
||||
Core::ICore *m_core;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
@@ -136,7 +135,6 @@ FakeVimPluginPrivate::FakeVimPluginPrivate(FakeVimPlugin *plugin)
|
||||
{
|
||||
q = plugin;
|
||||
m_installHandlerAction = 0;
|
||||
m_core = 0;
|
||||
}
|
||||
|
||||
FakeVimPluginPrivate::~FakeVimPluginPrivate()
|
||||
@@ -149,10 +147,7 @@ void FakeVimPluginPrivate::shutdown()
|
||||
|
||||
bool FakeVimPluginPrivate::initialize()
|
||||
{
|
||||
m_core = Core::ICore::instance();
|
||||
QTC_ASSERT(m_core, return false);
|
||||
|
||||
Core::ActionManager *actionManager = m_core->actionManager();
|
||||
Core::ActionManager *actionManager = Core::ICore::instance()->actionManager();
|
||||
QTC_ASSERT(actionManager, return false);
|
||||
|
||||
QList<int> globalcontext;
|
||||
@@ -174,7 +169,7 @@ bool FakeVimPluginPrivate::initialize()
|
||||
this, SLOT(installHandlerOnCurrentEditor()));
|
||||
|
||||
// EditorManager
|
||||
QObject *editorManager = m_core->editorManager();
|
||||
QObject *editorManager = Core::ICore::instance()->editorManager();
|
||||
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||
this, SLOT(editorAboutToClose(Core::IEditor*)));
|
||||
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
||||
@@ -187,7 +182,7 @@ void FakeVimPluginPrivate::installHandler(Core::IEditor *editor)
|
||||
{
|
||||
QWidget *widget = editor->widget();
|
||||
|
||||
FakeVimHandler *handler = new FakeVimHandler(widget, this);
|
||||
FakeVimHandler *handler = new FakeVimHandler(widget, widget);
|
||||
|
||||
connect(handler, SIGNAL(extraInformationChanged(QString)),
|
||||
this, SLOT(showExtraInformation(QString)));
|
||||
@@ -239,9 +234,9 @@ void FakeVimPluginPrivate::writeFile(bool *handled,
|
||||
if (editor && editor->file()->fileName() == fileName) {
|
||||
// Handle that as a special case for nicer interaction with core
|
||||
Core::IFile *file = editor->file();
|
||||
m_core->fileManager()->blockFileChange(file);
|
||||
Core::ICore::instance()->fileManager()->blockFileChange(file);
|
||||
file->save(fileName);
|
||||
m_core->fileManager()->unblockFileChange(file);
|
||||
Core::ICore::instance()->fileManager()->unblockFileChange(file);
|
||||
*handled = true;
|
||||
}
|
||||
}
|
||||
@@ -258,33 +253,17 @@ void FakeVimPluginPrivate::removeHandler()
|
||||
|
||||
void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor)
|
||||
{
|
||||
Q_UNUSED(editor);
|
||||
//qDebug() << "OPENING: " << editor << editor->widget();
|
||||
//installHandler(editor);
|
||||
|
||||
#if 1
|
||||
QSettings *s = ICore::instance()->settings();
|
||||
bool automatic = s->value("textInteractionSettings/UseVim").toBool();
|
||||
//qDebug() << "USE VIM: " << automatic;
|
||||
if (automatic)
|
||||
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)
|
||||
{
|
||||
//qDebug() << "CLOSING: " << editor << editor->widget();
|
||||
Q_UNUSED(editor);
|
||||
//qDebug() << "CLOSING: " << editor;
|
||||
}
|
||||
|
||||
void FakeVimPluginPrivate::showCommandBuffer(const QString &contents)
|
||||
|
@@ -61,6 +61,8 @@
|
||||
|
||||
#include <QtHelp/QHelpEngine>
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
|
||||
using namespace Help::Internal;
|
||||
|
||||
namespace {
|
||||
@@ -228,20 +230,23 @@ void CentralWidget::setSource(const QUrl &url)
|
||||
|
||||
void CentralWidget::setLastShownPages()
|
||||
{
|
||||
const QStringList lastShownPageList = helpEngine->customValue(QLatin1String("LastShownPages")).
|
||||
toString().split(QLatin1Char('|'), QString::SkipEmptyParts);
|
||||
const QStringList lastShownPageList =
|
||||
helpEngine->customValue(QLatin1String("LastShownPages")). toString().
|
||||
split(QLatin1Char('|'), QString::SkipEmptyParts);
|
||||
|
||||
if (!lastShownPageList.isEmpty()) {
|
||||
foreach (const QString page, lastShownPageList)
|
||||
foreach (const QString& page, lastShownPageList)
|
||||
setSourceInNewTab(page);
|
||||
|
||||
tabWidget->setCurrentIndex(helpEngine->customValue(QLatin1String("LastTabPage"), 0).toInt());
|
||||
tabWidget->setCurrentIndex(helpEngine->
|
||||
customValue(QLatin1String("LastTabPage"), 0).toInt());
|
||||
} else {
|
||||
QUrl url = helpEngine->findFile(QUrl("qthelp://com.trolltech.qt.440/qdoc/index.html"));
|
||||
if (url.isValid())
|
||||
setSource(url);
|
||||
else
|
||||
setSource(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()) {
|
||||
url.setUrl(QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html").
|
||||
arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
|
||||
}
|
||||
setSource(url);
|
||||
}
|
||||
|
||||
updateBrowserFont();
|
||||
@@ -392,19 +397,33 @@ void CentralWidget::setGlobalActions(const QList<QAction*> &actions)
|
||||
{
|
||||
globalActionList = actions;
|
||||
}
|
||||
|
||||
void CentralWidget::setSourceInNewTab(const QUrl &url)
|
||||
{
|
||||
HelpViewer* viewer = new HelpViewer(helpEngine, this);
|
||||
viewer->installEventFilter(this);
|
||||
viewer->setSource(url);
|
||||
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();
|
||||
if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool())
|
||||
font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont")));
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -492,7 +511,7 @@ void CentralWidget::currentPageChanged(int index)
|
||||
bool enabled = false;
|
||||
if (viewer)
|
||||
enabled = tabWidget->count() > 1;
|
||||
|
||||
|
||||
tabWidget->setTabsClosable(enabled);
|
||||
tabWidget->cornerWidget(Qt::TopLeftCorner)->setEnabled(true);
|
||||
|
||||
@@ -595,6 +614,7 @@ bool CentralWidget::eventFilter(QObject *object, QEvent *e)
|
||||
|
||||
void CentralWidget::updateBrowserFont()
|
||||
{
|
||||
#if defined(QT_NO_WEBKIT)
|
||||
QFont font = qApp->font();
|
||||
if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool())
|
||||
font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont")));
|
||||
@@ -605,9 +625,25 @@ void CentralWidget::updateBrowserFont()
|
||||
if (widget->font() != 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();
|
||||
|
||||
@@ -666,7 +702,7 @@ bool CentralWidget::find(const QString &txt, QTextDocument::FindFlags findFlags,
|
||||
}
|
||||
|
||||
void CentralWidget::showTopicChooser(const QMap<QString, QUrl> &links,
|
||||
const QString &keyword)
|
||||
const QString &keyword)
|
||||
{
|
||||
TopicChooser tc(this, keyword, links);
|
||||
if (tc.exec() == QDialog::Accepted)
|
||||
|
@@ -136,5 +136,11 @@ bool DocSettingsPage::applyChanges()
|
||||
}
|
||||
++it;
|
||||
}
|
||||
return m_registeredDocs || m_removeDocs.count();
|
||||
|
||||
bool success = m_registeredDocs || m_removeDocs.count();
|
||||
|
||||
m_removeDocs.clear();
|
||||
m_registeredDocs = false;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
@@ -98,7 +98,7 @@ void HelpManager::registerDocumentation(const QStringList &fileNames)
|
||||
}
|
||||
}
|
||||
if (needsSetup)
|
||||
qDebug() << m_helpEngine->setupData();
|
||||
m_helpEngine->setupData();
|
||||
}
|
||||
|
||||
HelpPlugin::HelpPlugin() :
|
||||
@@ -395,6 +395,11 @@ void HelpPlugin::rightPaneForward()
|
||||
m_helpViewerForSideBar->forward();
|
||||
}
|
||||
|
||||
void HelpPlugin::activateHelpMode()
|
||||
{
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
}
|
||||
|
||||
void HelpPlugin::switchToHelpMode()
|
||||
{
|
||||
switchToHelpMode(m_helpViewerForSideBar->source());
|
||||
@@ -403,14 +408,14 @@ void HelpPlugin::switchToHelpMode()
|
||||
|
||||
void HelpPlugin::switchToHelpMode(const QUrl &source)
|
||||
{
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
m_centralWidget->setSource(source);
|
||||
m_centralWidget->setFocus();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -450,9 +455,12 @@ void HelpPlugin::extensionsInitialized()
|
||||
#endif
|
||||
QHelpEngineCore hc(fi.absoluteFilePath());
|
||||
hc.setupData();
|
||||
if (!hc.registerDocumentation(qchFileName))
|
||||
qDebug() << hc.error();
|
||||
needsSetup = true;
|
||||
QString fileNamespace = QHelpEngineCore::namespaceName(qchFileName);
|
||||
if (!fileNamespace.isEmpty() && !hc.registeredDocumentations().contains(fileNamespace)) {
|
||||
if (!hc.registerDocumentation(qchFileName))
|
||||
qDebug() << hc.error();
|
||||
needsSetup = true;
|
||||
}
|
||||
}
|
||||
|
||||
int i = m_helpEngine->customValue(
|
||||
@@ -558,7 +566,7 @@ void HelpPlugin::activateContext()
|
||||
viewer = m_helpViewerForSideBar;
|
||||
} else {
|
||||
viewer = m_centralWidget->currentHelpViewer();
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
}
|
||||
|
||||
if (viewer) {
|
||||
@@ -576,7 +584,7 @@ void HelpPlugin::activateContext()
|
||||
viewer = m_helpViewerForSideBar;
|
||||
} else {
|
||||
viewer = m_centralWidget->currentHelpViewer();
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
}
|
||||
|
||||
if (viewer) {
|
||||
@@ -590,19 +598,19 @@ void HelpPlugin::activateContext()
|
||||
|
||||
void HelpPlugin::activateIndex()
|
||||
{
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
m_sideBar->activateItem(m_indexItem);
|
||||
}
|
||||
|
||||
void HelpPlugin::activateContents()
|
||||
{
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
m_sideBar->activateItem(m_contentItem);
|
||||
}
|
||||
|
||||
void HelpPlugin::activateSearch()
|
||||
{
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
m_sideBar->activateItem(m_searchItem);
|
||||
}
|
||||
|
||||
@@ -677,7 +685,7 @@ void HelpPlugin::addNewBookmark(const QString &title, const QString &url)
|
||||
|
||||
void HelpPlugin::openGettingStarted()
|
||||
{
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
m_centralWidget->setSource(
|
||||
QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html")
|
||||
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
|
||||
|
@@ -134,6 +134,7 @@ private slots:
|
||||
private:
|
||||
QToolBar *createToolBar();
|
||||
void createRightPaneSideBar();
|
||||
void activateHelpMode();
|
||||
|
||||
Core::ICore *m_core;
|
||||
QHelpEngine *m_helpEngine;
|
||||
|
@@ -519,10 +519,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+R")));
|
||||
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);
|
||||
m_runConfigurationMenu = mrc->menu();
|
||||
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);
|
||||
|
||||
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
|
||||
m_taskAction = new QAction(tr("Go to Task Window"), this);
|
||||
m_taskAction->setIcon(QIcon(Core::Constants::ICON_NEXT));
|
||||
|
@@ -48,6 +48,7 @@
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QFocusEvent>
|
||||
#include <QtGui/QPalette>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
@@ -73,8 +74,6 @@ public:
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setUniformRowHeights(true);
|
||||
setTextElideMode(Qt::ElideNone);
|
||||
setAlternatingRowColors(true);
|
||||
setProperty("AlternateEmpty", true); // Let Manhattan to override style default
|
||||
// setExpandsOnDoubleClick(false);
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 613 B After Width: | Height: | Size: 623 B |
@@ -104,6 +104,7 @@ bool QMakeStep::init(const QString &name)
|
||||
m_buildConfiguration = name;
|
||||
const QtVersion *qtVersion = m_pro->qtVersion(name);
|
||||
|
||||
|
||||
if (!qtVersion->isValid()) {
|
||||
#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"));
|
||||
|
@@ -46,6 +46,7 @@
|
||||
|
||||
#include <QtGui/QFormLayout>
|
||||
#include <QtGui/QInputDialog>
|
||||
#include <QtGui/QLabel>
|
||||
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
using namespace Qt4ProjectManager;
|
||||
@@ -54,17 +55,27 @@ using ProjectExplorer::PersistentSettingsReader;
|
||||
using ProjectExplorer::PersistentSettingsWriter;
|
||||
|
||||
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"));
|
||||
if (!m_proFilePath.isEmpty()) {
|
||||
updateCachedValues();
|
||||
setName(QFileInfo(m_proFilePath).baseName());
|
||||
}
|
||||
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SIGNAL(effectiveExecutableChanged()));
|
||||
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SIGNAL(effectiveWorkingDirectoryChanged()));
|
||||
}
|
||||
|
||||
Qt4RunConfiguration::~Qt4RunConfiguration()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString Qt4RunConfiguration::type() const
|
||||
@@ -72,37 +83,92 @@ QString Qt4RunConfiguration::type() const
|
||||
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(configWidget);
|
||||
QFormLayout *toplayout = new QFormLayout(this);
|
||||
toplayout->setMargin(0);
|
||||
|
||||
QLabel *nameLabel = new QLabel(tr("Name:"));
|
||||
QLineEdit *nameLineEdit = new QLineEdit(name());
|
||||
nameLabel->setBuddy(nameLineEdit);
|
||||
toplayout->addRow(nameLabel, nameLineEdit);
|
||||
m_nameLineEdit = new QLineEdit(m_qt4RunConfiguration->name());
|
||||
nameLabel->setBuddy(m_nameLineEdit);
|
||||
toplayout->addRow(nameLabel, m_nameLineEdit);
|
||||
|
||||
QLabel *executableLabel = new QLabel(tr("Executable:"));
|
||||
QLabel *executableLabel2 = new QLabel(executable());
|
||||
toplayout->addRow(executableLabel, executableLabel2);
|
||||
m_executableLabel = new QLabel(m_qt4RunConfiguration->executable());
|
||||
toplayout->addRow(tr("Executable:"), m_executableLabel);
|
||||
|
||||
QLabel *workingDirectoryLabel = new QLabel(tr("Working Directory:"));
|
||||
QLabel *workingDirectoryLabel2 = new QLabel(workingDirectory());
|
||||
toplayout->addRow(workingDirectoryLabel, workingDirectoryLabel2);
|
||||
m_workingDirectoryLabel = new QLabel(m_qt4RunConfiguration->workingDirectory());
|
||||
toplayout->addRow(tr("Working Directory:"), m_workingDirectoryLabel);
|
||||
|
||||
QLabel *argumentsLabel = new QLabel(tr("&Arguments:"));
|
||||
QLineEdit *argumentsLineEdit = new QLineEdit(ProjectExplorer::Environment::joinArgumentList(commandLineArguments()));
|
||||
argumentsLabel->setBuddy(argumentsLineEdit);
|
||||
toplayout->addRow(argumentsLabel, argumentsLineEdit);
|
||||
m_argumentsLineEdit = new QLineEdit(ProjectExplorer::Environment::joinArgumentList(qt4RunConfiguration->commandLineArguments()));
|
||||
argumentsLabel->setBuddy(m_argumentsLineEdit);
|
||||
toplayout->addRow(argumentsLabel, m_argumentsLineEdit);
|
||||
|
||||
connect(argumentsLineEdit, SIGNAL(textEdited(const QString&)),
|
||||
connect(m_argumentsLineEdit, SIGNAL(textEdited(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&)));
|
||||
|
||||
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
|
||||
@@ -156,6 +222,7 @@ ProjectExplorer::Environment Qt4RunConfiguration::environment() const
|
||||
void Qt4RunConfiguration::setCommandLineArguments(const QString &argumentsString)
|
||||
{
|
||||
m_commandLineArguments = ProjectExplorer::Environment::parseCombinedArgString(argumentsString);
|
||||
emit commandLineArgumentsChanged(argumentsString);
|
||||
}
|
||||
|
||||
void Qt4RunConfiguration::nameEdited(const QString &name)
|
||||
@@ -167,6 +234,7 @@ void Qt4RunConfiguration::nameEdited(const QString &name)
|
||||
setName(name);
|
||||
m_userSetName = true;
|
||||
}
|
||||
emit nameChanged(name);
|
||||
}
|
||||
|
||||
QString Qt4RunConfiguration::proFilePath() const
|
||||
@@ -222,6 +290,9 @@ void Qt4RunConfiguration::updateCachedValues()
|
||||
m_runMode = ProjectExplorer::ApplicationRunConfiguration::Gui;
|
||||
|
||||
delete reader;
|
||||
|
||||
emit effectiveExecutableChanged();
|
||||
emit effectiveWorkingDirectoryChanged();
|
||||
}
|
||||
|
||||
QString Qt4RunConfiguration::resolveVariables(const QString &buildConfiguration, const QString& in) const
|
||||
@@ -310,7 +381,7 @@ QString Qt4RunConfiguration::qmakeBuildConfigFromBuildConfiguration(const QStrin
|
||||
else
|
||||
return "release";
|
||||
} 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)
|
||||
return "debug";
|
||||
else
|
||||
|
@@ -36,6 +36,11 @@
|
||||
|
||||
#include <projectexplorer/applicationrunconfiguration.h>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
class QWidget;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
|
||||
@@ -45,9 +50,13 @@ namespace Internal {
|
||||
|
||||
class Qt4ProFileNode;
|
||||
|
||||
|
||||
|
||||
class Qt4RunConfiguration : public ProjectExplorer::ApplicationRunConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
// to change the name and arguments
|
||||
friend class Qt4RunConfigurationWidget;
|
||||
public:
|
||||
Qt4RunConfiguration(Qt4Project *pro, QString proFilePath);
|
||||
virtual ~Qt4RunConfiguration();
|
||||
@@ -68,6 +77,14 @@ public:
|
||||
// Should just be called from qt4project, since that knows that the file changed on disc
|
||||
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:
|
||||
void setCommandLineArguments(const QString &argumentsString);
|
||||
void nameEdited(const QString&);
|
||||
@@ -88,6 +105,31 @@ private:
|
||||
QString m_workingDir;
|
||||
ProjectExplorer::ApplicationRunConfiguration::RunMode m_runMode;
|
||||
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
|
||||
|
@@ -33,8 +33,8 @@
|
||||
|
||||
#include "qtestlibplugin.h"
|
||||
|
||||
//#include <Qt4IProjectManagers>
|
||||
//#include <texteditor/TextEditorInterfaces>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <texteditor/itexteditor.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
@@ -116,28 +116,27 @@ static QTestFunction::MessageType stringToMessageType(const QString &str)
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
QTestLibPlugin::QTestLibPlugin() :
|
||||
m_projectExplorer(0),
|
||||
m_core(0),
|
||||
m_outputPane(0)
|
||||
QTestLibPlugin::QTestLibPlugin()
|
||||
: m_projectExplorer(0), m_outputPane(0)
|
||||
{
|
||||
}
|
||||
|
||||
QTestLibPlugin::~QTestLibPlugin()
|
||||
{
|
||||
if (m_core && m_outputPane)
|
||||
m_core->pluginManager()->removeObject(m_outputPane);
|
||||
if (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);
|
||||
m_projectExplorer = app->getObject<ProjectExplorer::ProjectExplorerPlugin>();
|
||||
connect(m_projectExplorer->qObject(), SIGNAL(aboutToExecuteProject(ProjectExplorer::Project *)),
|
||||
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
|
||||
connect(m_projectExplorer, SIGNAL(aboutToExecuteProject(ProjectExplorer::Project *)),
|
||||
this, SLOT(projectRunHook(ProjectExplorer::Project *)));
|
||||
|
||||
m_outputPane = new QTestOutputPane(this);
|
||||
app->addObject(m_outputPane);
|
||||
ExtensionSystem::PluginManager::instance()->addObject(m_outputPane);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -169,10 +168,10 @@ void QTestLibPlugin::projectRunHook(ProjectExplorer::Project *proj)
|
||||
|
||||
//NBS proj->setCustomApplicationOutputHandler(this);
|
||||
//NBS proj->setExtraApplicationRunArguments(QStringList() << QLatin1String("-xml") << QLatin1String("-o") << m_outputFile);
|
||||
const QString proFile = proj->fileName();
|
||||
const QFileInfo fi(proFile);
|
||||
if (QFile::exists(fi.absolutePath()))
|
||||
m_projectDirectory = fi.absolutePath();
|
||||
// const QString proFile = proj->fileName();
|
||||
// const QFileInfo fi(proFile);
|
||||
// if (QFile::exists(fi.absolutePath()))
|
||||
// m_projectDirectory = fi.absolutePath();
|
||||
}
|
||||
|
||||
void QTestLibPlugin::clear()
|
||||
@@ -319,9 +318,11 @@ bool QTestFunction::indexHasIncidents(const QModelIndex &function, IncidentType
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -------------- QTestOutputPane
|
||||
QTestOutputPane::QTestOutputPane(QTestLibPlugin *plugin) :
|
||||
QObject(plugin),
|
||||
|
||||
QTestOutputPane::QTestOutputPane(QTestLibPlugin *plugin)
|
||||
: QObject(plugin),
|
||||
m_plugin(plugin),
|
||||
m_widget(0),
|
||||
m_model(new QStandardItemModel(this))
|
||||
@@ -485,8 +486,8 @@ void QTestOutputWidget::gotoLocation(QModelIndex index)
|
||||
|
||||
QTestLocation loc = tag.value<QTestLocation>();
|
||||
|
||||
m_coreInterface->editorManager()->openEditor(loc.file);
|
||||
Core::EditorInterface *edtIface = m_coreInterface->editorManager()->currentEditor();
|
||||
Core::ICore::instance()->editorManager()->openEditor(loc.file);
|
||||
Core::EditorInterface *edtIface = Core::ICore::instance()->editorManager()->currentEditor();
|
||||
if (!edtIface)
|
||||
return;
|
||||
TextEditor::ITextEditor *editor =
|
||||
|
@@ -35,18 +35,19 @@
|
||||
#define QTESTLIBPLUGIN_H
|
||||
|
||||
#include <coreplugin/ioutputpane.h>
|
||||
//#include <projectexplorer/ProjectExplorerInterfaces>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtGui/QSortFilterProxyModel>
|
||||
#include <QtGui/QStandardItem>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QSortFilterProxyModel>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QStandardItemModel;
|
||||
class QTreeView;
|
||||
class QTextEdit;
|
||||
class QComboBox;
|
||||
class QStandardItemModel;
|
||||
class QTextEdit;
|
||||
class QTreeView;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace QTestLib {
|
||||
@@ -101,7 +102,7 @@ public:
|
||||
class QTestOutputPane : public Core::IOutputPane
|
||||
{
|
||||
Q_OBJECT
|
||||
//Q_INTERFACES(Core::IOutputPane)
|
||||
|
||||
public:
|
||||
QTestOutputPane(QTestLibPlugin *plugin);
|
||||
|
||||
@@ -116,8 +117,13 @@ public:
|
||||
|
||||
void show();
|
||||
|
||||
Q_SIGNALS:
|
||||
//signals
|
||||
// FIXME:
|
||||
virtual int priorityInStatusBar() const { return 0;}
|
||||
virtual void setFocus() {}
|
||||
virtual bool hasFocus() { return false;}
|
||||
virtual bool canFocus() { return false;}
|
||||
|
||||
signals:
|
||||
void showPage();
|
||||
|
||||
private:
|
||||
@@ -165,19 +171,15 @@ private:
|
||||
QTestOutputFilter *m_filterModel;
|
||||
};
|
||||
|
||||
class QTestLibPlugin : public QObject,
|
||||
public ExtensionSystem::PluginInterface,
|
||||
public ProjectExplorer::IApplicationOutput
|
||||
class QTestLibPlugin : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(ExtensionSystem::PluginInterface
|
||||
ProjectExplorer::IApplicationOutput)
|
||||
|
||||
public:
|
||||
QTestLibPlugin();
|
||||
virtual ~QTestLibPlugin();
|
||||
|
||||
bool init(ExtensionSystem::PluginManagerInterface *app, QString *error_message);
|
||||
bool init(const QStringList &args, QString *error_message);
|
||||
void extensionsInitialized();
|
||||
|
||||
// IApplicationOutput
|
||||
|
1
src/plugins/snippets/README
Normal file
@@ -0,0 +1 @@
|
||||
This is dead code for now.
|
@@ -50,8 +50,7 @@ const QIcon SnippetsCompletion::m_fileIcon = QIcon(":/snippets/images/file.png")
|
||||
SnippetsCompletion::SnippetsCompletion(QObject *parent)
|
||||
: ICompletionCollector(parent)
|
||||
{
|
||||
m_core = SnippetsPlugin::core();
|
||||
m_snippetsWnd = SnippetsPlugin::snippetsWindow();
|
||||
m_snippetsWindow = SnippetsPlugin::snippetsWindow();
|
||||
|
||||
updateCompletions();
|
||||
}
|
||||
@@ -66,9 +65,9 @@ void SnippetsCompletion::updateCompletions()
|
||||
{
|
||||
qDeleteAll(m_autoCompletions.values());
|
||||
m_autoCompletions.clear();
|
||||
|
||||
#if 0
|
||||
int index = 0;
|
||||
foreach (SnippetSpec *spec, m_snippetsWnd->snippets()) {
|
||||
foreach (SnippetSpec *spec, m_snippetsWindow->snippets()) {
|
||||
if (!spec->completionShortcut().isEmpty()) {
|
||||
TextEditor::CompletionItem *item = new TextEditor::CompletionItem;
|
||||
item->m_key = spec->name();
|
||||
@@ -79,6 +78,7 @@ void SnippetsCompletion::updateCompletions()
|
||||
++index;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SnippetsCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
|
||||
@@ -96,29 +96,36 @@ int SnippetsCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
||||
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;
|
||||
if (length >= 2) {
|
||||
QString key = m_editor->textAt(m_startPosition, length);
|
||||
foreach (TextEditor::CompletionItem* item, m_autoCompletions.values()) {
|
||||
if (item->m_key.startsWith(key, Qt::CaseInsensitive)) {
|
||||
(*completions) << item;
|
||||
}
|
||||
if (item->m_key.startsWith(key, Qt::CaseInsensitive))
|
||||
completions->append(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
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();
|
||||
#endif
|
||||
return QString();
|
||||
}
|
||||
|
||||
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();
|
||||
#endif
|
||||
return QString();
|
||||
}
|
||||
|
||||
QIcon SnippetsCompletion::icon(TextEditor::CompletionItem *) const
|
||||
@@ -126,18 +133,20 @@ QIcon SnippetsCompletion::icon(TextEditor::CompletionItem *) const
|
||||
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;
|
||||
m_editor->setCurPos(m_startPosition);
|
||||
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;
|
||||
}
|
||||
|
@@ -36,15 +36,11 @@
|
||||
|
||||
#include <texteditor/icompletioncollector.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
namespace Core {
|
||||
class ICore;
|
||||
}
|
||||
|
||||
namespace TextEditor {
|
||||
class ITextEditable;
|
||||
class ITextEditor;
|
||||
@@ -72,10 +68,12 @@ public:
|
||||
QString details(TextEditor::CompletionItem *item) const;
|
||||
QIcon icon(TextEditor::CompletionItem *item) const;
|
||||
|
||||
void complete(TextEditor::CompletionItem *item);
|
||||
bool partiallyComplete();
|
||||
void complete(const TextEditor::CompletionItem &item);
|
||||
bool partiallyComplete(const QList<TextEditor::CompletionItem> &);
|
||||
void cleanup();
|
||||
|
||||
void completions(QList<TextEditor::CompletionItem>*);
|
||||
|
||||
private slots:
|
||||
void updateCompletions();
|
||||
|
||||
@@ -83,10 +81,9 @@ private:
|
||||
static int findStartOfName(const TextEditor::ITextEditor *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;
|
||||
Core::ICore *m_core;
|
||||
SnippetsWindow *m_snippetsWindow;
|
||||
|
||||
QMultiMap<QString, TextEditor::CompletionItem *> m_autoCompletions;
|
||||
|
||||
|
@@ -36,16 +36,18 @@
|
||||
#include "snippetsplugin.h"
|
||||
#include "snippetspec.h"
|
||||
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QShortcut>
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QShortcut>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.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/texteditorconstants.h>
|
||||
|
||||
@@ -56,6 +58,7 @@ SnippetsPlugin *SnippetsPlugin::m_instance = 0;
|
||||
SnippetsPlugin::SnippetsPlugin()
|
||||
{
|
||||
m_instance = this;
|
||||
m_snippetsCompletion = 0;
|
||||
}
|
||||
|
||||
SnippetsPlugin::~SnippetsPlugin()
|
||||
@@ -78,17 +81,20 @@ bool SnippetsPlugin::initialize(const QStringList &arguments, QString *)
|
||||
context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
||||
|
||||
m_snippetWnd = new SnippetsWindow();
|
||||
addAutoReleasedObject(new Core::BaseView("Snippets.SnippetsTree",
|
||||
m_snippetWnd,
|
||||
QList<int>() << core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window"))
|
||||
<< core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR),
|
||||
Qt::RightDockWidgetArea));
|
||||
Core::BaseView *view = new Core::BaseView;
|
||||
view->setUniqueViewName("Snippets.SnippetsTree");
|
||||
view->setWidget(m_snippetWnd);
|
||||
view->setContext(QList<int>()
|
||||
<< core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window"))
|
||||
<< core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR));
|
||||
//view->setDefaultPosition(Qt::RightDockWidgetArea));
|
||||
addAutoReleasedObject(view);
|
||||
m_snippetsCompletion = new SnippetsCompletion(this);
|
||||
addObject(m_snippetsCompletion);
|
||||
|
||||
foreach (SnippetSpec *snippet, m_snippetWnd->snippets()) {
|
||||
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"));
|
||||
connect(sc, SIGNAL(activated()), this, SLOT(snippetActivated()));
|
||||
m_shortcuts.insert(sc, snippet);
|
||||
|
@@ -59,8 +59,6 @@ Q_DECLARE_METATYPE(Snippets::Internal::SnippetSpec *)
|
||||
|
||||
SnippetsWindow::SnippetsWindow()
|
||||
{
|
||||
m_core = SnippetsPlugin::core();
|
||||
|
||||
setWindowTitle(tr("Snippets"));
|
||||
setWindowIcon(QIcon(":/snippets/images/snippets.png"));
|
||||
setOrientation(Qt::Vertical);
|
||||
@@ -79,7 +77,7 @@ SnippetsWindow::SnippetsWindow()
|
||||
if (!initSnippetsDir())
|
||||
setDisabled(true);
|
||||
else {
|
||||
QDir defaultDir(m_core->resourcePath() + QLatin1String("/snippets"));
|
||||
QDir defaultDir(Core::ICore::instance()->resourcePath() + QLatin1String("/snippets"));
|
||||
if (defaultDir.exists())
|
||||
initSnippets(defaultDir);
|
||||
initSnippets(m_snippetsDir);
|
||||
@@ -110,9 +108,9 @@ void SnippetsWindow::activateSnippet(QTreeWidgetItem *item, int column)
|
||||
return;
|
||||
|
||||
TextEditor::ITextEditable *editor = 0;
|
||||
if (m_core->editorManager()->currentEditor())
|
||||
if (Core::ICore::instance()->editorManager()->currentEditor())
|
||||
editor = qobject_cast<TextEditor::ITextEditable *>(
|
||||
m_core->editorManager()->currentEditor());
|
||||
Core::ICore::instance()->editorManager()->currentEditor());
|
||||
if (editor) {
|
||||
SnippetSpec* spec = qVariantValue<SnippetSpec*>(item->data(0, Qt::UserRole));
|
||||
insertSnippet(editor, spec);
|
||||
@@ -229,9 +227,9 @@ void SnippetsWindow::showInputWidget(bool canceled, const QString &value)
|
||||
return;
|
||||
|
||||
TextEditor::ITextEditor *te = 0;
|
||||
if (m_core->editorManager()->currentEditor())
|
||||
if (Core::ICore::instance()->editorManager()->currentEditor())
|
||||
te = qobject_cast<TextEditor::ITextEditor*>(
|
||||
m_core->editorManager()->currentEditor());
|
||||
Core::ICore::instance()->editorManager()->currentEditor());
|
||||
|
||||
int arg = m_requiredArgs.takeFirst();
|
||||
if (arg != -1)
|
||||
|
@@ -44,10 +44,6 @@ class QDir;
|
||||
class QLabel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
class ICore;
|
||||
}
|
||||
|
||||
namespace TextEditor {
|
||||
class ITextEditable;
|
||||
class ITextEditor;
|
||||
@@ -97,7 +93,6 @@ private:
|
||||
SnippetSpec *m_currentSnippet;
|
||||
TextEditor::ITextEditable *m_currentEditor;
|
||||
|
||||
Core::ICore *m_core;
|
||||
QDir m_snippetsDir;
|
||||
|
||||
SnippetsTree *m_snippetsTree;
|
||||
|
187
src/plugins/texteditor/behaviorsettingspage.cpp
Normal 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;
|
||||
}
|
@@ -31,8 +31,8 @@
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef GENERALSETTINGSPAGE_H
|
||||
#define GENERALSETTINGSPAGE_H
|
||||
#ifndef BEHAVIORSETTINGSPAGE_H
|
||||
#define BEHAVIORSETTINGSPAGE_H
|
||||
|
||||
#include "texteditor_global.h"
|
||||
|
||||
@@ -44,10 +44,9 @@ namespace TextEditor {
|
||||
|
||||
struct TabSettings;
|
||||
struct StorageSettings;
|
||||
struct DisplaySettings;
|
||||
struct InteractionSettings;
|
||||
|
||||
struct TEXTEDITOR_EXPORT GeneralSettingsPageParameters
|
||||
struct BehaviorSettingsPageParameters
|
||||
{
|
||||
QString name;
|
||||
QString category;
|
||||
@@ -55,13 +54,13 @@ struct TEXTEDITOR_EXPORT GeneralSettingsPageParameters
|
||||
QString settingsPrefix;
|
||||
};
|
||||
|
||||
class TEXTEDITOR_EXPORT GeneralSettingsPage : public Core::IOptionsPage
|
||||
class BehaviorSettingsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GeneralSettingsPage(const GeneralSettingsPageParameters &p, QObject *parent);
|
||||
virtual ~GeneralSettingsPage();
|
||||
BehaviorSettingsPage(const BehaviorSettingsPageParameters &p, QObject *parent);
|
||||
virtual ~BehaviorSettingsPage();
|
||||
|
||||
// IOptionsPage
|
||||
QString name() const;
|
||||
@@ -74,27 +73,21 @@ public:
|
||||
|
||||
TabSettings tabSettings() const;
|
||||
StorageSettings storageSettings() const;
|
||||
DisplaySettings displaySettings() const;
|
||||
InteractionSettings interactionSettings() const;
|
||||
|
||||
void setDisplaySettings(const DisplaySettings &);
|
||||
|
||||
signals:
|
||||
void tabSettingsChanged(const TextEditor::TabSettings &);
|
||||
void storageSettingsChanged(const TextEditor::StorageSettings &);
|
||||
void displaySettingsChanged(const TextEditor::DisplaySettings &);
|
||||
|
||||
private:
|
||||
void settingsFromUI(TabSettings &rc,
|
||||
StorageSettings &storageSettings,
|
||||
DisplaySettings &displaySettings,
|
||||
InteractionSettings &interactionSettings
|
||||
) const;
|
||||
InteractionSettings &interactionSettings) const;
|
||||
void settingsToUI();
|
||||
struct GeneralSettingsPagePrivate;
|
||||
GeneralSettingsPagePrivate *m_d;
|
||||
struct BehaviorSettingsPagePrivate;
|
||||
BehaviorSettingsPagePrivate *m_d;
|
||||
};
|
||||
|
||||
} // namespace TextEditor
|
||||
|
||||
#endif // GENERALSETTINGSPAGE_H
|
||||
#endif // BEHAVIORSETTINGSPAGE_H
|
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TextEditor::generalSettingsPage</class>
|
||||
<widget class="QWidget" name="TextEditor::generalSettingsPage">
|
||||
<class>TextEditor::BehaviorSettingsPage</class>
|
||||
<widget class="QWidget" name="TextEditor::BehaviorSettingsPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>514</width>
|
||||
<height>475</height>
|
||||
<width>484</width>
|
||||
<height>398</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -255,71 +255,6 @@
|
||||
</widget>
|
||||
</item>
|
||||
<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 &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 &wrapping</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="displayLineNumbers">
|
||||
<property name="text">
|
||||
<string>Display line &numbers</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="visualizeWhitespace">
|
||||
<property name="text">
|
||||
<string>&Visualize whitespace</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="displayFoldingMarkers">
|
||||
<property name="text">
|
||||
<string>Display &folding markers</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="highlightCurrentLine">
|
||||
<property name="text">
|
||||
<string>Highlight current &line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="groupBoxInteractionSettings">
|
||||
<property name="title">
|
||||
<string>Interaction Settings</string>
|
||||
@@ -335,7 +270,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -373,20 +308,14 @@
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>cleanIndentation</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
</connection>
|
||||
<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>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>474</x>
|
||||
<y>308</y>
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
153
src/plugins/texteditor/displaysettingspage.cpp
Normal 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);
|
||||
}
|
||||
}
|
87
src/plugins/texteditor/displaysettingspage.h
Normal 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
|
116
src/plugins/texteditor/displaysettingspage.ui
Normal 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 &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 &wrapping</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="displayLineNumbers">
|
||||
<property name="text">
|
||||
<string>Display line &numbers</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="visualizeWhitespace">
|
||||
<property name="text">
|
||||
<string>&Visualize whitespace</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="displayFoldingMarkers">
|
||||
<property name="text">
|
||||
<string>Display &folding markers</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="highlightCurrentLine">
|
||||
<property name="text">
|
||||
<string>Highlight current &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>
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -9,6 +9,7 @@ SOURCES += texteditorplugin.cpp \
|
||||
plaintexteditorfactory.cpp \
|
||||
basetextdocument.cpp \
|
||||
basetexteditor.cpp \
|
||||
behaviorsettingspage.cpp \
|
||||
texteditoractionhandler.cpp \
|
||||
completionsupport.cpp \
|
||||
completionwidget.cpp \
|
||||
@@ -17,10 +18,10 @@ SOURCES += texteditorplugin.cpp \
|
||||
tabsettings.cpp \
|
||||
storagesettings.cpp \
|
||||
displaysettings.cpp \
|
||||
displaysettingspage.cpp \
|
||||
fontsettings.cpp \
|
||||
textblockiterator.cpp \
|
||||
linenumberfilter.cpp \
|
||||
generalsettingspage.cpp \
|
||||
basetextmark.cpp \
|
||||
findinfiles.cpp \
|
||||
basefilefind.cpp \
|
||||
@@ -32,6 +33,7 @@ HEADERS += texteditorplugin.h \
|
||||
plaintexteditorfactory.h \
|
||||
basetexteditor_p.h \
|
||||
basetextdocument.h \
|
||||
behaviorsettingspage.h \
|
||||
completionsupport.h \
|
||||
completionwidget.h \
|
||||
basetexteditor.h \
|
||||
@@ -43,18 +45,19 @@ HEADERS += texteditorplugin.h \
|
||||
tabsettings.h \
|
||||
storagesettings.h \
|
||||
displaysettings.h \
|
||||
displaysettingspage.h \
|
||||
fontsettings.h \
|
||||
textblockiterator.h \
|
||||
itexteditable.h \
|
||||
itexteditor.h \
|
||||
linenumberfilter.h \
|
||||
texteditor_global.h \
|
||||
generalsettingspage.h \
|
||||
basetextmark.h \
|
||||
findinfiles.h \
|
||||
basefilefind.h \
|
||||
texteditorsettings.h \
|
||||
codecselector.h
|
||||
FORMS += fontsettingspage.ui \
|
||||
generalsettingspage.ui
|
||||
FORMS += behaviorsettingspage.ui \
|
||||
displaysettingspage.ui \
|
||||
fontsettingspage.ui
|
||||
RESOURCES += texteditor.qrc
|
||||
|
@@ -33,8 +33,9 @@
|
||||
|
||||
#include "texteditorsettings.h"
|
||||
|
||||
#include "behaviorsettingspage.h"
|
||||
#include "displaysettings.h"
|
||||
#include "generalsettingspage.h"
|
||||
#include "displaysettingspage.h"
|
||||
#include "fontsettingspage.h"
|
||||
#include "storagesettings.h"
|
||||
#include "tabsettings.h"
|
||||
@@ -93,34 +94,43 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
|
||||
|
||||
m_fontSettingsPage = new FontSettingsPage(formatDescriptions,
|
||||
QLatin1String("TextEditor"),
|
||||
tr("Text Editor"));
|
||||
tr("Text Editor"),
|
||||
this);
|
||||
pm->addObject(m_fontSettingsPage);
|
||||
|
||||
// Add the GUI used to configure the tab, storage and display settings
|
||||
TextEditor::GeneralSettingsPageParameters generalSettingsPageParameters;
|
||||
generalSettingsPageParameters.name = tr("General");
|
||||
generalSettingsPageParameters.category = QLatin1String("TextEditor");
|
||||
generalSettingsPageParameters.trCategory = tr("Text Editor");
|
||||
generalSettingsPageParameters.settingsPrefix = QLatin1String("text");
|
||||
m_generalSettingsPage = new GeneralSettingsPage(generalSettingsPageParameters, this);
|
||||
pm->addObject(m_generalSettingsPage);
|
||||
// Add the GUI used to configure the tab, storage and interaction settings
|
||||
TextEditor::BehaviorSettingsPageParameters behaviorSettingsPageParameters;
|
||||
behaviorSettingsPageParameters.name = tr("Behavior");
|
||||
behaviorSettingsPageParameters.category = QLatin1String("TextEditor");
|
||||
behaviorSettingsPageParameters.trCategory = tr("Text Editor");
|
||||
behaviorSettingsPageParameters.settingsPrefix = QLatin1String("text");
|
||||
m_behaviorSettingsPage = new BehaviorSettingsPage(behaviorSettingsPageParameters, this);
|
||||
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)),
|
||||
this, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)));
|
||||
connect(m_generalSettingsPage, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)),
|
||||
connect(m_behaviorSettingsPage, 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)));
|
||||
connect(m_generalSettingsPage, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
|
||||
connect(m_displaySettingsPage, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
|
||||
this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)));
|
||||
}
|
||||
|
||||
TextEditorSettings::~TextEditorSettings()
|
||||
{
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
pm->removeObject(m_generalSettingsPage);
|
||||
pm->removeObject(m_fontSettingsPage);
|
||||
delete m_fontSettingsPage;
|
||||
pm->removeObject(m_behaviorSettingsPage);
|
||||
pm->removeObject(m_displaySettingsPage);
|
||||
|
||||
m_instance = 0;
|
||||
}
|
||||
@@ -137,15 +147,15 @@ FontSettings TextEditorSettings::fontSettings() const
|
||||
|
||||
TabSettings TextEditorSettings::tabSettings() const
|
||||
{
|
||||
return m_generalSettingsPage->tabSettings();
|
||||
return m_behaviorSettingsPage->tabSettings();
|
||||
}
|
||||
|
||||
StorageSettings TextEditorSettings::storageSettings() const
|
||||
{
|
||||
return m_generalSettingsPage->storageSettings();
|
||||
return m_behaviorSettingsPage->storageSettings();
|
||||
}
|
||||
|
||||
DisplaySettings TextEditorSettings::displaySettings() const
|
||||
{
|
||||
return m_generalSettingsPage->displaySettings();
|
||||
return m_displaySettingsPage->displaySettings();
|
||||
}
|
||||
|
@@ -40,7 +40,8 @@
|
||||
|
||||
namespace TextEditor {
|
||||
|
||||
class GeneralSettingsPage;
|
||||
class BehaviorSettingsPage;
|
||||
class DisplaySettingsPage;
|
||||
class FontSettingsPage;
|
||||
class FontSettings;
|
||||
struct TabSettings;
|
||||
@@ -74,8 +75,9 @@ signals:
|
||||
void displaySettingsChanged(const TextEditor::DisplaySettings &);
|
||||
|
||||
private:
|
||||
TextEditor::FontSettingsPage *m_fontSettingsPage;
|
||||
TextEditor::GeneralSettingsPage *m_generalSettingsPage;
|
||||
FontSettingsPage *m_fontSettingsPage;
|
||||
BehaviorSettingsPage *m_behaviorSettingsPage;
|
||||
DisplaySettingsPage *m_displaySettingsPage;
|
||||
|
||||
static TextEditorSettings *m_instance;
|
||||
};
|
||||
|
@@ -151,21 +151,28 @@ void QrcEditor::updateCurrent()
|
||||
const bool isValid = m_treeview->currentIndex().isValid();
|
||||
const bool isPrefix = m_treeview->isPrefix(m_treeview->currentIndex()) && isValid;
|
||||
const bool isFile = !isPrefix && isValid;
|
||||
int cursorPosition;
|
||||
|
||||
m_ui.aliasLabel->setEnabled(isFile);
|
||||
m_ui.aliasText->setEnabled(isFile);
|
||||
m_currentAlias = m_treeview->currentAlias();
|
||||
cursorPosition = m_ui.aliasText->cursorPosition();
|
||||
m_ui.aliasText->setText(m_currentAlias);
|
||||
m_ui.aliasText->setCursorPosition(cursorPosition);
|
||||
|
||||
m_ui.prefixLabel->setEnabled(isPrefix);
|
||||
m_ui.prefixText->setEnabled(isPrefix);
|
||||
m_currentPrefix = m_treeview->currentPrefix();
|
||||
cursorPosition = m_ui.prefixText->cursorPosition();
|
||||
m_ui.prefixText->setText(m_currentPrefix);
|
||||
m_ui.prefixText->setCursorPosition(cursorPosition);
|
||||
|
||||
m_ui.languageLabel->setEnabled(isPrefix);
|
||||
m_ui.languageText->setEnabled(isPrefix);
|
||||
m_currentLanguage = m_treeview->currentLanguage();
|
||||
cursorPosition = m_ui.languageText->cursorPosition();
|
||||
m_ui.languageText->setText(m_currentLanguage);
|
||||
m_ui.languageText->setCursorPosition(cursorPosition);
|
||||
|
||||
m_ui.addButton->setEnabled(true);
|
||||
m_addFileAction->setEnabled(isValid);
|
||||
|
@@ -17,8 +17,8 @@ class Proxy : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Proxy(QWidget *widget, QObject *parent = 0)
|
||||
: QObject(parent), m_widget(widget)
|
||||
Proxy(QWidget *widget, QMainWindow *mw, QObject *parent = 0)
|
||||
: QObject(parent), m_widget(widget), m_mainWindow(mw)
|
||||
{}
|
||||
|
||||
public slots:
|
||||
@@ -30,13 +30,35 @@ public slots:
|
||||
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)
|
||||
{
|
||||
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:
|
||||
QWidget *m_widget;
|
||||
QMainWindow *m_mainWindow;
|
||||
QString m_statusMessage;
|
||||
QString m_statusData;
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@@ -64,11 +86,11 @@ int main(int argc, char *argv[])
|
||||
//widget->resize(450, 350);
|
||||
widget->setFocus();
|
||||
|
||||
Proxy proxy(widget);
|
||||
QMainWindow mw;
|
||||
Proxy proxy(widget, &mw);
|
||||
|
||||
FakeVimHandler handler(widget, 0);
|
||||
|
||||
QMainWindow mw;
|
||||
mw.setWindowTitle("Fakevim (" + title + ")");
|
||||
mw.setCentralWidget(widget);
|
||||
mw.resize(600, 650);
|
||||
@@ -85,15 +107,16 @@ int main(int argc, char *argv[])
|
||||
mw.statusBar()->setFont(font);
|
||||
|
||||
QObject::connect(&handler, SIGNAL(commandBufferChanged(QString)),
|
||||
mw.statusBar(), SLOT(showMessage(QString)));
|
||||
&proxy, SLOT(changeStatusMessage(QString)));
|
||||
QObject::connect(&handler, SIGNAL(quitRequested()),
|
||||
&app, SLOT(quit()));
|
||||
QObject::connect(&handler,
|
||||
SIGNAL(selectionChanged(QList<QTextEdit::ExtraSelection>)),
|
||||
&proxy, SLOT(changeSelection(QList<QTextEdit::ExtraSelection>)));
|
||||
QObject::connect(&handler,
|
||||
SIGNAL(extraInformationChanged(QString)),
|
||||
QObject::connect(&handler, SIGNAL(extraInformationChanged(QString)),
|
||||
&proxy, SLOT(changeExtraInformation(QString)));
|
||||
QObject::connect(&handler, SIGNAL(statusDataChanged(QString)),
|
||||
&proxy, SLOT(changeStatusData(QString)));
|
||||
|
||||
handler.setupWidget();
|
||||
if (args.size() >= 1)
|
||||
|
@@ -145,14 +145,33 @@ void testQByteArray()
|
||||
|
||||
void testQHash()
|
||||
{
|
||||
#if 1
|
||||
QHash<int, float> hgg0;
|
||||
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;
|
||||
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
|
||||
QHash<QString, float> hgg1;
|
||||
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;
|
||||
hgg2[22] = "22.0";
|
||||
|
||||
@@ -165,6 +184,7 @@ void testQHash()
|
||||
hash.insert("Hallo", QPointer<QObject>(&ob));
|
||||
hash.insert("Welt", QPointer<QObject>(&ob));
|
||||
hash.insert(".", QPointer<QObject>(&ob));
|
||||
#endif
|
||||
}
|
||||
|
||||
void testQImage()
|
||||
@@ -224,7 +244,6 @@ void testQLinkedList()
|
||||
f.append(Foo(1));
|
||||
f.append(Foo(2));
|
||||
#endif
|
||||
|
||||
QLinkedList<std::string> v;
|
||||
v.push_back("aa");
|
||||
v.push_back("bb");
|
||||
@@ -238,7 +257,7 @@ void testQList()
|
||||
QList<int> li;
|
||||
QList<uint> lu;
|
||||
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
for (int i = 0; i != 30; ++i) {
|
||||
li.append(i);
|
||||
}
|
||||
li.append(101);
|
||||
|