forked from qt-creator/qt-creator
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -551,7 +551,7 @@ void QDumper::addCommaIfNeeded()
|
||||
if (pos == 0)
|
||||
return;
|
||||
char c = qDumpOutBuffer[pos - 1];
|
||||
if (c == '}' || c == '\'' || c == ']')
|
||||
if (c == '}' || c == '"' || c == ']')
|
||||
put(',');
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -740,7 +740,7 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr
|
||||
return;
|
||||
case 'B':
|
||||
if (isEqual(type, "QByteArray")) {
|
||||
d << key << "encoded='1',";
|
||||
d << key << "encoded=\"1\",";
|
||||
P(d, key, *(QByteArray*)addr);
|
||||
}
|
||||
return;
|
||||
@@ -769,7 +769,7 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr
|
||||
return;
|
||||
case 'S':
|
||||
if (isEqual(type, "QString")) {
|
||||
d << key << "encoded='1',";
|
||||
d << key << "encoded=\"1\",";
|
||||
P(d, key, *(QString*)addr);
|
||||
}
|
||||
return;
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 294 B After Width: | Height: | Size: 436 B |
@@ -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());
|
||||
|
||||
@@ -133,5 +133,6 @@
|
||||
<glob pattern="*.cxx"/>
|
||||
<glob pattern="*.c++"/>
|
||||
<glob pattern="*.C"/>
|
||||
<glob pattern="*.inl"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
|
||||
@@ -14,6 +14,12 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<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">
|
||||
@@ -44,6 +50,9 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -251,6 +251,7 @@ public:
|
||||
void finish() {} // automatically calls "apply"
|
||||
|
||||
private:
|
||||
friend class DebuggerPlugin;
|
||||
Ui::GdbOptionPage m_ui;
|
||||
|
||||
DebuggerSettings m_settings;
|
||||
@@ -300,6 +301,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;
|
||||
}
|
||||
|
||||
@@ -560,9 +565,6 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
||||
connect(resetToSimpleAction, SIGNAL(triggered()),
|
||||
m_manager, SLOT(setSimpleDockWidgetArrangement()));
|
||||
|
||||
|
||||
m_generalOptionPage = 0;
|
||||
|
||||
// FIXME:
|
||||
m_generalOptionPage = new GdbOptionPage(this);
|
||||
addObject(m_generalOptionPage);
|
||||
|
||||
@@ -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;
|
||||
//}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -2889,11 +2882,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 +3053,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 +3269,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 +3300,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 +3455,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 +3470,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,33 +3486,36 @@ 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) {
|
||||
if (record.resultClass != GdbResultDone) {
|
||||
qDebug() << "STRANGE CUSTOM DUMPER RESULT DATA: " << data.toString();
|
||||
return;
|
||||
}
|
||||
|
||||
GdbMi output = record.data.findChild("consolestreamoutput");
|
||||
QByteArray out = output.data();
|
||||
out = out.mid(out.indexOf('"') + 2); // + 1 is the 'success marker'
|
||||
|
||||
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 = out.replace('\'', '"');
|
||||
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>");
|
||||
data.setError(strNotInScope);
|
||||
insertData(data);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
setWatchDataType(data, contents.findChild("type"));
|
||||
setWatchDataValue(data, contents.findChild("value"),
|
||||
contents.findChild("valueencoded").data().toInt());
|
||||
@@ -3551,6 +3548,8 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
|
||||
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 + ']';
|
||||
//qDebug() << "NAMEENCODED: " << item.findChild("nameencoded").data()
|
||||
// << item.findChild("nameencoded").data()[1];
|
||||
if (item.findChild("nameencoded").data()[0] == '1')
|
||||
@@ -3571,92 +3570,77 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
|
||||
//qDebug() << "HANDLE CUSTOM SUBCONTENTS:" << data1.toString();
|
||||
insertData(data1);
|
||||
}
|
||||
}
|
||||
//qDebug() << "HANDLE CUSTOM VALUE CONTENTS: " << data.toString();
|
||||
} else if (record.resultClass == GdbResultError) {
|
||||
// FIXME: Should not happen here, i.e. could be removed
|
||||
QString msg = record.data.findChild("msg").data();
|
||||
//qDebug() << "CUSTOM DUMPER ERROR MESSAGE: " << msg;
|
||||
if (msg.startsWith("The program being debugged was sig"))
|
||||
msg = strNotInScope;
|
||||
if (msg.startsWith("The program being debugged stopped while"))
|
||||
msg = strNotInScope;
|
||||
data.setError(msg);
|
||||
insertData(data);
|
||||
} else {
|
||||
qDebug() << "STRANGE CUSTOM DUMPER RESULT DATA: " << data.toString();
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
// 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) {
|
||||
} 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) {
|
||||
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::..."
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -780,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());
|
||||
@@ -879,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();
|
||||
@@ -1071,10 +1073,6 @@ 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"
|
||||
@@ -1112,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) {
|
||||
@@ -1223,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) {
|
||||
@@ -2114,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)
|
||||
|
||||
@@ -98,7 +98,7 @@ void HelpManager::registerDocumentation(const QStringList &fileNames)
|
||||
}
|
||||
}
|
||||
if (needsSetup)
|
||||
qDebug() << m_helpEngine->setupData();
|
||||
m_helpEngine->setupData();
|
||||
}
|
||||
|
||||
HelpPlugin::HelpPlugin() :
|
||||
@@ -450,10 +450,13 @@ void HelpPlugin::extensionsInitialized()
|
||||
#endif
|
||||
QHelpEngineCore hc(fi.absoluteFilePath());
|
||||
hc.setupData();
|
||||
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(
|
||||
QLatin1String("UnfilteredFilterInserted")).toInt();
|
||||
|
||||
@@ -74,13 +74,6 @@ public:
|
||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
setUniformRowHeights(true);
|
||||
setTextElideMode(Qt::ElideNone);
|
||||
setAlternatingRowColors(true);
|
||||
QPalette pal = palette();
|
||||
if (pal.base().color() == Qt::white) { // Leave dark themes as they are
|
||||
pal.setBrush(QPalette::AlternateBase, QColor(239, 239, 239));
|
||||
setPalette(pal);
|
||||
}
|
||||
setProperty("AlternateEmpty", true); // Let Manhattan to override style default
|
||||
// setExpandsOnDoubleClick(false);
|
||||
}
|
||||
|
||||
|
||||
187
src/plugins/texteditor/behaviorsettingspage.cpp
Normal file
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
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
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
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;
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user