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