forked from qt-creator/qt-creator
Merge commit 'origin/0.9.1-beta'
This commit is contained in:
@@ -239,7 +239,7 @@ static void appendFileData(QIODevice *out, const QString &fileName)
|
|||||||
|
|
||||||
static void appendFileData(QIODevice *out, QIODevice *in)
|
static void appendFileData(QIODevice *out, QIODevice *in)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!in->isSequential());
|
QTC_ASSERT(!in->isSequential(), return);
|
||||||
qint64 size = in->size();
|
qint64 size = in->size();
|
||||||
QByteArray &b = theBuffer(size);
|
QByteArray &b = theBuffer(size);
|
||||||
rawRead(in, b.data(), size);
|
rawRead(in, b.data(), size);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ QString CGI::encodeURL(const QString &rawText)
|
|||||||
enc.reserve(utf.length()); // Make sure we at least have space for a normal US-ASCII URL
|
enc.reserve(utf.length()); // Make sure we at least have space for a normal US-ASCII URL
|
||||||
|
|
||||||
QByteArray::const_iterator it = utf.constBegin();
|
QByteArray::const_iterator it = utf.constBegin();
|
||||||
while(it != utf.constEnd()) {
|
while (it != utf.constEnd()) {
|
||||||
char ch = *it;
|
char ch = *it;
|
||||||
if (('A' <= ch && ch <= 'Z')
|
if (('A' <= ch && ch <= 'Z')
|
||||||
|| ('a' <= ch && ch <= 'z')
|
|| ('a' <= ch && ch <= 'z')
|
||||||
@@ -54,7 +54,7 @@ QString CGI::encodeURL(const QString &rawText)
|
|||||||
else if (ch == ' ')
|
else if (ch == ' ')
|
||||||
enc.append('+');
|
enc.append('+');
|
||||||
else {
|
else {
|
||||||
switch(ch) {
|
switch (ch) {
|
||||||
case '-': case '_':
|
case '-': case '_':
|
||||||
case '(': case ')':
|
case '(': case ')':
|
||||||
case '.': case '!':
|
case '.': case '!':
|
||||||
@@ -80,15 +80,15 @@ QString CGI::decodeURL(const QString &urlText)
|
|||||||
{
|
{
|
||||||
QByteArray dec;
|
QByteArray dec;
|
||||||
QString::const_iterator it = urlText.constBegin();
|
QString::const_iterator it = urlText.constBegin();
|
||||||
while(it != urlText.constEnd()) {
|
while (it != urlText.constEnd()) {
|
||||||
ushort ch = (*it).unicode();
|
ushort ch = (*it).unicode();
|
||||||
switch(ch) {
|
switch (ch) {
|
||||||
case '%':
|
case '%':
|
||||||
{
|
{
|
||||||
char c1 = char(0x00ff & (*(++it)).unicode());
|
char c1 = char(0x00ff & (*(++it)).unicode());
|
||||||
char c2 = char(0x00ff & (*(++it)).unicode());
|
char c2 = char(0x00ff & (*(++it)).unicode());
|
||||||
ushort v = 0;
|
ushort v = 0;
|
||||||
if('A' <= c1 && c1 <= 'Z')
|
if ('A' <= c1 && c1 <= 'Z')
|
||||||
v = c1 - 'A' + 10;
|
v = c1 - 'A' + 10;
|
||||||
else if ('a' <= c1 && c1 <= 'z')
|
else if ('a' <= c1 && c1 <= 'z')
|
||||||
v = c1 - 'a' + 10;
|
v = c1 - 'a' + 10;
|
||||||
@@ -97,7 +97,7 @@ QString CGI::decodeURL(const QString &urlText)
|
|||||||
else
|
else
|
||||||
continue; // Malformed URL!
|
continue; // Malformed URL!
|
||||||
v <<= 4; // c1 was MSB half
|
v <<= 4; // c1 was MSB half
|
||||||
if('A' <= c2 && c2 <= 'Z')
|
if ('A' <= c2 && c2 <= 'Z')
|
||||||
v |= c2 - 'A' + 10;
|
v |= c2 - 'A' + 10;
|
||||||
else if ('a' <= c2 && c2 <= 'z')
|
else if ('a' <= c2 && c2 <= 'z')
|
||||||
v |= c2 - 'a' + 10;
|
v |= c2 - 'a' + 10;
|
||||||
@@ -123,7 +123,7 @@ QString CGI::decodeURL(const QString &urlText)
|
|||||||
// -------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------
|
||||||
inline const char *unicodeToHTML(ushort unicode_char)
|
inline const char *unicodeToHTML(ushort unicode_char)
|
||||||
{
|
{
|
||||||
switch(unicode_char) {
|
switch (unicode_char) {
|
||||||
// Latin -------------------------------
|
// Latin -------------------------------
|
||||||
case 0x0022: return "quot"; // (34 ) quotation mark = APL quote
|
case 0x0022: return "quot"; // (34 ) quotation mark = APL quote
|
||||||
case 0x0026: return "amp"; // (38 ) ampersand
|
case 0x0026: return "amp"; // (38 ) ampersand
|
||||||
|
|||||||
@@ -66,10 +66,8 @@ FileDataList splitDiffToFiles(const QByteArray &data)
|
|||||||
// The algorithm works like this:
|
// The algorithm works like this:
|
||||||
// On the first match we only get the filename of the first patch part
|
// On the first match we only get the filename of the first patch part
|
||||||
// On the second match (if any) we get the diff content, and the name of the next file patch
|
// On the second match (if any) we get the diff content, and the name of the next file patch
|
||||||
//
|
|
||||||
|
|
||||||
|
while (-1 != (splitIndex = splitExpr.indexIn(strData,splitIndex))) {
|
||||||
while(-1 != (splitIndex = splitExpr.indexIn(strData,splitIndex))) {
|
|
||||||
if (!filename.isEmpty()) {
|
if (!filename.isEmpty()) {
|
||||||
QString content = strData.mid(previousSplit, splitIndex - previousSplit);
|
QString content = strData.mid(previousSplit, splitIndex - previousSplit);
|
||||||
ret.append(FileData(filename, content.toLatin1()));
|
ret.append(FileData(filename, content.toLatin1()));
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ QString View::getComment()
|
|||||||
QByteArray View::getContent()
|
QByteArray View::getContent()
|
||||||
{
|
{
|
||||||
QByteArray newContent;
|
QByteArray newContent;
|
||||||
for(int i = 0; i < m_ui.uiPatchList->count(); ++i) {
|
for (int i = 0; i < m_ui.uiPatchList->count(); ++i) {
|
||||||
QListWidgetItem *item = m_ui.uiPatchList->item(i);
|
QListWidgetItem *item = m_ui.uiPatchList->item(i);
|
||||||
if (item->checkState() != Qt::Unchecked)
|
if (item->checkState() != Qt::Unchecked)
|
||||||
newContent += m_parts.at(i).content;
|
newContent += m_parts.at(i).content;
|
||||||
@@ -159,7 +159,7 @@ int View::show(const QString &user, const QString &description, const QString &c
|
|||||||
QByteArray content;
|
QByteArray content;
|
||||||
m_parts = parts;
|
m_parts = parts;
|
||||||
m_ui.uiPatchList->clear();
|
m_ui.uiPatchList->clear();
|
||||||
foreach(const FileData part, parts) {
|
foreach (const FileData part, parts) {
|
||||||
QListWidgetItem *itm = new QListWidgetItem(part.filename, m_ui.uiPatchList);
|
QListWidgetItem *itm = new QListWidgetItem(part.filename, m_ui.uiPatchList);
|
||||||
itm->setCheckState(Qt::Checked);
|
itm->setCheckState(Qt::Checked);
|
||||||
itm->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
itm->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||||
|
|||||||
@@ -511,6 +511,12 @@ Identifier *Control::findOrInsertIdentifier(const char *chars)
|
|||||||
return findOrInsertIdentifier(chars, length);
|
return findOrInsertIdentifier(chars, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Control::IdentifierIterator Control::firstIdentifier() const
|
||||||
|
{ return d->identifiers.begin(); }
|
||||||
|
|
||||||
|
Control::IdentifierIterator Control::lastIdentifier() const
|
||||||
|
{ return d->identifiers.end(); }
|
||||||
|
|
||||||
StringLiteral *Control::findOrInsertStringLiteral(const char *chars, unsigned size)
|
StringLiteral *Control::findOrInsertStringLiteral(const char *chars, unsigned size)
|
||||||
{ return d->stringLiterals.findOrInsertLiteral(chars, size); }
|
{ return d->stringLiterals.findOrInsertLiteral(chars, size); }
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,11 @@ public:
|
|||||||
Identifier *findOrInsertIdentifier(const char *chars, unsigned size);
|
Identifier *findOrInsertIdentifier(const char *chars, unsigned size);
|
||||||
Identifier *findOrInsertIdentifier(const char *chars);
|
Identifier *findOrInsertIdentifier(const char *chars);
|
||||||
|
|
||||||
|
typedef const Identifier *const *IdentifierIterator;
|
||||||
|
|
||||||
|
IdentifierIterator firstIdentifier() const;
|
||||||
|
IdentifierIterator lastIdentifier() const;
|
||||||
|
|
||||||
StringLiteral *findOrInsertStringLiteral(const char *chars, unsigned size);
|
StringLiteral *findOrInsertStringLiteral(const char *chars, unsigned size);
|
||||||
StringLiteral *findOrInsertStringLiteral(const char *chars);
|
StringLiteral *findOrInsertStringLiteral(const char *chars);
|
||||||
|
|
||||||
|
|||||||
@@ -30,19 +30,22 @@
|
|||||||
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "formresizer.h"
|
#include "formresizer.h"
|
||||||
#include "sizehandlerect.h"
|
#include "sizehandlerect.h"
|
||||||
#include "widgethostconstants.h"
|
#include "widgethostconstants.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtDesigner/QDesignerFormWindowInterface>
|
#include <QtDesigner/QDesignerFormWindowInterface>
|
||||||
|
|
||||||
#include <QtGui/QResizeEvent>
|
#include <QtGui/QResizeEvent>
|
||||||
#include <QtGui/QPalette>
|
#include <QtGui/QPalette>
|
||||||
#include <QtGui/QLayout>
|
#include <QtGui/QLayout>
|
||||||
#include <QtGui/QFrame>
|
#include <QtGui/QFrame>
|
||||||
#include <QtGui/QResizeEvent>
|
#include <QtGui/QResizeEvent>
|
||||||
#include <QtCore/QDebug>
|
|
||||||
|
|
||||||
enum { debugFormResizer=0 };
|
enum { debugFormResizer = 0 };
|
||||||
|
|
||||||
using namespace SharedTools::Internal;
|
using namespace SharedTools::Internal;
|
||||||
|
|
||||||
@@ -140,7 +143,7 @@ void FormResizer::setFormWindow(QDesignerFormWindowInterface *fw)
|
|||||||
if (debugFormResizer)
|
if (debugFormResizer)
|
||||||
qDebug() << "FormResizer::setFormWindow " << fw;
|
qDebug() << "FormResizer::setFormWindow " << fw;
|
||||||
QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(m_frame->layout());
|
QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(m_frame->layout());
|
||||||
Q_ASSERT(layout);
|
QTC_ASSERT(layout, return);
|
||||||
if (layout->count())
|
if (layout->count())
|
||||||
delete layout->takeAt(0);
|
delete layout->takeAt(0);
|
||||||
m_formWindow = fw;
|
m_formWindow = fw;
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ QVariant HelpViewer::loadResource(int type, const QUrl &name)
|
|||||||
|
|
||||||
void HelpViewer::openLinkInNewTab()
|
void HelpViewer::openLinkInNewTab()
|
||||||
{
|
{
|
||||||
if(lastAnchor.isEmpty())
|
if (lastAnchor.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
parentWidget->setSourceInNewTab(QUrl(lastAnchor));
|
parentWidget->setSourceInNewTab(QUrl(lastAnchor));
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
#include "indenter.h"
|
#include "indenter.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace SharedTools::IndenterInternal;
|
using namespace SharedTools::IndenterInternal;
|
||||||
|
|
||||||
// --- Constants
|
// --- Constants
|
||||||
@@ -55,12 +57,12 @@ Constants::Constants() :
|
|||||||
"|(?:public|protected|private|signals|Q_SIGNALS|default)(?:\\s+slots|\\s+Q_SLOTS)?\\s*"
|
"|(?:public|protected|private|signals|Q_SIGNALS|default)(?:\\s+slots|\\s+Q_SLOTS)?\\s*"
|
||||||
")?:.*"))
|
")?:.*"))
|
||||||
{
|
{
|
||||||
m_literal.setMinimal( true );
|
m_literal.setMinimal(true);
|
||||||
m_inlineCComment.setMinimal( true );
|
m_inlineCComment.setMinimal(true);
|
||||||
Q_ASSERT(m_literal.isValid());
|
QTC_ASSERT(m_literal.isValid(), return);
|
||||||
Q_ASSERT(m_label.isValid());
|
QTC_ASSERT(m_label.isValid(), return);
|
||||||
Q_ASSERT(m_inlineCComment.isValid());
|
QTC_ASSERT(m_inlineCComment.isValid(), return);
|
||||||
Q_ASSERT(m_braceX.isValid());
|
QTC_ASSERT(m_braceX.isValid(), return);
|
||||||
Q_ASSERT(m_iflikeKeyword.isValid());
|
QTC_ASSERT(m_iflikeKeyword.isValid(), return);
|
||||||
Q_ASSERT(m_caseLabel.isValid());
|
QTC_ASSERT(m_caseLabel.isValid(), return);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(QString fileName, fileNames)
|
foreach (const QString &fileName, fileNames)
|
||||||
if (const int rc = format(fileName))
|
if (const int rc = format(fileName))
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
#include "procommandmanager.h"
|
#include "procommandmanager.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
|
|
||||||
ProCommandGroup::ProCommandGroup(const QString &name)
|
ProCommandGroup::ProCommandGroup(const QString &name)
|
||||||
@@ -76,7 +78,7 @@ ProCommandManager::~ProCommandManager()
|
|||||||
|
|
||||||
void ProCommandManager::beginGroup(const QString &name)
|
void ProCommandManager::beginGroup(const QString &name)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!m_group);
|
QTC_ASSERT(!m_group, return);
|
||||||
|
|
||||||
if (m_pos != m_groups.count()) {
|
if (m_pos != m_groups.count()) {
|
||||||
int removecount = m_groups.count() - m_pos;
|
int removecount = m_groups.count() - m_pos;
|
||||||
@@ -95,7 +97,7 @@ bool ProCommandManager::hasGroup() const
|
|||||||
|
|
||||||
void ProCommandManager::endGroup()
|
void ProCommandManager::endGroup()
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_group);
|
QTC_ASSERT(m_group, return);
|
||||||
|
|
||||||
m_groups.append(m_group);
|
m_groups.append(m_group);
|
||||||
m_pos = m_groups.count();
|
m_pos = m_groups.count();
|
||||||
@@ -106,7 +108,7 @@ void ProCommandManager::endGroup()
|
|||||||
|
|
||||||
bool ProCommandManager::command(ProCommand *cmd)
|
bool ProCommandManager::command(ProCommand *cmd)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_group);
|
QTC_ASSERT(m_group, return false);
|
||||||
|
|
||||||
if (cmd->redo()) {
|
if (cmd->redo()) {
|
||||||
m_group->appendCommand(cmd);
|
m_group->appendCommand(cmd);
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ bool ProEditor::eventFilter(QObject *, QEvent *event)
|
|||||||
if (event->type() == QEvent::ShortcutOverride) {
|
if (event->type() == QEvent::ShortcutOverride) {
|
||||||
QKeyEvent *k = static_cast<QKeyEvent*>(event);
|
QKeyEvent *k = static_cast<QKeyEvent*>(event);
|
||||||
if (k->modifiers() == Qt::ControlModifier) {
|
if (k->modifiers() == Qt::ControlModifier) {
|
||||||
switch(k->key()) {
|
switch (k->key()) {
|
||||||
case Qt::Key_X:
|
case Qt::Key_X:
|
||||||
cut(); return true;
|
cut(); return true;
|
||||||
case Qt::Key_C:
|
case Qt::Key_C:
|
||||||
@@ -168,11 +168,8 @@ void ProEditor::updatePasteAction()
|
|||||||
bool pasteEnabled = false;
|
bool pasteEnabled = false;
|
||||||
|
|
||||||
const QMimeData *data = QApplication::clipboard()->mimeData();
|
const QMimeData *data = QApplication::clipboard()->mimeData();
|
||||||
if (data) {
|
if (data && data->hasFormat(QLatin1String("application/x-problock")))
|
||||||
if (data->hasFormat(QLatin1String("application/x-problock"))) {
|
|
||||||
pasteEnabled = true;
|
pasteEnabled = true;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_pasteAction->setEnabled(pasteEnabled);
|
m_pasteAction->setEnabled(pasteEnabled);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -732,13 +732,10 @@ bool ProEditorModel::insertItem(ProItem *item, int row, const QModelIndex &paren
|
|||||||
|
|
||||||
void ProEditorModel::markProFileModified(QModelIndex index)
|
void ProEditorModel::markProFileModified(QModelIndex index)
|
||||||
{
|
{
|
||||||
while(index.isValid())
|
while (index.isValid()) {
|
||||||
{
|
if (proItem(index)->kind() == ProItem::BlockKind) {
|
||||||
if( proItem(index)->kind() == ProItem::BlockKind)
|
|
||||||
{
|
|
||||||
ProBlock * block = proBlock(index);
|
ProBlock * block = proBlock(index);
|
||||||
if(block->blockKind() == ProBlock::ProFileKind)
|
if (block->blockKind() == ProBlock::ProFileKind) {
|
||||||
{
|
|
||||||
ProFile * file = static_cast<ProFile *>(block);
|
ProFile * file = static_cast<ProFile *>(block);
|
||||||
file->setModified(true);
|
file->setModified(true);
|
||||||
return;
|
return;
|
||||||
@@ -791,9 +788,9 @@ QString ProEditorModel::expressionToString(ProBlock *block, bool display) const
|
|||||||
{
|
{
|
||||||
QString result;
|
QString result;
|
||||||
QList<ProItem*> items = block->items();
|
QList<ProItem*> items = block->items();
|
||||||
for(int i=0; i<items.count(); ++i) {
|
for (int i = 0; i < items.count(); ++i) {
|
||||||
ProItem *item = items.at(i);
|
ProItem *item = items.at(i);
|
||||||
switch(item->kind()) {
|
switch (item->kind()) {
|
||||||
case ProItem::FunctionKind: {
|
case ProItem::FunctionKind: {
|
||||||
ProFunction *v = static_cast<ProFunction*>(item);
|
ProFunction *v = static_cast<ProFunction*>(item);
|
||||||
result += v->text();
|
result += v->text();
|
||||||
@@ -808,14 +805,16 @@ QString ProEditorModel::expressionToString(ProBlock *block, bool display) const
|
|||||||
} else {
|
} else {
|
||||||
result += v->text();
|
result += v->text();
|
||||||
}
|
}
|
||||||
break; }
|
break;
|
||||||
|
}
|
||||||
case ProItem::OperatorKind: {
|
case ProItem::OperatorKind: {
|
||||||
ProOperator *v = static_cast<ProOperator*>(item);
|
ProOperator *v = static_cast<ProOperator*>(item);
|
||||||
if (v->operatorKind() == ProOperator::NotOperator)
|
if (v->operatorKind() == ProOperator::NotOperator)
|
||||||
result += QLatin1Char('!');
|
result += QLatin1Char('!');
|
||||||
else
|
else
|
||||||
result += QLatin1Char('|');
|
result += QLatin1Char('|');
|
||||||
break; }
|
break;
|
||||||
|
}
|
||||||
case ProItem::ValueKind:
|
case ProItem::ValueKind:
|
||||||
case ProItem::BlockKind:
|
case ProItem::BlockKind:
|
||||||
break; // ### unhandled
|
break; // ### unhandled
|
||||||
@@ -847,7 +846,7 @@ QList<ProItem *> ProEditorModel::stringToExpression(const QString &exp) const
|
|||||||
bool c = false;
|
bool c = false;
|
||||||
|
|
||||||
QString tmpstr;
|
QString tmpstr;
|
||||||
for (int i=0; i<exp.length(); ++i) {
|
for (int i = 0; i < exp.length(); ++i) {
|
||||||
QChar tmpchar = exp.at(i);
|
QChar tmpchar = exp.at(i);
|
||||||
if (tmpchar == '(') ++p;
|
if (tmpchar == '(') ++p;
|
||||||
else if (tmpchar == ')') --p;
|
else if (tmpchar == ')') --p;
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
#include "proparserutils.h"
|
#include "proparserutils.h"
|
||||||
#include "proitems.h"
|
#include "proitems.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
@@ -332,7 +334,7 @@ void ProFileEvaluator::Private::insertOperator(const char op)
|
|||||||
updateItem();
|
updateItem();
|
||||||
|
|
||||||
ProOperator::OperatorKind opkind;
|
ProOperator::OperatorKind opkind;
|
||||||
switch(op) {
|
switch (op) {
|
||||||
case '!':
|
case '!':
|
||||||
opkind = ProOperator::NotOperator;
|
opkind = ProOperator::NotOperator;
|
||||||
break;
|
break;
|
||||||
@@ -532,21 +534,21 @@ bool ProFileEvaluator::Private::visitEndProFile(ProFile * pro)
|
|||||||
evaluateFile(mkspecDirectory + "/features/default_post.prf", &ok);
|
evaluateFile(mkspecDirectory + "/features/default_post.prf", &ok);
|
||||||
|
|
||||||
QStringList processed;
|
QStringList processed;
|
||||||
while(1) {
|
while (1) {
|
||||||
bool finished = true;
|
bool finished = true;
|
||||||
QStringList configs = values("CONFIG");
|
QStringList configs = values("CONFIG");
|
||||||
for(int i = configs.size()-1; i >= 0; --i) {
|
for (int i = configs.size()-1; i >= 0; --i) {
|
||||||
const QString config = configs[i].toLower();
|
const QString config = configs[i].toLower();
|
||||||
if(!processed.contains(config)) {
|
if (!processed.contains(config)) {
|
||||||
processed.append(config);
|
processed.append(config);
|
||||||
evaluateFile(mkspecDirectory + "/features/" + config + ".prf", &ok);
|
evaluateFile(mkspecDirectory + "/features/" + config + ".prf", &ok);
|
||||||
if(ok) {
|
if (ok) {
|
||||||
finished = false;
|
finished = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(finished)
|
if (finished)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -683,7 +685,7 @@ bool ProFileEvaluator::Private::visitProFunction(ProFunction *func)
|
|||||||
QString text = func->text();
|
QString text = func->text();
|
||||||
int lparen = text.indexOf(QLatin1Char('('));
|
int lparen = text.indexOf(QLatin1Char('('));
|
||||||
int rparen = text.lastIndexOf(QLatin1Char(')'));
|
int rparen = text.lastIndexOf(QLatin1Char(')'));
|
||||||
Q_ASSERT(lparen < rparen);
|
QTC_ASSERT(lparen < rparen, return false);
|
||||||
|
|
||||||
QString arguments = text.mid(lparen + 1, rparen - lparen - 1);
|
QString arguments = text.mid(lparen + 1, rparen - lparen - 1);
|
||||||
QString funcName = text.left(lparen);
|
QString funcName = text.left(lparen);
|
||||||
|
|||||||
@@ -173,41 +173,41 @@ static QStringList split_arg_list(QString params)
|
|||||||
const QChar *params_data = params.data();
|
const QChar *params_data = params.data();
|
||||||
const int params_len = params.length();
|
const int params_len = params.length();
|
||||||
int last = 0;
|
int last = 0;
|
||||||
while(last < params_len && ((params_data+last)->unicode() == SPACE
|
while (last < params_len && ((params_data+last)->unicode() == SPACE
|
||||||
/*|| (params_data+last)->unicode() == TAB*/))
|
/*|| (params_data+last)->unicode() == TAB*/))
|
||||||
++last;
|
++last;
|
||||||
for(int x = last, parens = 0; x <= params_len; x++) {
|
for (int x = last, parens = 0; x <= params_len; x++) {
|
||||||
unicode = (params_data+x)->unicode();
|
unicode = (params_data+x)->unicode();
|
||||||
if(x == params_len) {
|
if (x == params_len) {
|
||||||
while(x && (params_data+(x-1))->unicode() == SPACE)
|
while (x && (params_data+(x-1))->unicode() == SPACE)
|
||||||
--x;
|
--x;
|
||||||
QString mid(params_data+last, x-last);
|
QString mid(params_data+last, x-last);
|
||||||
if(quote) {
|
if (quote) {
|
||||||
if(mid[0] == quote && mid[(int)mid.length()-1] == quote)
|
if (mid[0] == quote && mid[(int)mid.length()-1] == quote)
|
||||||
mid = mid.mid(1, mid.length()-2);
|
mid = mid.mid(1, mid.length()-2);
|
||||||
quote = 0;
|
quote = 0;
|
||||||
}
|
}
|
||||||
args << mid;
|
args << mid;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(unicode == LPAREN) {
|
if (unicode == LPAREN) {
|
||||||
--parens;
|
--parens;
|
||||||
} else if(unicode == RPAREN) {
|
} else if (unicode == RPAREN) {
|
||||||
++parens;
|
++parens;
|
||||||
} else if(quote && unicode == quote) {
|
} else if (quote && unicode == quote) {
|
||||||
quote = 0;
|
quote = 0;
|
||||||
} else if(!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) {
|
} else if (!quote && (unicode == SINGLEQUOTE || unicode == DOUBLEQUOTE)) {
|
||||||
quote = unicode;
|
quote = unicode;
|
||||||
} else if(!parens && !quote && unicode == COMMA) {
|
} else if (!parens && !quote && unicode == COMMA) {
|
||||||
QString mid = params.mid(last, x - last).trimmed();
|
QString mid = params.mid(last, x - last).trimmed();
|
||||||
args << mid;
|
args << mid;
|
||||||
last = x+1;
|
last = x+1;
|
||||||
while(last < params_len && ((params_data+last)->unicode() == SPACE
|
while (last < params_len && ((params_data+last)->unicode() == SPACE
|
||||||
/*|| (params_data+last)->unicode() == TAB*/))
|
/*|| (params_data+last)->unicode() == TAB*/))
|
||||||
++last;
|
++last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int i = 0; i < args.count(); i++)
|
for (int i = 0; i < args.count(); i++)
|
||||||
unquote(&args[i]);
|
unquote(&args[i]);
|
||||||
return args;
|
return args;
|
||||||
}
|
}
|
||||||
@@ -227,22 +227,22 @@ static QStringList split_value_list(const QString &vals, bool do_semicolon=false
|
|||||||
|
|
||||||
const QChar *vals_data = vals.data();
|
const QChar *vals_data = vals.data();
|
||||||
const int vals_len = vals.length();
|
const int vals_len = vals.length();
|
||||||
for(int x = 0, parens = 0; x < vals_len; x++) {
|
for (int x = 0, parens = 0; x < vals_len; x++) {
|
||||||
QChar c = vals_data[x];
|
QChar c = vals_data[x];
|
||||||
if (x != vals_len-1 && c == BACKSLASH &&
|
if (x != vals_len-1 && c == BACKSLASH &&
|
||||||
vals_data[x+1].unicode() == '\'' || vals_data[x+1] == DOUBLEQUOTE) {
|
vals_data[x+1].unicode() == '\'' || vals_data[x+1] == DOUBLEQUOTE) {
|
||||||
build += vals_data[x++]; // get that 'escape'
|
build += vals_data[x++]; // get that 'escape'
|
||||||
} else if (!quote.isEmpty() && c == quote.top()) {
|
} else if (!quote.isEmpty() && c == quote.top()) {
|
||||||
quote.pop();
|
quote.pop();
|
||||||
} else if(c == SINGLEQUOTE || c == DOUBLEQUOTE) {
|
} else if (c == SINGLEQUOTE || c == DOUBLEQUOTE) {
|
||||||
quote.push(c);
|
quote.push(c);
|
||||||
} else if(c == RPAREN) {
|
} else if (c == RPAREN) {
|
||||||
--parens;
|
--parens;
|
||||||
} else if(c == LPAREN) {
|
} else if (c == LPAREN) {
|
||||||
++parens;
|
++parens;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!parens && quote.isEmpty() && ((do_semicolon && c == SEMICOLON) ||
|
if (!parens && quote.isEmpty() && ((do_semicolon && c == SEMICOLON) ||
|
||||||
vals_data[x] == Option::field_sep)) {
|
vals_data[x] == Option::field_sep)) {
|
||||||
ret << build;
|
ret << build;
|
||||||
build.clear();
|
build.clear();
|
||||||
@@ -250,7 +250,7 @@ static QStringList split_value_list(const QString &vals, bool do_semicolon=false
|
|||||||
build += vals_data[x];
|
build += vals_data[x];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!build.isEmpty())
|
if (!build.isEmpty())
|
||||||
ret << build;
|
ret << build;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -262,7 +262,7 @@ static QStringList qmake_mkspec_paths()
|
|||||||
QByteArray qmakepath = qgetenv("QMAKEPATH");
|
QByteArray qmakepath = qgetenv("QMAKEPATH");
|
||||||
if (!qmakepath.isEmpty()) {
|
if (!qmakepath.isEmpty()) {
|
||||||
const QStringList lst = splitPathList(QString::fromLocal8Bit(qmakepath));
|
const QStringList lst = splitPathList(QString::fromLocal8Bit(qmakepath));
|
||||||
for(QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
|
for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
|
||||||
ret << ((*it) + concat);
|
ret << ((*it) + concat);
|
||||||
}
|
}
|
||||||
ret << QLibraryInfo::location(QLibraryInfo::DataPath) + concat;
|
ret << QLibraryInfo::location(QLibraryInfo::DataPath) + concat;
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ void ProWriter::writeBlock(ProBlock *block, const QString &indent)
|
|||||||
if (block->blockKind() & ProBlock::VariableKind) {
|
if (block->blockKind() & ProBlock::VariableKind) {
|
||||||
ProVariable *v = static_cast<ProVariable*>(block);
|
ProVariable *v = static_cast<ProVariable*>(block);
|
||||||
m_out << v->variable();
|
m_out << v->variable();
|
||||||
switch(v->variableOperator()) {
|
switch (v->variableOperator()) {
|
||||||
case ProVariable::AddOperator:
|
case ProVariable::AddOperator:
|
||||||
m_out << QLatin1String(" += "); break;
|
m_out << QLatin1String(" += "); break;
|
||||||
case ProVariable::RemoveOperator:
|
case ProVariable::RemoveOperator:
|
||||||
@@ -165,12 +165,12 @@ void ProWriter::writeBlock(ProBlock *block, const QString &indent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<ProItem*> items = block->items();
|
QList<ProItem*> items = block->items();
|
||||||
for (int i=0; i<items.count(); ++i) {
|
for (int i = 0; i < items.count(); ++i) {
|
||||||
m_writeState &= ~LastItem;
|
m_writeState &= ~LastItem;
|
||||||
m_writeState &= ~FirstItem;
|
m_writeState &= ~FirstItem;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
m_writeState |= FirstItem;
|
m_writeState |= FirstItem;
|
||||||
if (i == (items.count()-1))
|
if (i == items.count() - 1)
|
||||||
m_writeState |= LastItem;
|
m_writeState |= LastItem;
|
||||||
writeItem(items.at(i), newindent);
|
writeItem(items.at(i), newindent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ QDomNode ProXmlParser::createItemNode(QDomDocument doc, ProItem *item) const
|
|||||||
tag = doc.createElement(QLatin1String("block"));
|
tag = doc.createElement(QLatin1String("block"));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(ProItem *child, block->items()) {
|
foreach (ProItem *child, block->items()) {
|
||||||
QDomNode childNode = createItemNode(doc, child);
|
QDomNode childNode = createItemNode(doc, child);
|
||||||
if (!childNode.isNull())
|
if (!childNode.isNull())
|
||||||
tag.appendChild(childNode);
|
tag.appendChild(childNode);
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ void ValueEditor::initialize()
|
|||||||
connect(m_itemListWidget, SIGNAL(itemChanged(QListWidgetItem *)),
|
connect(m_itemListWidget, SIGNAL(itemChanged(QListWidgetItem *)),
|
||||||
this, SLOT(updateItemChanges(QListWidgetItem *)));
|
this, SLOT(updateItemChanges(QListWidgetItem *)));
|
||||||
|
|
||||||
foreach(ProVariableInfo *varinfo, m_infomanager->variables()) {
|
foreach (ProVariableInfo *varinfo, m_infomanager->variables()) {
|
||||||
m_varComboBox->addItem(varinfo->name(), varinfo->id());
|
m_varComboBox->addItem(varinfo->name(), varinfo->id());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,13 +33,16 @@
|
|||||||
|
|
||||||
#include "resourcefile_p.h"
|
#include "resourcefile_p.h"
|
||||||
|
|
||||||
#include <QtCore/QtAlgorithms>
|
#include <utils/qtcassert.h>
|
||||||
#include <QtCore/QFile>
|
|
||||||
#include <QtCore/QTextStream>
|
|
||||||
#include <QtCore/QCoreApplication>
|
#include <QtCore/QCoreApplication>
|
||||||
#include <QtCore/QDir>
|
|
||||||
#include <QtCore/QMimeData>
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QFile>
|
||||||
|
#include <QtCore/QMimeData>
|
||||||
|
#include <QtCore/QtAlgorithms>
|
||||||
|
#include <QtCore/QTextStream>
|
||||||
|
|
||||||
#include <QtGui/QIcon>
|
#include <QtGui/QIcon>
|
||||||
#include <QtGui/QImageReader>
|
#include <QtGui/QImageReader>
|
||||||
|
|
||||||
@@ -109,14 +112,14 @@ bool ResourceFile::load()
|
|||||||
const QString language = relt.attribute(QLatin1String("lang"));
|
const QString language = relt.attribute(QLatin1String("lang"));
|
||||||
|
|
||||||
const int idx = indexOfPrefix(prefix);
|
const int idx = indexOfPrefix(prefix);
|
||||||
Prefix * p = NULL;
|
Prefix * p = 0;
|
||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
p = new Prefix(prefix, language);
|
p = new Prefix(prefix, language);
|
||||||
m_prefix_list.append(p);
|
m_prefix_list.append(p);
|
||||||
} else {
|
} else {
|
||||||
p = m_prefix_list[idx];
|
p = m_prefix_list[idx];
|
||||||
}
|
}
|
||||||
Q_ASSERT(p != NULL);
|
QTC_ASSERT(p, return false);
|
||||||
|
|
||||||
QDomElement felt = relt.firstChildElement(QLatin1String("file"));
|
QDomElement felt = relt.firstChildElement(QLatin1String("file"));
|
||||||
for (; !felt.isNull(); felt = felt.nextSiblingElement(QLatin1String("file"))) {
|
for (; !felt.isNull(); felt = felt.nextSiblingElement(QLatin1String("file"))) {
|
||||||
@@ -151,7 +154,7 @@ bool ResourceFile::save()
|
|||||||
|
|
||||||
const QStringList name_list = prefixList();
|
const QStringList name_list = prefixList();
|
||||||
|
|
||||||
foreach (QString name, name_list) {
|
foreach (const QString &name, name_list) {
|
||||||
FileList file_list;
|
FileList file_list;
|
||||||
QString lang;
|
QString lang;
|
||||||
foreach (Prefix *pref, m_prefix_list) {
|
foreach (Prefix *pref, m_prefix_list) {
|
||||||
@@ -164,7 +167,7 @@ bool ResourceFile::save()
|
|||||||
QDomElement relt = doc.createElement(QLatin1String("qresource"));
|
QDomElement relt = doc.createElement(QLatin1String("qresource"));
|
||||||
root.appendChild(relt);
|
root.appendChild(relt);
|
||||||
relt.setAttribute(QLatin1String("prefix"), name);
|
relt.setAttribute(QLatin1String("prefix"), name);
|
||||||
if(!lang.isEmpty())
|
if (!lang.isEmpty())
|
||||||
relt.setAttribute(QLatin1String("lang"), lang);
|
relt.setAttribute(QLatin1String("lang"), lang);
|
||||||
|
|
||||||
foreach (const File *f, file_list) {
|
foreach (const File *f, file_list) {
|
||||||
@@ -247,9 +250,9 @@ bool ResourceFile::isEmpty() const
|
|||||||
|
|
||||||
QStringList ResourceFile::fileList(int pref_idx) const
|
QStringList ResourceFile::fileList(int pref_idx) const
|
||||||
{
|
{
|
||||||
Q_ASSERT((pref_idx >= 0) && (pref_idx < m_prefix_list.count()));
|
|
||||||
const FileList &abs_file_list = m_prefix_list.at(pref_idx)->file_list;
|
|
||||||
QStringList result;
|
QStringList result;
|
||||||
|
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return result);
|
||||||
|
const FileList &abs_file_list = m_prefix_list.at(pref_idx)->file_list;
|
||||||
foreach (const File *abs_file, abs_file_list)
|
foreach (const File *abs_file, abs_file_list)
|
||||||
result.append(relativePath(abs_file->name));
|
result.append(relativePath(abs_file->name));
|
||||||
return result;
|
return result;
|
||||||
@@ -258,9 +261,9 @@ QStringList ResourceFile::fileList(int pref_idx) const
|
|||||||
void ResourceFile::addFile(int prefix_idx, const QString &file, int file_idx)
|
void ResourceFile::addFile(int prefix_idx, const QString &file, int file_idx)
|
||||||
{
|
{
|
||||||
Prefix * const p = m_prefix_list[prefix_idx];
|
Prefix * const p = m_prefix_list[prefix_idx];
|
||||||
Q_ASSERT(p != NULL);
|
QTC_ASSERT(p, return);
|
||||||
FileList &files = p->file_list;
|
FileList &files = p->file_list;
|
||||||
Q_ASSERT((file_idx >= -1) && (file_idx <= files.size()));
|
QTC_ASSERT(file_idx >= -1 && file_idx <= files.size(), return);
|
||||||
if (file_idx == -1)
|
if (file_idx == -1)
|
||||||
file_idx = files.size();
|
file_idx = files.size();
|
||||||
files.insert(file_idx, new File(p, absolutePath(file)));
|
files.insert(file_idx, new File(p, absolutePath(file)));
|
||||||
@@ -272,7 +275,7 @@ void ResourceFile::addPrefix(const QString &prefix, int prefix_idx)
|
|||||||
if (indexOfPrefix(fixed_prefix) != -1)
|
if (indexOfPrefix(fixed_prefix) != -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Q_ASSERT((prefix_idx >= -1) && (prefix_idx <= m_prefix_list.size()));
|
QTC_ASSERT(prefix_idx >= -1 && prefix_idx <= m_prefix_list.size(), return);
|
||||||
if (prefix_idx == -1)
|
if (prefix_idx == -1)
|
||||||
prefix_idx = m_prefix_list.size();
|
prefix_idx = m_prefix_list.size();
|
||||||
m_prefix_list.insert(prefix_idx, new Prefix(fixed_prefix));
|
m_prefix_list.insert(prefix_idx, new Prefix(fixed_prefix));
|
||||||
@@ -280,7 +283,7 @@ void ResourceFile::addPrefix(const QString &prefix, int prefix_idx)
|
|||||||
|
|
||||||
void ResourceFile::removePrefix(int prefix_idx)
|
void ResourceFile::removePrefix(int prefix_idx)
|
||||||
{
|
{
|
||||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||||
Prefix * const p = m_prefix_list.at(prefix_idx);
|
Prefix * const p = m_prefix_list.at(prefix_idx);
|
||||||
delete p;
|
delete p;
|
||||||
m_prefix_list.removeAt(prefix_idx);
|
m_prefix_list.removeAt(prefix_idx);
|
||||||
@@ -288,39 +291,39 @@ void ResourceFile::removePrefix(int prefix_idx)
|
|||||||
|
|
||||||
void ResourceFile::removeFile(int prefix_idx, int file_idx)
|
void ResourceFile::removeFile(int prefix_idx, int file_idx)
|
||||||
{
|
{
|
||||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||||
FileList &fileList = m_prefix_list[prefix_idx]->file_list;
|
FileList &fileList = m_prefix_list[prefix_idx]->file_list;
|
||||||
Q_ASSERT((file_idx >= 0) && (file_idx < fileList.count()));
|
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
|
||||||
delete fileList.at(file_idx);
|
delete fileList.at(file_idx);
|
||||||
fileList.removeAt(file_idx);
|
fileList.removeAt(file_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceFile::replacePrefix(int prefix_idx, const QString &prefix)
|
void ResourceFile::replacePrefix(int prefix_idx, const QString &prefix)
|
||||||
{
|
{
|
||||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||||
m_prefix_list[prefix_idx]->name = fixPrefix(prefix);
|
m_prefix_list[prefix_idx]->name = fixPrefix(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceFile::replaceLang(int prefix_idx, const QString &lang)
|
void ResourceFile::replaceLang(int prefix_idx, const QString &lang)
|
||||||
{
|
{
|
||||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||||
m_prefix_list[prefix_idx]->lang = lang;
|
m_prefix_list[prefix_idx]->lang = lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceFile::replaceAlias(int prefix_idx, int file_idx, const QString &alias)
|
void ResourceFile::replaceAlias(int prefix_idx, int file_idx, const QString &alias)
|
||||||
{
|
{
|
||||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||||
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
||||||
Q_ASSERT((file_idx >= 0) && (file_idx < fileList.count()));
|
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
|
||||||
fileList[file_idx]->alias = alias;
|
fileList[file_idx]->alias = alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ResourceFile::replaceFile(int pref_idx, int file_idx, const QString &file)
|
void ResourceFile::replaceFile(int pref_idx, int file_idx, const QString &file)
|
||||||
{
|
{
|
||||||
Q_ASSERT((pref_idx >= 0) && (pref_idx < m_prefix_list.count()));
|
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return);
|
||||||
FileList &fileList = m_prefix_list.at(pref_idx)->file_list;
|
FileList &fileList = m_prefix_list.at(pref_idx)->file_list;
|
||||||
Q_ASSERT((file_idx >= 0) && (file_idx < fileList.count()));
|
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
|
||||||
fileList[file_idx]->name = file;
|
fileList[file_idx]->name = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +339,7 @@ int ResourceFile::indexOfPrefix(const QString &prefix) const
|
|||||||
|
|
||||||
int ResourceFile::indexOfFile(int pref_idx, const QString &file) const
|
int ResourceFile::indexOfFile(int pref_idx, const QString &file) const
|
||||||
{
|
{
|
||||||
Q_ASSERT((pref_idx >= 0) && (pref_idx < m_prefix_list.count()));
|
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return -1);
|
||||||
Prefix * const p = m_prefix_list.at(pref_idx);
|
Prefix * const p = m_prefix_list.at(pref_idx);
|
||||||
File equalFile(p, absolutePath(file));
|
File equalFile(p, absolutePath(file));
|
||||||
return p->file_list.indexOf(&equalFile);
|
return p->file_list.indexOf(&equalFile);
|
||||||
@@ -370,16 +373,16 @@ bool ResourceFile::contains(const QString &prefix, const QString &file) const
|
|||||||
return false;
|
return false;
|
||||||
if (file.isEmpty())
|
if (file.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
Q_ASSERT((pref_idx >= 0) && (pref_idx < m_prefix_list.count()));
|
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return false);
|
||||||
Prefix * const p = m_prefix_list.at(pref_idx);
|
Prefix * const p = m_prefix_list.at(pref_idx);
|
||||||
Q_ASSERT(p != NULL);
|
QTC_ASSERT(p, return false);
|
||||||
File equalFile(p, absolutePath(file));
|
File equalFile(p, absolutePath(file));
|
||||||
return p->file_list.contains(&equalFile);
|
return p->file_list.contains(&equalFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ResourceFile::contains(int pref_idx, const QString &file) const
|
bool ResourceFile::contains(int pref_idx, const QString &file) const
|
||||||
{
|
{
|
||||||
Q_ASSERT((pref_idx >= 0) && (pref_idx < m_prefix_list.count()));
|
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return false);
|
||||||
Prefix * const p = m_prefix_list.at(pref_idx);
|
Prefix * const p = m_prefix_list.at(pref_idx);
|
||||||
File equalFile(p, absolutePath(file));
|
File equalFile(p, absolutePath(file));
|
||||||
return p->file_list.contains(&equalFile);
|
return p->file_list.contains(&equalFile);
|
||||||
@@ -409,49 +412,49 @@ int ResourceFile::prefixCount() const
|
|||||||
|
|
||||||
QString ResourceFile::prefix(int idx) const
|
QString ResourceFile::prefix(int idx) const
|
||||||
{
|
{
|
||||||
Q_ASSERT((idx >= 0) && (idx < m_prefix_list.count()));
|
QTC_ASSERT((idx >= 0) && (idx < m_prefix_list.count()), return QString());
|
||||||
return m_prefix_list.at(idx)->name;
|
return m_prefix_list.at(idx)->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ResourceFile::lang(int idx) const
|
QString ResourceFile::lang(int idx) const
|
||||||
{
|
{
|
||||||
Q_ASSERT((idx >= 0) && (idx < m_prefix_list.count()));
|
QTC_ASSERT(idx >= 0 && idx < m_prefix_list.count(), return QString());
|
||||||
return m_prefix_list.at(idx)->lang;
|
return m_prefix_list.at(idx)->lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ResourceFile::fileCount(int prefix_idx) const
|
int ResourceFile::fileCount(int prefix_idx) const
|
||||||
{
|
{
|
||||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return 0);
|
||||||
return m_prefix_list.at(prefix_idx)->file_list.size();
|
return m_prefix_list.at(prefix_idx)->file_list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ResourceFile::file(int prefix_idx, int file_idx) const
|
QString ResourceFile::file(int prefix_idx, int file_idx) const
|
||||||
{
|
{
|
||||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return QString());
|
||||||
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
||||||
Q_ASSERT((file_idx >= 0) && (file_idx < fileList.count()));
|
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return QString());
|
||||||
return fileList.at(file_idx)->name;
|
return fileList.at(file_idx)->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ResourceFile::alias(int prefix_idx, int file_idx) const
|
QString ResourceFile::alias(int prefix_idx, int file_idx) const
|
||||||
{
|
{
|
||||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return QString());
|
||||||
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
||||||
Q_ASSERT((file_idx >= 0) && (file_idx < fileList.count()));
|
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return QString());
|
||||||
return fileList.at(file_idx)->alias;
|
return fileList.at(file_idx)->alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * ResourceFile::prefixPointer(int prefixIndex) const
|
void * ResourceFile::prefixPointer(int prefixIndex) const
|
||||||
{
|
{
|
||||||
Q_ASSERT((prefixIndex >= 0) && (prefixIndex < m_prefix_list.count()));
|
QTC_ASSERT(prefixIndex >= 0 && prefixIndex < m_prefix_list.count(), return 0);
|
||||||
return m_prefix_list.at(prefixIndex);
|
return m_prefix_list.at(prefixIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void * ResourceFile::filePointer(int prefixIndex, int fileIndex) const
|
void * ResourceFile::filePointer(int prefixIndex, int fileIndex) const
|
||||||
{
|
{
|
||||||
Q_ASSERT((prefixIndex >= 0) && (prefixIndex < m_prefix_list.count()));
|
QTC_ASSERT(prefixIndex >= 0 && prefixIndex < m_prefix_list.count(), return 0);
|
||||||
FileList &fileList = m_prefix_list.at(prefixIndex)->file_list;
|
FileList &fileList = m_prefix_list.at(prefixIndex)->file_list;
|
||||||
Q_ASSERT((fileIndex >= 0) && (fileIndex < fileList.count()));
|
QTC_ASSERT(fileIndex >= 0 && fileIndex < fileList.count(), return 0);
|
||||||
return fileList.at(fileIndex);
|
return fileList.at(fileIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,28 +500,28 @@ QModelIndex ResourceModel::index(int row, int column, const QModelIndex &parent)
|
|||||||
if (column != 0)
|
if (column != 0)
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
|
||||||
void * internalPointer = NULL;
|
void * internalPointer = 0;
|
||||||
if (parent.isValid()) {
|
if (parent.isValid()) {
|
||||||
void * const pip = parent.internalPointer();
|
void * const pip = parent.internalPointer();
|
||||||
if (pip == NULL)
|
if (pip == 0)
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
|
||||||
// File node
|
// File node
|
||||||
Node * const node = reinterpret_cast<Node *>(pip);
|
Node * const node = reinterpret_cast<Node *>(pip);
|
||||||
Prefix * const prefix = node->prefix();
|
Prefix * const prefix = node->prefix();
|
||||||
Q_ASSERT(prefix != NULL);
|
QTC_ASSERT(prefix, return QModelIndex());
|
||||||
if ((row < 0) || (row >= prefix->file_list.count()))
|
if (row < 0 || row >= prefix->file_list.count())
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
const int prefixIndex = m_resource_file.prefixPointerIndex(prefix);
|
const int prefixIndex = m_resource_file.prefixPointerIndex(prefix);
|
||||||
const int fileIndex = row;
|
const int fileIndex = row;
|
||||||
internalPointer = m_resource_file.filePointer(prefixIndex, fileIndex);
|
internalPointer = m_resource_file.filePointer(prefixIndex, fileIndex);
|
||||||
} else {
|
} else {
|
||||||
// Prefix node
|
// Prefix node
|
||||||
if ((row < 0) || (row >= m_resource_file.prefixCount()))
|
if (row < 0 || row >= m_resource_file.prefixCount())
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
internalPointer = m_resource_file.prefixPointer(row);
|
internalPointer = m_resource_file.prefixPointer(row);
|
||||||
}
|
}
|
||||||
Q_ASSERT(internalPointer != NULL);
|
QTC_ASSERT(internalPointer, return QModelIndex());
|
||||||
return createIndex(row, 0, internalPointer);
|
return createIndex(row, 0, internalPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -528,16 +531,16 @@ QModelIndex ResourceModel::parent(const QModelIndex &index) const
|
|||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
|
|
||||||
void * const internalPointer = index.internalPointer();
|
void * const internalPointer = index.internalPointer();
|
||||||
if (internalPointer == NULL)
|
if (internalPointer == 0)
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||||
Prefix * const prefix = node->prefix();
|
Prefix * const prefix = node->prefix();
|
||||||
Q_ASSERT(prefix != NULL);
|
QTC_ASSERT(prefix, return QModelIndex());
|
||||||
bool const isFileNode = (prefix != node);
|
bool const isFileNode = (prefix != node);
|
||||||
|
|
||||||
if (isFileNode) {
|
if (isFileNode) {
|
||||||
const int row = m_resource_file.prefixPointerIndex(prefix);
|
const int row = m_resource_file.prefixPointerIndex(prefix);
|
||||||
Q_ASSERT(row >= 0);
|
QTC_ASSERT(row >= 0, return QModelIndex());
|
||||||
return createIndex(row, 0, prefix);
|
return createIndex(row, 0, prefix);
|
||||||
} else {
|
} else {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
@@ -550,7 +553,7 @@ int ResourceModel::rowCount(const QModelIndex &parent) const
|
|||||||
void * const internalPointer = parent.internalPointer();
|
void * const internalPointer = parent.internalPointer();
|
||||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||||
Prefix * const prefix = node->prefix();
|
Prefix * const prefix = node->prefix();
|
||||||
Q_ASSERT(prefix != NULL);
|
QTC_ASSERT(prefix, return 0);
|
||||||
bool const isFileNode = (prefix != node);
|
bool const isFileNode = (prefix != node);
|
||||||
|
|
||||||
if (isFileNode) {
|
if (isFileNode) {
|
||||||
@@ -609,7 +612,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
|||||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||||
Prefix const * const prefix = node->prefix();
|
Prefix const * const prefix = node->prefix();
|
||||||
File const * const file = node->file();
|
File const * const file = node->file();
|
||||||
Q_ASSERT(prefix != NULL);
|
QTC_ASSERT(prefix, return QVariant());
|
||||||
bool const isFileNode = (prefix != node);
|
bool const isFileNode = (prefix != node);
|
||||||
|
|
||||||
QVariant result;
|
QVariant result;
|
||||||
@@ -622,14 +625,14 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
|||||||
// Prefix node
|
// Prefix node
|
||||||
stringRes = prefix->name;
|
stringRes = prefix->name;
|
||||||
const QString &lang = prefix->lang;
|
const QString &lang = prefix->lang;
|
||||||
if(!lang.isEmpty())
|
if (!lang.isEmpty())
|
||||||
appendParenthesized(lang, stringRes);
|
appendParenthesized(lang, stringRes);
|
||||||
} else {
|
} else {
|
||||||
// File node
|
// File node
|
||||||
Q_ASSERT(file != NULL);
|
QTC_ASSERT(file, return result);
|
||||||
stringRes = QFileInfo(file->name).fileName();
|
stringRes = QFileInfo(file->name).fileName();
|
||||||
const QString alias = file->alias;
|
const QString alias = file->alias;
|
||||||
if(!alias.isEmpty())
|
if (!alias.isEmpty())
|
||||||
appendParenthesized(alias, stringRes);
|
appendParenthesized(alias, stringRes);
|
||||||
}
|
}
|
||||||
result = stringRes;
|
result = stringRes;
|
||||||
@@ -638,7 +641,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
|||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
if (isFileNode) {
|
if (isFileNode) {
|
||||||
// File node
|
// File node
|
||||||
Q_ASSERT(file != NULL);
|
QTC_ASSERT(file, return result);
|
||||||
const QString path = m_resource_file.absolutePath(file->name);
|
const QString path = m_resource_file.absolutePath(file->name);
|
||||||
if (iconFileExtension(path)) {
|
if (iconFileExtension(path)) {
|
||||||
const QIcon icon(path);
|
const QIcon icon(path);
|
||||||
@@ -650,11 +653,11 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
|||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
if (isFileNode) {
|
if (isFileNode) {
|
||||||
// File node
|
// File node
|
||||||
Q_ASSERT(file != NULL);
|
QTC_ASSERT(file, return result);
|
||||||
QString conv_file = m_resource_file.relativePath(file->name);
|
QString conv_file = m_resource_file.relativePath(file->name);
|
||||||
QString stringRes = conv_file.replace(QDir::separator(), QLatin1Char('/'));
|
QString stringRes = conv_file.replace(QDir::separator(), QLatin1Char('/'));
|
||||||
const QString &alias_file = file->alias;
|
const QString &alias_file = file->alias;
|
||||||
if(!alias_file.isEmpty())
|
if (!alias_file.isEmpty())
|
||||||
appendParenthesized(alias_file, stringRes);
|
appendParenthesized(alias_file, stringRes);
|
||||||
|
|
||||||
result = stringRes;
|
result = stringRes;
|
||||||
@@ -679,12 +682,12 @@ void ResourceModel::getItem(const QModelIndex &index, QString &prefix, QString &
|
|||||||
void * const internalPointer = index.internalPointer();
|
void * const internalPointer = index.internalPointer();
|
||||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||||
Prefix * const p = node->prefix();
|
Prefix * const p = node->prefix();
|
||||||
Q_ASSERT(p != NULL);
|
QTC_ASSERT(p, return);
|
||||||
bool const isFileNode = (p != node);
|
bool const isFileNode = (p != node);
|
||||||
|
|
||||||
if (isFileNode) {
|
if (isFileNode) {
|
||||||
File * const f = node->file();
|
File *const f = node->file();
|
||||||
Q_ASSERT(f != NULL);
|
QTC_ASSERT(f, return);
|
||||||
if (!f->alias.isEmpty())
|
if (!f->alias.isEmpty())
|
||||||
file = f->alias;
|
file = f->alias;
|
||||||
else
|
else
|
||||||
@@ -696,7 +699,7 @@ void ResourceModel::getItem(const QModelIndex &index, QString &prefix, QString &
|
|||||||
|
|
||||||
QString ResourceModel::lang(const QModelIndex &index) const
|
QString ResourceModel::lang(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid())
|
if (!index.isValid())
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
return m_resource_file.lang(index.row());
|
return m_resource_file.lang(index.row());
|
||||||
@@ -704,14 +707,14 @@ QString ResourceModel::lang(const QModelIndex &index) const
|
|||||||
|
|
||||||
QString ResourceModel::alias(const QModelIndex &index) const
|
QString ResourceModel::alias(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid() || !index.parent().isValid())
|
if (!index.isValid() || !index.parent().isValid())
|
||||||
return QString();
|
return QString();
|
||||||
return m_resource_file.alias(index.parent().row(), index.row());
|
return m_resource_file.alias(index.parent().row(), index.row());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ResourceModel::file(const QModelIndex &index) const
|
QString ResourceModel::file(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(!index.isValid() || !index.parent().isValid())
|
if (!index.isValid() || !index.parent().isValid())
|
||||||
return QString();
|
return QString();
|
||||||
return m_resource_file.file(index.parent().row(), index.row());
|
return m_resource_file.file(index.parent().row(), index.row());
|
||||||
}
|
}
|
||||||
@@ -852,7 +855,7 @@ void ResourceModel::changePrefix(const QModelIndex &model_idx, const QString &pr
|
|||||||
if (m_resource_file.prefix(prefix_idx) == ResourceFile::fixPrefix(prefix))
|
if (m_resource_file.prefix(prefix_idx) == ResourceFile::fixPrefix(prefix))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(m_resource_file.contains(prefix))
|
if (m_resource_file.contains(prefix))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_resource_file.replacePrefix(prefix_idx, prefix);
|
m_resource_file.replacePrefix(prefix_idx, prefix);
|
||||||
@@ -880,7 +883,7 @@ void ResourceModel::changeAlias(const QModelIndex &index, const QString &alias)
|
|||||||
if (!index.parent().isValid())
|
if (!index.parent().isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(m_resource_file.alias(index.parent().row(), index.row()) == alias)
|
if (m_resource_file.alias(index.parent().row(), index.row()) == alias)
|
||||||
return;
|
return;
|
||||||
m_resource_file.replaceAlias(index.parent().row(), index.row(), alias);
|
m_resource_file.replaceAlias(index.parent().row(), index.row(), alias);
|
||||||
emit dataChanged(index, index);
|
emit dataChanged(index, index);
|
||||||
|
|||||||
@@ -36,10 +36,12 @@
|
|||||||
|
|
||||||
#include "namespace_global.h"
|
#include "namespace_global.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QtCore/QAbstractItemModel>
|
||||||
|
#include <QtCore/QMap>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QtCore/QMap>
|
|
||||||
#include <QtCore/QAbstractItemModel>
|
|
||||||
|
|
||||||
#include "shared_global_p.h"
|
#include "shared_global_p.h"
|
||||||
|
|
||||||
@@ -66,11 +68,11 @@ class Node
|
|||||||
protected:
|
protected:
|
||||||
Node(File *file, Prefix *prefix) : m_file(file), m_prefix(prefix)
|
Node(File *file, Prefix *prefix) : m_file(file), m_prefix(prefix)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_prefix != NULL);
|
QTC_ASSERT(m_prefix, return);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
File * file() { return m_file; }
|
File *file() { return m_file; }
|
||||||
Prefix * prefix() { Q_ASSERT(m_prefix != NULL); return m_prefix; }
|
Prefix *prefix() { return m_prefix; }
|
||||||
private:
|
private:
|
||||||
File *m_file;
|
File *m_file;
|
||||||
Prefix *m_prefix;
|
Prefix *m_prefix;
|
||||||
|
|||||||
@@ -32,16 +32,20 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "resourceview.h"
|
#include "resourceview.h"
|
||||||
|
|
||||||
#include "undocommands_p.h"
|
#include "undocommands_p.h"
|
||||||
|
|
||||||
#include <QtGui/QHeaderView>
|
#include <utils/qtcassert.h>
|
||||||
#include <QtGui/QMenu>
|
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QMouseEvent>
|
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QInputDialog>
|
|
||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
#include <QtCore/QtDebug>
|
#include <QtGui/QHeaderView>
|
||||||
|
#include <QtGui/QInputDialog>
|
||||||
|
#include <QtGui/QMenu>
|
||||||
|
#include <QtGui/QMouseEvent>
|
||||||
#include <QtGui/QUndoStack>
|
#include <QtGui/QUndoStack>
|
||||||
|
|
||||||
namespace SharedTools {
|
namespace SharedTools {
|
||||||
@@ -308,14 +312,14 @@ void ResourceView::findSamePlacePostDeletionModelIndex(int &row, QModelIndex &pa
|
|||||||
|
|
||||||
EntryBackup * ResourceView::removeEntry(const QModelIndex &index)
|
EntryBackup * ResourceView::removeEntry(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_qrcModel != NULL);
|
QTC_ASSERT(m_qrcModel, return 0);
|
||||||
return m_qrcModel->removeEntry(index);
|
return m_qrcModel->removeEntry(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceView::addFiles(int prefixIndex, const QStringList &fileNames, int cursorFile,
|
void ResourceView::addFiles(int prefixIndex, const QStringList &fileNames, int cursorFile,
|
||||||
int &firstFile, int &lastFile)
|
int &firstFile, int &lastFile)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_qrcModel != NULL);
|
QTC_ASSERT(m_qrcModel, return);
|
||||||
m_qrcModel->addFiles(prefixIndex, fileNames, cursorFile, firstFile, lastFile);
|
m_qrcModel->addFiles(prefixIndex, fileNames, cursorFile, firstFile, lastFile);
|
||||||
|
|
||||||
// Expand prefix node
|
// Expand prefix node
|
||||||
@@ -327,11 +331,11 @@ void ResourceView::addFiles(int prefixIndex, const QStringList &fileNames, int c
|
|||||||
|
|
||||||
void ResourceView::removeFiles(int prefixIndex, int firstFileIndex, int lastFileIndex)
|
void ResourceView::removeFiles(int prefixIndex, int firstFileIndex, int lastFileIndex)
|
||||||
{
|
{
|
||||||
Q_ASSERT((prefixIndex >= 0) && (prefixIndex < m_qrcModel->rowCount(QModelIndex())));
|
QTC_ASSERT(prefixIndex >= 0 && prefixIndex < m_qrcModel->rowCount(QModelIndex()), return);
|
||||||
const QModelIndex prefixModelIndex = m_qrcModel->index(prefixIndex, 0, QModelIndex());
|
const QModelIndex prefixModelIndex = m_qrcModel->index(prefixIndex, 0, QModelIndex());
|
||||||
Q_ASSERT(prefixModelIndex != QModelIndex());
|
QTC_ASSERT(prefixModelIndex != QModelIndex(), return);
|
||||||
Q_ASSERT((firstFileIndex >= 0) && (firstFileIndex < m_qrcModel->rowCount(prefixModelIndex)));
|
QTC_ASSERT(firstFileIndex >= 0 && firstFileIndex < m_qrcModel->rowCount(prefixModelIndex), return);
|
||||||
Q_ASSERT((lastFileIndex >= 0) && (lastFileIndex < m_qrcModel->rowCount(prefixModelIndex)));
|
QTC_ASSERT(lastFileIndex >= 0 && lastFileIndex < m_qrcModel->rowCount(prefixModelIndex), return);
|
||||||
|
|
||||||
for (int i = lastFileIndex; i >= firstFileIndex; i--) {
|
for (int i = lastFileIndex; i >= firstFileIndex; i--) {
|
||||||
const QModelIndex index = m_qrcModel->index(i, 0, prefixModelIndex);
|
const QModelIndex index = m_qrcModel->index(i, 0, prefixModelIndex);
|
||||||
@@ -476,7 +480,7 @@ bool ResourceView::load(QString fileName)
|
|||||||
const QFileInfo fi(fileName);
|
const QFileInfo fi(fileName);
|
||||||
m_qrcModel->setFileName(fi.absoluteFilePath());
|
m_qrcModel->setFileName(fi.absoluteFilePath());
|
||||||
|
|
||||||
if(!fi.exists())
|
if (!fi.exists())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const bool result = m_qrcModel->reload();
|
const bool result = m_qrcModel->reload();
|
||||||
@@ -501,9 +505,8 @@ void ResourceView::changePrefix(const QModelIndex &index)
|
|||||||
QString const prefixAfter = QInputDialog::getText(this, tr("Change Prefix"), tr("Input Prefix:"),
|
QString const prefixAfter = QInputDialog::getText(this, tr("Change Prefix"), tr("Input Prefix:"),
|
||||||
QLineEdit::Normal, prefixBefore, &ok);
|
QLineEdit::Normal, prefixBefore, &ok);
|
||||||
|
|
||||||
if (ok) {
|
if (ok)
|
||||||
addUndoCommand(preindex, PrefixProperty, prefixBefore, prefixAfter);
|
addUndoCommand(preindex, PrefixProperty, prefixBefore, prefixAfter);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceView::changeLang(const QModelIndex &index)
|
void ResourceView::changeLang(const QModelIndex &index)
|
||||||
@@ -522,7 +525,7 @@ void ResourceView::changeLang(const QModelIndex &index)
|
|||||||
|
|
||||||
void ResourceView::changeAlias(const QModelIndex &index)
|
void ResourceView::changeAlias(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if(!index.parent().isValid())
|
if (!index.parent().isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
@@ -531,9 +534,8 @@ void ResourceView::changeAlias(const QModelIndex &index)
|
|||||||
QString const aliasAfter = QInputDialog::getText(this, tr("Change File Alias"), tr("Alias:"),
|
QString const aliasAfter = QInputDialog::getText(this, tr("Change File Alias"), tr("Alias:"),
|
||||||
QLineEdit::Normal, aliasBefore, &ok);
|
QLineEdit::Normal, aliasBefore, &ok);
|
||||||
|
|
||||||
if (ok) {
|
if (ok)
|
||||||
addUndoCommand(index, AliasProperty, aliasBefore, aliasAfter);
|
addUndoCommand(index, AliasProperty, aliasBefore, aliasAfter);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ResourceView::currentAlias() const
|
QString ResourceView::currentAlias() const
|
||||||
@@ -570,7 +572,7 @@ QString ResourceView::getCurrentValue(NodeProperty property) const
|
|||||||
case AliasProperty: return currentAlias();
|
case AliasProperty: return currentAlias();
|
||||||
case PrefixProperty: return currentPrefix();
|
case PrefixProperty: return currentPrefix();
|
||||||
case LanguageProperty: return currentLanguage();
|
case LanguageProperty: return currentLanguage();
|
||||||
default: Q_ASSERT(false); return QString(); // Kill warning
|
default: QTC_ASSERT(false, /**/); return QString(); // Kill warning
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -581,19 +583,20 @@ void ResourceView::changeValue(const QModelIndex &nodeIndex, NodeProperty proper
|
|||||||
case AliasProperty: m_qrcModel->changeAlias(nodeIndex, value); return;
|
case AliasProperty: m_qrcModel->changeAlias(nodeIndex, value); return;
|
||||||
case PrefixProperty: m_qrcModel->changePrefix(nodeIndex, value); return;
|
case PrefixProperty: m_qrcModel->changePrefix(nodeIndex, value); return;
|
||||||
case LanguageProperty: m_qrcModel->changeLang(nodeIndex, value); return;
|
case LanguageProperty: m_qrcModel->changeLang(nodeIndex, value); return;
|
||||||
default: Q_ASSERT(false);
|
default: QTC_ASSERT(false, /**/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceView::advanceMergeId() {
|
void ResourceView::advanceMergeId()
|
||||||
|
{
|
||||||
m_mergeId++;
|
m_mergeId++;
|
||||||
if (m_mergeId < 0) {
|
if (m_mergeId < 0)
|
||||||
m_mergeId = 0;
|
m_mergeId = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceView::addUndoCommand(const QModelIndex &nodeIndex, NodeProperty property,
|
void ResourceView::addUndoCommand(const QModelIndex &nodeIndex, NodeProperty property,
|
||||||
const QString &before, const QString &after) {
|
const QString &before, const QString &after)
|
||||||
|
{
|
||||||
QUndoCommand * const command = new ModifyPropertyCommand(this, nodeIndex, property,
|
QUndoCommand * const command = new ModifyPropertyCommand(this, nodeIndex, property,
|
||||||
m_mergeId, before, after);
|
m_mergeId, before, after);
|
||||||
m_history->push(command);
|
m_history->push(command);
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ bool ModifyPropertyCommand::mergeWith(const QUndoCommand * command)
|
|||||||
{
|
{
|
||||||
const ModifyPropertyCommand * const brother
|
const ModifyPropertyCommand * const brother
|
||||||
= dynamic_cast<const ModifyPropertyCommand *>(command);
|
= dynamic_cast<const ModifyPropertyCommand *>(command);
|
||||||
if (command == NULL || m_property != brother->m_property)
|
if (command == 0 || m_property != brother->m_property)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Choose older command (this) and forgot the other
|
// Choose older command (this) and forgot the other
|
||||||
@@ -101,7 +101,7 @@ bool ModifyPropertyCommand::mergeWith(const QUndoCommand * command)
|
|||||||
|
|
||||||
void ModifyPropertyCommand::undo()
|
void ModifyPropertyCommand::undo()
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_view != NULL);
|
QTC_ASSERT(m_view, return);
|
||||||
|
|
||||||
// Save current text in m_after for redo()
|
// Save current text in m_after for redo()
|
||||||
m_after = m_view->getCurrentValue(m_property);
|
m_after = m_view->getCurrentValue(m_property);
|
||||||
@@ -117,12 +117,12 @@ void ModifyPropertyCommand::redo()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Bring back text before undo
|
// Bring back text before undo
|
||||||
Q_ASSERT(m_view != NULL);
|
QTC_ASSERT(m_view, return);
|
||||||
m_view->changeValue(makeIndex(), m_property, m_after);
|
m_view->changeValue(makeIndex(), m_property, m_after);
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveEntryCommand::RemoveEntryCommand(ResourceView *view, const QModelIndex &index)
|
RemoveEntryCommand::RemoveEntryCommand(ResourceView *view, const QModelIndex &index)
|
||||||
: ModelIndexViewCommand(view), m_entry(NULL), m_isExpanded(true)
|
: ModelIndexViewCommand(view), m_entry(0), m_isExpanded(true)
|
||||||
{
|
{
|
||||||
storeIndex(index);
|
storeIndex(index);
|
||||||
}
|
}
|
||||||
@@ -142,9 +142,9 @@ void RemoveEntryCommand::redo()
|
|||||||
|
|
||||||
void RemoveEntryCommand::undo()
|
void RemoveEntryCommand::undo()
|
||||||
{
|
{
|
||||||
if (m_entry != NULL) {
|
if (m_entry == 0) {
|
||||||
m_entry->restore();
|
m_entry->restore();
|
||||||
Q_ASSERT(m_view != NULL);
|
QTC_ASSERT(m_view != 0, return);
|
||||||
const QModelIndex index = makeIndex();
|
const QModelIndex index = makeIndex();
|
||||||
m_view->setExpanded(index, m_isExpanded);
|
m_view->setExpanded(index, m_isExpanded);
|
||||||
m_view->setCurrentIndex(index);
|
m_view->setCurrentIndex(index);
|
||||||
@@ -155,7 +155,7 @@ void RemoveEntryCommand::undo()
|
|||||||
void RemoveEntryCommand::freeEntry()
|
void RemoveEntryCommand::freeEntry()
|
||||||
{
|
{
|
||||||
delete m_entry;
|
delete m_entry;
|
||||||
m_entry = NULL;
|
m_entry = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
AddFilesCommand::AddFilesCommand(ResourceView *view, int prefixIndex, int cursorFileIndex,
|
AddFilesCommand::AddFilesCommand(ResourceView *view, int prefixIndex, int cursorFileIndex,
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ static PProcessIdToSessionId pProcessIdToSessionId = 0;
|
|||||||
|
|
||||||
namespace SharedTools {
|
namespace SharedTools {
|
||||||
|
|
||||||
const char* QtLocalPeer::ack = "ack";
|
const char *QtLocalPeer::ack = "ack";
|
||||||
|
|
||||||
QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
|
QtLocalPeer::QtLocalPeer(QObject *parent, const QString &appId)
|
||||||
: QObject(parent), id(appId)
|
: QObject(parent), id(appId)
|
||||||
{
|
{
|
||||||
if (id.isEmpty())
|
if (id.isEmpty())
|
||||||
@@ -86,8 +86,6 @@ QtLocalPeer::QtLocalPeer(QObject* parent, const QString &appId)
|
|||||||
lockFile.open(QIODevice::ReadWrite);
|
lockFile.open(QIODevice::ReadWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool QtLocalPeer::isClient()
|
bool QtLocalPeer::isClient()
|
||||||
{
|
{
|
||||||
if (lockFile.isLocked())
|
if (lockFile.isLocked())
|
||||||
@@ -105,7 +103,6 @@ bool QtLocalPeer::isClient()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool QtLocalPeer::sendMessage(const QString &message, int timeout)
|
bool QtLocalPeer::sendMessage(const QString &message, int timeout)
|
||||||
{
|
{
|
||||||
if (!isClient())
|
if (!isClient())
|
||||||
@@ -113,7 +110,7 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout)
|
|||||||
|
|
||||||
QLocalSocket socket;
|
QLocalSocket socket;
|
||||||
bool connOk = false;
|
bool connOk = false;
|
||||||
for(int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
// Try twice, in case the other instance is just starting up
|
// Try twice, in case the other instance is just starting up
|
||||||
socket.connectToServer(socketName);
|
socket.connectToServer(socketName);
|
||||||
connOk = socket.waitForConnected(timeout/2);
|
connOk = socket.waitForConnected(timeout/2);
|
||||||
@@ -139,7 +136,6 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QtLocalPeer::receiveConnection()
|
void QtLocalPeer::receiveConnection()
|
||||||
{
|
{
|
||||||
QLocalSocket* socket = server->nextPendingConnection();
|
QLocalSocket* socket = server->nextPendingConnection();
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
#ifndef WRAP_HELPERS_H
|
#ifndef WRAP_HELPERS_H
|
||||||
#define WRAP_HELPERS_H
|
#define WRAP_HELPERS_H
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtScript/QScriptEngine>
|
#include <QtScript/QScriptEngine>
|
||||||
#include <QtScript/QScriptContext>
|
#include <QtScript/QScriptContext>
|
||||||
#include <QtScript/QScriptValue>
|
#include <QtScript/QScriptValue>
|
||||||
@@ -87,7 +89,7 @@ template <class Wrapper, class Wrapped>
|
|||||||
Wrapped * (Wrapper::*wrappedAccessor) () const)
|
Wrapped * (Wrapper::*wrappedAccessor) () const)
|
||||||
{
|
{
|
||||||
Wrapped *wrapped = wrappedFromScriptValue(context->thisObject(), wrappedAccessor);
|
Wrapped *wrapped = wrappedFromScriptValue(context->thisObject(), wrappedAccessor);
|
||||||
Q_ASSERT(wrapped);
|
QTC_ASSERT(wrapped, return 0);
|
||||||
return wrapped;
|
return wrapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +316,7 @@ static void scriptValueToQObject(const QScriptValue &sv, SomeQObject * &p)
|
|||||||
{
|
{
|
||||||
QObject *qObject = sv.toQObject();
|
QObject *qObject = sv.toQObject();
|
||||||
p = qobject_cast<SomeQObject*>(qObject);
|
p = qobject_cast<SomeQObject*>(qObject);
|
||||||
Q_ASSERT(p);
|
QTC_ASSERT(p, return);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register a QObject-derived class which has Q_DECLARE_METATYPE(Ptr*)
|
// Register a QObject-derived class which has Q_DECLARE_METATYPE(Ptr*)
|
||||||
|
|||||||
@@ -32,6 +32,9 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "CppDocument.h"
|
#include "CppDocument.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <Control.h>
|
#include <Control.h>
|
||||||
#include <TranslationUnit.h>
|
#include <TranslationUnit.h>
|
||||||
#include <DiagnosticClient.h>
|
#include <DiagnosticClient.h>
|
||||||
@@ -143,9 +146,9 @@ void Document::appendMacro(const Macro ¯o)
|
|||||||
_definedMacros.append(macro);
|
_definedMacros.append(macro);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::addMacroUse(unsigned offset, unsigned length)
|
void Document::addMacroUse(const Macro ¯o, unsigned offset, unsigned length)
|
||||||
{
|
{
|
||||||
_macroUses.append(Block(offset, offset + length));
|
_macroUses.append(MacroUse(macro, offset, offset + length));
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUnit *Document::translationUnit() const
|
TranslationUnit *Document::translationUnit() const
|
||||||
@@ -270,7 +273,7 @@ bool Document::parse(ParseMode mode)
|
|||||||
|
|
||||||
void Document::check()
|
void Document::check()
|
||||||
{
|
{
|
||||||
Q_ASSERT(! _globalNamespace);
|
QTC_ASSERT(!_globalNamespace, return);
|
||||||
|
|
||||||
Semantic semantic(_control);
|
Semantic semantic(_control);
|
||||||
|
|
||||||
|
|||||||
@@ -68,8 +68,7 @@ public:
|
|||||||
void addIncludeFile(const QString &fileName);
|
void addIncludeFile(const QString &fileName);
|
||||||
|
|
||||||
void appendMacro(const Macro ¯o);
|
void appendMacro(const Macro ¯o);
|
||||||
|
void addMacroUse(const Macro ¯o, unsigned offset, unsigned length);
|
||||||
void addMacroUse(unsigned offset, unsigned length);
|
|
||||||
|
|
||||||
Control *control() const;
|
Control *control() const;
|
||||||
TranslationUnit *translationUnit() const;
|
TranslationUnit *translationUnit() const;
|
||||||
@@ -177,12 +176,30 @@ public:
|
|||||||
|
|
||||||
inline unsigned end() const
|
inline unsigned end() const
|
||||||
{ return _end; }
|
{ return _end; }
|
||||||
|
|
||||||
|
bool contains(unsigned pos) const
|
||||||
|
{ return pos >= _begin && pos < _end; }
|
||||||
|
};
|
||||||
|
|
||||||
|
class MacroUse: public Block {
|
||||||
|
Macro _macro;
|
||||||
|
|
||||||
|
public:
|
||||||
|
inline MacroUse(const Macro ¯o,
|
||||||
|
unsigned begin = 0,
|
||||||
|
unsigned end = 0)
|
||||||
|
: Block(begin, end),
|
||||||
|
_macro(macro)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
const Macro ¯o() const
|
||||||
|
{ return _macro; }
|
||||||
};
|
};
|
||||||
|
|
||||||
QList<Block> skippedBlocks() const
|
QList<Block> skippedBlocks() const
|
||||||
{ return _skippedBlocks; }
|
{ return _skippedBlocks; }
|
||||||
|
|
||||||
QList<Block> macroUses() const
|
QList<MacroUse> macroUses() const
|
||||||
{ return _macroUses; }
|
{ return _macroUses; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -197,7 +214,7 @@ private:
|
|||||||
QList<DiagnosticMessage> _diagnosticMessages;
|
QList<DiagnosticMessage> _diagnosticMessages;
|
||||||
QList<Macro> _definedMacros;
|
QList<Macro> _definedMacros;
|
||||||
QList<Block> _skippedBlocks;
|
QList<Block> _skippedBlocks;
|
||||||
QList<Block> _macroUses;
|
QList<MacroUse> _macroUses;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of namespace CPlusPlus
|
} // end of namespace CPlusPlus
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
#include "OverviewModel.h"
|
#include "OverviewModel.h"
|
||||||
#include "Overview.h"
|
#include "Overview.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <Scope.h>
|
#include <Scope.h>
|
||||||
#include <Semantic.h>
|
#include <Semantic.h>
|
||||||
#include <Literals.h>
|
#include <Literals.h>
|
||||||
@@ -81,13 +83,13 @@ QModelIndex OverviewModel::index(int row, int column, const QModelIndex &parent)
|
|||||||
return createIndex(row, column, symbol);
|
return createIndex(row, column, symbol);
|
||||||
} else {
|
} else {
|
||||||
Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer());
|
Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer());
|
||||||
Q_ASSERT(parentSymbol != 0);
|
QTC_ASSERT(parentSymbol, return QModelIndex());
|
||||||
|
|
||||||
ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol();
|
ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol();
|
||||||
Q_ASSERT(scopedSymbol != 0);
|
QTC_ASSERT(scopedSymbol, return QModelIndex());
|
||||||
|
|
||||||
Scope *scope = scopedSymbol->members();
|
Scope *scope = scopedSymbol->members();
|
||||||
Q_ASSERT(scope != 0);
|
QTC_ASSERT(scope, return QModelIndex());
|
||||||
|
|
||||||
return createIndex(row, 0, scope->symbolAt(row));
|
return createIndex(row, 0, scope->symbolAt(row));
|
||||||
}
|
}
|
||||||
@@ -124,12 +126,12 @@ int OverviewModel::rowCount(const QModelIndex &parent) const
|
|||||||
if (!parent.parent().isValid() && parent.row() == 0) // account for no symbol item
|
if (!parent.parent().isValid() && parent.row() == 0) // account for no symbol item
|
||||||
return 0;
|
return 0;
|
||||||
Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer());
|
Symbol *parentSymbol = static_cast<Symbol *>(parent.internalPointer());
|
||||||
Q_ASSERT(parentSymbol != 0);
|
QTC_ASSERT(parentSymbol, return 0);
|
||||||
|
|
||||||
if (ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol()) {
|
if (ScopedSymbol *scopedSymbol = parentSymbol->asScopedSymbol()) {
|
||||||
if (!scopedSymbol->isFunction()) {
|
if (!scopedSymbol->isFunction()) {
|
||||||
Scope *parentScope = scopedSymbol->members();
|
Scope *parentScope = scopedSymbol->members();
|
||||||
Q_ASSERT(parentScope != 0);
|
QTC_ASSERT(parentScope, return 0);
|
||||||
|
|
||||||
return parentScope->symbolCount();
|
return parentScope->symbolCount();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,8 +45,10 @@
|
|||||||
#include <TypeVisitor.h>
|
#include <TypeVisitor.h>
|
||||||
#include <NameVisitor.h>
|
#include <NameVisitor.h>
|
||||||
|
|
||||||
#include <QList>
|
#include <utils/qtcassert.h>
|
||||||
#include <QtDebug>
|
|
||||||
|
#include <QtCore/QList>
|
||||||
|
#include <QtCore/QtDebug>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
@@ -98,7 +100,7 @@ protected:
|
|||||||
// types
|
// types
|
||||||
virtual void visit(PointerToMemberType * /*ty*/)
|
virtual void visit(PointerToMemberType * /*ty*/)
|
||||||
{
|
{
|
||||||
Q_ASSERT(0);
|
QTC_ASSERT(false, /**/);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(PointerType *ty)
|
virtual void visit(PointerType *ty)
|
||||||
@@ -150,32 +152,32 @@ protected:
|
|||||||
{ /* nothing to do*/ }
|
{ /* nothing to do*/ }
|
||||||
|
|
||||||
virtual void visit(Namespace *)
|
virtual void visit(Namespace *)
|
||||||
{ Q_ASSERT(0); }
|
{ QTC_ASSERT(false, /**/); }
|
||||||
|
|
||||||
virtual void visit(Class *)
|
virtual void visit(Class *)
|
||||||
{ Q_ASSERT(0); }
|
{ QTC_ASSERT(false, /**/); }
|
||||||
|
|
||||||
virtual void visit(Enum *)
|
virtual void visit(Enum *)
|
||||||
{ Q_ASSERT(0); }
|
{ QTC_ASSERT(false, /**/); }
|
||||||
|
|
||||||
// names
|
// names
|
||||||
virtual void visit(NameId *)
|
virtual void visit(NameId *)
|
||||||
{ Q_ASSERT(0); }
|
{ QTC_ASSERT(false, /**/); }
|
||||||
|
|
||||||
virtual void visit(TemplateNameId *)
|
virtual void visit(TemplateNameId *)
|
||||||
{ Q_ASSERT(0); }
|
{ QTC_ASSERT(false, /**/); }
|
||||||
|
|
||||||
virtual void visit(DestructorNameId *)
|
virtual void visit(DestructorNameId *)
|
||||||
{ Q_ASSERT(0); }
|
{ QTC_ASSERT(false, /**/); }
|
||||||
|
|
||||||
virtual void visit(OperatorNameId *)
|
virtual void visit(OperatorNameId *)
|
||||||
{ Q_ASSERT(0); }
|
{ QTC_ASSERT(false, /**/); }
|
||||||
|
|
||||||
virtual void visit(ConversionNameId *)
|
virtual void visit(ConversionNameId *)
|
||||||
{ Q_ASSERT(0); }
|
{ QTC_ASSERT(false, /**/); }
|
||||||
|
|
||||||
virtual void visit(QualifiedNameId *)
|
virtual void visit(QualifiedNameId *)
|
||||||
{ Q_ASSERT(0); }
|
{ QTC_ASSERT(false, /**/); }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end of anonymous namespace
|
} // end of anonymous namespace
|
||||||
|
|||||||
@@ -164,7 +164,15 @@ protected:
|
|||||||
bool process_primary()
|
bool process_primary()
|
||||||
{
|
{
|
||||||
if ((*_lex)->is(T_INT_LITERAL)) {
|
if ((*_lex)->is(T_INT_LITERAL)) {
|
||||||
_value.set_long(tokenSpell().toLong());
|
int base = 10;
|
||||||
|
const QByteArray spell = tokenSpell();
|
||||||
|
if (spell.at(0) == '0') {
|
||||||
|
if (spell.size() > 1 && (spell.at(1) == 'x' || spell.at(1) == 'X'))
|
||||||
|
base = 16;
|
||||||
|
else
|
||||||
|
base = 8;
|
||||||
|
}
|
||||||
|
_value.set_long(tokenSpell().toLong(0, base));
|
||||||
++(*_lex);
|
++(*_lex);
|
||||||
return true;
|
return true;
|
||||||
} else if (isTokenDefined()) {
|
} else if (isTokenDefined()) {
|
||||||
@@ -367,7 +375,7 @@ protected:
|
|||||||
{
|
{
|
||||||
process_xor();
|
process_xor();
|
||||||
|
|
||||||
while ((*_lex)->is(T_CARET)) {
|
while ((*_lex)->is(T_PIPE)) {
|
||||||
const Token op = *(*_lex);
|
const Token op = *(*_lex);
|
||||||
++(*_lex);
|
++(*_lex);
|
||||||
|
|
||||||
@@ -481,12 +489,12 @@ void pp::operator () (const QByteArray &filename,
|
|||||||
const QByteArray &source,
|
const QByteArray &source,
|
||||||
QByteArray *result)
|
QByteArray *result)
|
||||||
{
|
{
|
||||||
const QByteArray previousFile = env.current_file;
|
const QByteArray previousFile = env.currentFile;
|
||||||
env.current_file = filename;
|
env.currentFile = filename;
|
||||||
|
|
||||||
operator () (source, result);
|
operator () (source, result);
|
||||||
|
|
||||||
env.current_file = previousFile;
|
env.currentFile = previousFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
pp::State pp::createStateFromSource(const QByteArray &source) const
|
pp::State pp::createStateFromSource(const QByteArray &source) const
|
||||||
@@ -518,7 +526,7 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
|
|||||||
result->append(QByteArray::number(_dot->lineno));
|
result->append(QByteArray::number(_dot->lineno));
|
||||||
result->append(' ');
|
result->append(' ');
|
||||||
result->append('"');
|
result->append('"');
|
||||||
result->append(env.current_file);
|
result->append(env.currentFile);
|
||||||
result->append('"');
|
result->append('"');
|
||||||
result->append('\n');
|
result->append('\n');
|
||||||
} else {
|
} else {
|
||||||
@@ -604,28 +612,29 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
|
|||||||
m->definition.constEnd(),
|
m->definition.constEnd(),
|
||||||
result);
|
result);
|
||||||
|
|
||||||
|
m->hidden = false;
|
||||||
|
|
||||||
if (client)
|
if (client)
|
||||||
client->stopExpandingMacro(_dot->offset, *m);
|
client->stopExpandingMacro(_dot->offset, *m);
|
||||||
|
|
||||||
m->hidden = false;
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
QByteArray tmp;
|
QByteArray tmp;
|
||||||
m->hidden = true;
|
|
||||||
|
|
||||||
if (client)
|
if (client)
|
||||||
client->startExpandingMacro(identifierToken->offset,
|
client->startExpandingMacro(identifierToken->offset,
|
||||||
*m, spell);
|
*m, spell);
|
||||||
|
m->hidden = true;
|
||||||
|
|
||||||
expand(m->definition.constBegin(),
|
expand(m->definition.constBegin(),
|
||||||
m->definition.constEnd(),
|
m->definition.constEnd(),
|
||||||
&tmp);
|
&tmp);
|
||||||
|
|
||||||
|
m->hidden = false;
|
||||||
|
|
||||||
if (client)
|
if (client)
|
||||||
client->stopExpandingMacro(_dot->offset, *m);
|
client->stopExpandingMacro(_dot->offset, *m);
|
||||||
|
|
||||||
m->hidden = false;
|
|
||||||
|
|
||||||
m = 0; // reset the active the macro
|
m = 0; // reset the active the macro
|
||||||
|
|
||||||
pushState(createStateFromSource(tmp));
|
pushState(createStateFromSource(tmp));
|
||||||
@@ -843,6 +852,8 @@ void pp::processDefine(TokenIterator firstToken, TokenIterator lastToken)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Macro macro;
|
Macro macro;
|
||||||
|
macro.fileName = env.currentFile;
|
||||||
|
macro.line = env.currentLine;
|
||||||
macro.name = tokenText(*tk);
|
macro.name = tokenText(*tk);
|
||||||
++tk; // skip T_IDENTIFIER
|
++tk; // skip T_IDENTIFIER
|
||||||
|
|
||||||
|
|||||||
@@ -52,11 +52,14 @@
|
|||||||
|
|
||||||
#include "pp-environment.h"
|
#include "pp-environment.h"
|
||||||
#include "pp.h"
|
#include "pp.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
Environment::Environment ()
|
Environment::Environment()
|
||||||
: currentLine(0),
|
: currentLine(0),
|
||||||
hide_next(false),
|
hide_next(false),
|
||||||
_macros(0),
|
_macros(0),
|
||||||
@@ -67,7 +70,7 @@ Environment::Environment ()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Environment::~Environment ()
|
Environment::~Environment()
|
||||||
{
|
{
|
||||||
if (_macros) {
|
if (_macros) {
|
||||||
qDeleteAll(firstMacro(), lastMacro());
|
qDeleteAll(firstMacro(), lastMacro());
|
||||||
@@ -78,20 +81,22 @@ Environment::~Environment ()
|
|||||||
free(_hash);
|
free(_hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Environment::macroCount () const
|
unsigned Environment::macroCount() const
|
||||||
{ return _macro_count + 1; }
|
{
|
||||||
|
return _macro_count + 1;
|
||||||
|
}
|
||||||
|
|
||||||
Macro *Environment::macroAt (unsigned index) const
|
Macro *Environment::macroAt(unsigned index) const
|
||||||
{ return _macros[index]; }
|
{
|
||||||
|
return _macros[index];
|
||||||
|
}
|
||||||
|
|
||||||
Macro *Environment::bind(const Macro &__macro)
|
Macro *Environment::bind(const Macro &__macro)
|
||||||
{
|
{
|
||||||
Q_ASSERT(! __macro.name.isEmpty());
|
QTC_ASSERT(! __macro.name.isEmpty(), return 0);
|
||||||
|
|
||||||
Macro *m = new Macro (__macro);
|
Macro *m = new Macro (__macro);
|
||||||
m->hashcode = hash_code(m->name);
|
m->hashcode = hash_code(m->name);
|
||||||
m->fileName = current_file;
|
|
||||||
m->line = currentLine;
|
|
||||||
|
|
||||||
if (++_macro_count == _allocated_macros) {
|
if (++_macro_count == _allocated_macros) {
|
||||||
if (! _allocated_macros)
|
if (! _allocated_macros)
|
||||||
@@ -115,11 +120,13 @@ Macro *Environment::bind(const Macro &__macro)
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
Macro *Environment::remove (const QByteArray &name)
|
Macro *Environment::remove(const QByteArray &name)
|
||||||
{
|
{
|
||||||
Macro macro;
|
Macro macro;
|
||||||
macro.name = name;
|
macro.name = name;
|
||||||
macro.hidden = true;
|
macro.hidden = true;
|
||||||
|
macro.fileName = currentFile;
|
||||||
|
macro.line = currentLine;
|
||||||
return bind(macro);
|
return bind(macro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ private:
|
|||||||
void rehash();
|
void rehash();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QByteArray current_file;
|
QByteArray currentFile;
|
||||||
unsigned currentLine;
|
unsigned currentLine;
|
||||||
bool hide_next;
|
bool hide_next;
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
|
|||||||
__result->append(QByteArray::number(env.currentLine));
|
__result->append(QByteArray::number(env.currentLine));
|
||||||
__result->append(' ');
|
__result->append(' ');
|
||||||
__result->append('"');
|
__result->append('"');
|
||||||
__result->append(env.current_file);
|
__result->append(env.currentFile);
|
||||||
__result->append('"');
|
__result->append('"');
|
||||||
__result->append('\n');
|
__result->append('\n');
|
||||||
++lines;
|
++lines;
|
||||||
@@ -218,7 +218,7 @@ const char *MacroExpander::operator () (const char *__first, const char *__last,
|
|||||||
else if (fast_name == "__FILE__")
|
else if (fast_name == "__FILE__")
|
||||||
{
|
{
|
||||||
__result->append('"');
|
__result->append('"');
|
||||||
__result->append(env.current_file);
|
__result->append(env.currentFile);
|
||||||
__result->append('"');
|
__result->append('"');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,7 @@
|
|||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
namespace CPlusPlus {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
@@ -89,6 +90,33 @@ public:
|
|||||||
hashcode(0),
|
hashcode(0),
|
||||||
state(0)
|
state(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
QString toString() const
|
||||||
|
{
|
||||||
|
QString text;
|
||||||
|
if (hidden)
|
||||||
|
text += QLatin1String("#undef ");
|
||||||
|
else
|
||||||
|
text += QLatin1String("#define ");
|
||||||
|
text += QString::fromUtf8(name.constData(), name.size());
|
||||||
|
if (function_like) {
|
||||||
|
text += QLatin1Char('(');
|
||||||
|
bool first = true;
|
||||||
|
foreach (const QByteArray formal, formals) {
|
||||||
|
if (! first)
|
||||||
|
text += QLatin1String(", ");
|
||||||
|
else
|
||||||
|
first = false;
|
||||||
|
text += QString::fromUtf8(formal.constData(), formal.size());
|
||||||
|
}
|
||||||
|
if (variadics)
|
||||||
|
text += QLatin1String("...");
|
||||||
|
text += QLatin1Char(')');
|
||||||
|
}
|
||||||
|
text += QLatin1Char(' ');
|
||||||
|
text += QString::fromUtf8(definition.constData(), definition.size());
|
||||||
|
return text;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CPlusPlus
|
||||||
|
|||||||
@@ -422,12 +422,12 @@ void PluginManager::formatPluginVersions(QTextStream &str) const
|
|||||||
void PluginManager::startTests()
|
void PluginManager::startTests()
|
||||||
{
|
{
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
foreach(PluginSpec *pluginSpec, d->testSpecs) {
|
foreach (PluginSpec *pluginSpec, d->testSpecs) {
|
||||||
const QMetaObject *mo = pluginSpec->plugin()->metaObject();
|
const QMetaObject *mo = pluginSpec->plugin()->metaObject();
|
||||||
QStringList methods;
|
QStringList methods;
|
||||||
methods.append("arg0");
|
methods.append("arg0");
|
||||||
// We only want slots starting with "test"
|
// We only want slots starting with "test"
|
||||||
for(int i = mo->methodOffset(); i < mo->methodCount(); ++i) {
|
for (int i = mo->methodOffset(); i < mo->methodCount(); ++i) {
|
||||||
if (QByteArray(mo->method(i).signature()).startsWith("test")) {
|
if (QByteArray(mo->method(i).signature()).startsWith("test")) {
|
||||||
QString method = QString::fromLatin1(mo->method(i).signature());
|
QString method = QString::fromLatin1(mo->method(i).signature());
|
||||||
methods.append(method.left(method.size()-2));
|
methods.append(method.left(method.size()-2));
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
|
|
||||||
#include "classnamevalidatinglineedit.h"
|
#include "classnamevalidatinglineedit.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QRegExp>
|
#include <QtCore/QRegExp>
|
||||||
|
|
||||||
@@ -53,7 +55,7 @@ ClassNameValidatingLineEditPrivate:: ClassNameValidatingLineEditPrivate() :
|
|||||||
m_namespaceDelimiter(QLatin1String("::")),
|
m_namespaceDelimiter(QLatin1String("::")),
|
||||||
m_namespacesEnabled(false)
|
m_namespacesEnabled(false)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_nameRegexp.isValid());
|
QTC_ASSERT(m_nameRegexp.isValid(), return);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------- ClassNameValidatingLineEdit
|
// --------------------- ClassNameValidatingLineEdit
|
||||||
@@ -113,7 +115,7 @@ QString ClassNameValidatingLineEdit::createClassName(const QString &name)
|
|||||||
// Remove spaces and convert the adjacent characters to uppercase
|
// Remove spaces and convert the adjacent characters to uppercase
|
||||||
QString className = name;
|
QString className = name;
|
||||||
QRegExp spaceMatcher(QLatin1String(" +(\\w)"), Qt::CaseSensitive, QRegExp::RegExp2);
|
QRegExp spaceMatcher(QLatin1String(" +(\\w)"), Qt::CaseSensitive, QRegExp::RegExp2);
|
||||||
Q_ASSERT(spaceMatcher.isValid());
|
QTC_ASSERT(spaceMatcher.isValid(), /**/);
|
||||||
int pos;
|
int pos;
|
||||||
while ((pos = spaceMatcher.indexIn(className)) != -1) {
|
while ((pos = spaceMatcher.indexIn(className)) != -1) {
|
||||||
className.replace(pos, spaceMatcher.matchedLength(),
|
className.replace(pos, spaceMatcher.matchedLength(),
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "filenamevalidatinglineedit.h"
|
#include "filenamevalidatinglineedit.h"
|
||||||
|
#include "qtcassert.h"
|
||||||
|
|
||||||
#include <QtCore/QRegExp>
|
#include <QtCore/QRegExp>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
@@ -46,7 +47,7 @@ static const QRegExp &windowsDeviceNoSubDirPattern()
|
|||||||
{
|
{
|
||||||
static const QRegExp rc(QLatin1String("CON|AUX|PRN|COM1|COM2|LPT1|LPT2|NUL"),
|
static const QRegExp rc(QLatin1String("CON|AUX|PRN|COM1|COM2|LPT1|LPT2|NUL"),
|
||||||
Qt::CaseInsensitive);
|
Qt::CaseInsensitive);
|
||||||
Q_ASSERT(rc.isValid());
|
QTC_ASSERT(rc.isValid(), return rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ static const QRegExp &windowsDeviceSubDirPattern()
|
|||||||
{
|
{
|
||||||
static const QRegExp rc(QLatin1String(".*[/\\\\]CON|.*[/\\\\]AUX|.*[/\\\\]PRN|.*[/\\\\]COM1|.*[/\\\\]COM2|.*[/\\\\]LPT1|.*[/\\\\]LPT2|.*[/\\\\]NUL"),
|
static const QRegExp rc(QLatin1String(".*[/\\\\]CON|.*[/\\\\]AUX|.*[/\\\\]PRN|.*[/\\\\]COM1|.*[/\\\\]COM2|.*[/\\\\]LPT1|.*[/\\\\]LPT2|.*[/\\\\]NUL"),
|
||||||
Qt::CaseInsensitive);
|
Qt::CaseInsensitive);
|
||||||
Q_ASSERT(rc.isValid());
|
QTC_ASSERT(rc.isValid(), return rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ void FileWizardPage::setName(const QString &name)
|
|||||||
|
|
||||||
void FileWizardPage::changeEvent(QEvent *e)
|
void FileWizardPage::changeEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->type()) {
|
switch (e->type()) {
|
||||||
case QEvent::LanguageChange:
|
case QEvent::LanguageChange:
|
||||||
m_d->m_ui.retranslateUi(this);
|
m_d->m_ui.retranslateUi(this);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -32,18 +32,20 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "pathchooser.h"
|
#include "pathchooser.h"
|
||||||
|
|
||||||
#include "basevalidatinglineedit.h"
|
#include "basevalidatinglineedit.h"
|
||||||
|
#include "qtcassert.h"
|
||||||
|
|
||||||
#include <QtGui/QLineEdit>
|
|
||||||
#include <QtGui/QHBoxLayout>
|
|
||||||
#include <QtGui/QToolButton>
|
|
||||||
#include <QtGui/QFileDialog>
|
|
||||||
#include <QtGui/QDesktopServices>
|
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
|
||||||
#include <QtCore/QDir>
|
|
||||||
#include <QtCore/QSettings>
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
|
#include <QtGui/QDesktopServices>
|
||||||
|
#include <QtGui/QFileDialog>
|
||||||
|
#include <QtGui/QHBoxLayout>
|
||||||
|
#include <QtGui/QLineEdit>
|
||||||
|
#include <QtGui/QToolButton>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
@@ -55,7 +57,8 @@ namespace Utils {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ------------------ PathValidatingLineEdit
|
// ------------------ PathValidatingLineEdit
|
||||||
class PathValidatingLineEdit : public BaseValidatingLineEdit {
|
class PathValidatingLineEdit : public BaseValidatingLineEdit
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
explicit PathValidatingLineEdit(PathChooser *chooser, QWidget *parent = 0);
|
explicit PathValidatingLineEdit(PathChooser *chooser, QWidget *parent = 0);
|
||||||
|
|
||||||
@@ -70,7 +73,7 @@ PathValidatingLineEdit::PathValidatingLineEdit(PathChooser *chooser, QWidget *pa
|
|||||||
BaseValidatingLineEdit(parent),
|
BaseValidatingLineEdit(parent),
|
||||||
m_chooser(chooser)
|
m_chooser(chooser)
|
||||||
{
|
{
|
||||||
Q_ASSERT(chooser != NULL);
|
QTC_ASSERT(chooser, return);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PathValidatingLineEdit::validate(const QString &value, QString *errorMessage) const
|
bool PathValidatingLineEdit::validate(const QString &value, QString *errorMessage) const
|
||||||
@@ -79,7 +82,8 @@ bool PathValidatingLineEdit::validate(const QString &value, QString *errorMessag
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ------------------ PathChooserPrivate
|
// ------------------ PathChooserPrivate
|
||||||
struct PathChooserPrivate {
|
struct PathChooserPrivate
|
||||||
|
{
|
||||||
PathChooserPrivate(PathChooser *chooser);
|
PathChooserPrivate(PathChooser *chooser);
|
||||||
|
|
||||||
PathValidatingLineEdit *m_lineEdit;
|
PathValidatingLineEdit *m_lineEdit;
|
||||||
@@ -160,9 +164,9 @@ void PathChooser::slotBrowse()
|
|||||||
|
|
||||||
// TODO make cross-platform
|
// TODO make cross-platform
|
||||||
// Delete trailing slashes unless it is "/", only
|
// Delete trailing slashes unless it is "/", only
|
||||||
if (!newPath .isEmpty()) {
|
if (!newPath.isEmpty()) {
|
||||||
if (newPath .size() > 1 && newPath .endsWith(QDir::separator()))
|
if (newPath.size() > 1 && newPath.endsWith(QDir::separator()))
|
||||||
newPath .truncate(newPath .size() - 1);
|
newPath.truncate(newPath.size() - 1);
|
||||||
setPath(newPath);
|
setPath(newPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,17 +211,19 @@ bool PathChooser::validatePath(const QString &path, QString *errorMessage)
|
|||||||
// Check expected kind
|
// Check expected kind
|
||||||
switch (m_d->m_acceptingKind) {
|
switch (m_d->m_acceptingKind) {
|
||||||
case PathChooser::Directory:
|
case PathChooser::Directory:
|
||||||
if (!isDir)
|
if (!isDir) {
|
||||||
if (errorMessage)
|
if (errorMessage)
|
||||||
*errorMessage = tr("The path '%1' is not a directory.").arg(path);
|
*errorMessage = tr("The path '%1' is not a directory.").arg(path);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PathChooser::File:
|
case PathChooser::File:
|
||||||
if (isDir)
|
if (isDir) {
|
||||||
if (errorMessage)
|
if (errorMessage)
|
||||||
*errorMessage = tr("The path '%1' is not a file.").arg(path);
|
*errorMessage = tr("The path '%1' is not a file.").arg(path);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PathChooser::Command:
|
case PathChooser::Command:
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ void ProjectIntroPage::setDescription(const QString &description)
|
|||||||
|
|
||||||
void ProjectIntroPage::changeEvent(QEvent *e)
|
void ProjectIntroPage::changeEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->type()) {
|
switch (e->type()) {
|
||||||
case QEvent::LanguageChange:
|
case QEvent::LanguageChange:
|
||||||
m_d->m_ui.retranslateUi(this);
|
m_d->m_ui.retranslateUi(this);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -31,16 +31,16 @@
|
|||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef DEBUGGER_QWB_ASSERT_H
|
#ifndef QTC_ASSERT_H
|
||||||
#define DEBUGGER_QWB_ASSERT_H
|
#define QTC_ASSERT_H
|
||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
#include <QtCore/QDebug>
|
||||||
#define QWB_ASSERT(cond, action) \
|
|
||||||
|
// we do not use the 'do {...} while (0)' idiom here to be able to use
|
||||||
|
// 'break' and 'continue' as 'actions'.
|
||||||
|
|
||||||
|
#define QTC_ASSERT(cond, action) \
|
||||||
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED"<<__FILE__<<__LINE__;action;}
|
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED"<<__FILE__<<__LINE__;action;}
|
||||||
#else
|
|
||||||
#define QWB_ASSERT(cond, action) \
|
|
||||||
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED";action;}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // DEBUGGER_QWB_ASSERT_H
|
#endif // QTC_ASSERT_H
|
||||||
|
|
||||||
@@ -46,7 +46,8 @@ namespace Utils {
|
|||||||
|
|
||||||
// QActionPushButton: A push button tied to an action
|
// QActionPushButton: A push button tied to an action
|
||||||
// (similar to a QToolButton)
|
// (similar to a QToolButton)
|
||||||
class QActionPushButton : public QPushButton {
|
class QActionPushButton : public QPushButton
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit QActionPushButton(QAction *a);
|
explicit QActionPushButton(QAction *a);
|
||||||
@@ -319,7 +320,7 @@ void SubmitEditorWidget::fileSelectionChanged()
|
|||||||
|
|
||||||
void SubmitEditorWidget::changeEvent(QEvent *e)
|
void SubmitEditorWidget::changeEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->type()) {
|
switch (e->type()) {
|
||||||
case QEvent::LanguageChange:
|
case QEvent::LanguageChange:
|
||||||
m_d->m_ui.retranslateUi(this);
|
m_d->m_ui.retranslateUi(this);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ void BinEditor::scrollContentsBy(int dx, int dy)
|
|||||||
void BinEditor::changeEvent(QEvent *e)
|
void BinEditor::changeEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
QAbstractScrollArea::changeEvent(e);
|
QAbstractScrollArea::changeEvent(e);
|
||||||
if(e->type() == QEvent::ActivationChange) {
|
if (e->type() == QEvent::ActivationChange) {
|
||||||
if (!isActiveWindow())
|
if (!isActiveWindow())
|
||||||
m_autoScrollTimer.stop();
|
m_autoScrollTimer.stop();
|
||||||
}
|
}
|
||||||
@@ -450,7 +450,7 @@ void BinEditor::paintEvent(QPaintEvent *e)
|
|||||||
for (int c = 0; c < 16; ++c) {
|
for (int c = 0; c < 16; ++c) {
|
||||||
int pos = line * 16 + c;
|
int pos = line * 16 + c;
|
||||||
if (pos >= m_data.size()) {
|
if (pos >= m_data.size()) {
|
||||||
while(c < 16) {
|
while (c < 16) {
|
||||||
itemStringData[c*3] = itemStringData[c*3+1] = ' ';
|
itemStringData[c*3] = itemStringData[c*3+1] = ' ';
|
||||||
++c;
|
++c;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "bookmarkmanager.h"
|
#include "bookmarkmanager.h"
|
||||||
|
|
||||||
#include "bookmark.h"
|
#include "bookmark.h"
|
||||||
#include "bookmarksplugin.h"
|
#include "bookmarksplugin.h"
|
||||||
#include "bookmarks_global.h"
|
#include "bookmarks_global.h"
|
||||||
@@ -41,12 +42,14 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/basetexteditor.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtCore/QFileInfo>
|
|
||||||
#include <QtCore/QDebug>
|
|
||||||
#include <QtGui/QPainter>
|
|
||||||
#include <QtGui/QContextMenuEvent>
|
#include <QtGui/QContextMenuEvent>
|
||||||
|
#include <QtGui/QPainter>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*)
|
Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*)
|
||||||
|
|
||||||
@@ -173,7 +176,7 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
|||||||
// int idx;
|
// int idx;
|
||||||
// forever {
|
// forever {
|
||||||
// idx = directory.lastIndexOf("/", pos-1);
|
// idx = directory.lastIndexOf("/", pos-1);
|
||||||
// if(idx == -1) {
|
// if (idx == -1) {
|
||||||
// // Can't happen, this means the string did fit after all?
|
// // Can't happen, this means the string did fit after all?
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
@@ -272,7 +275,7 @@ void BookmarkView::removeAll()
|
|||||||
void BookmarkView::setModel(QAbstractItemModel *model)
|
void BookmarkView::setModel(QAbstractItemModel *model)
|
||||||
{
|
{
|
||||||
BookmarkManager *manager = qobject_cast<BookmarkManager *>(model);
|
BookmarkManager *manager = qobject_cast<BookmarkManager *>(model);
|
||||||
Q_ASSERT(manager);
|
QTC_ASSERT(manager, return);
|
||||||
QListView::setModel(model);
|
QListView::setModel(model);
|
||||||
setSelectionModel(manager->selectionModel());
|
setSelectionModel(manager->selectionModel());
|
||||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
|||||||
@@ -32,15 +32,20 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "cmakeproject.h"
|
#include "cmakeproject.h"
|
||||||
|
|
||||||
#include "cmakeprojectconstants.h"
|
#include "cmakeprojectconstants.h"
|
||||||
#include "cmakeprojectnodes.h"
|
#include "cmakeprojectnodes.h"
|
||||||
|
#include "cmakerunconfiguration.h"
|
||||||
#include "cmakestep.h"
|
#include "cmakestep.h"
|
||||||
#include "makestep.h"
|
#include "makestep.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <cpptools/cppmodelmanagerinterface.h>
|
#include <cpptools/cppmodelmanagerinterface.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QProcess>
|
||||||
|
|
||||||
using namespace CMakeProjectManager;
|
using namespace CMakeProjectManager;
|
||||||
using namespace CMakeProjectManager::Internal;
|
using namespace CMakeProjectManager::Internal;
|
||||||
@@ -48,20 +53,31 @@ using namespace CMakeProjectManager::Internal;
|
|||||||
CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
||||||
: m_manager(manager), m_fileName(fileName), m_rootNode(new CMakeProjectNode(m_fileName))
|
: m_manager(manager), m_fileName(fileName), m_rootNode(new CMakeProjectNode(m_fileName))
|
||||||
{
|
{
|
||||||
//TODO
|
|
||||||
m_file = new CMakeFile(this, fileName);
|
m_file = new CMakeFile(this, fileName);
|
||||||
QDir dir = QFileInfo(m_fileName).absoluteDir();
|
QDir dir = QFileInfo(m_fileName).absoluteDir();
|
||||||
QString cbpFile = findCbpFile(dir);
|
QString cbpFile = findCbpFile(dir);
|
||||||
if (cbpFile.isEmpty())
|
if (cbpFile.isEmpty())
|
||||||
cbpFile = createCbpFile(dir);
|
cbpFile = createCbpFile(dir);
|
||||||
|
|
||||||
|
//TODO move this parsing to a seperate method, which is also called if the CMakeList.txt is updated
|
||||||
CMakeCbpParser cbpparser;
|
CMakeCbpParser cbpparser;
|
||||||
if (cbpparser.parseCbpFile(cbpFile)) {
|
if (cbpparser.parseCbpFile(cbpFile)) {
|
||||||
|
// TODO do a intelligent updating of the tree
|
||||||
buildTree(m_rootNode, cbpparser.fileList());
|
buildTree(m_rootNode, cbpparser.fileList());
|
||||||
foreach(ProjectExplorer::FileNode *fn, cbpparser.fileList())
|
foreach (ProjectExplorer::FileNode *fn, cbpparser.fileList())
|
||||||
m_files.append(fn->path());
|
m_files.append(fn->path());
|
||||||
m_files.sort();
|
m_files.sort();
|
||||||
|
|
||||||
|
m_targets = cbpparser.targets();
|
||||||
|
qDebug()<<"Printing targets";
|
||||||
|
foreach(CMakeTarget ct, m_targets) {
|
||||||
|
qDebug()<<ct.title<<" with executable:"<<ct.executable;
|
||||||
|
qDebug()<<"WD:"<<ct.workingDirectory;
|
||||||
|
qDebug()<<ct.makeCommand<<ct.makeCleanCommand;
|
||||||
|
qDebug()<<"";
|
||||||
|
}
|
||||||
|
|
||||||
CppTools::CppModelManagerInterface *modelmanager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
CppTools::CppModelManagerInterface *modelmanager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
||||||
if (modelmanager) {
|
if (modelmanager) {
|
||||||
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||||
@@ -69,6 +85,7 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
|||||||
// TODO we only want C++ files, not all other stuff that might be in the project
|
// TODO we only want C++ files, not all other stuff that might be in the project
|
||||||
pinfo.sourceFiles = m_files;
|
pinfo.sourceFiles = m_files;
|
||||||
// TODO defines
|
// TODO defines
|
||||||
|
// TODO gcc preprocessor files
|
||||||
modelmanager->updateProjectInfo(pinfo);
|
modelmanager->updateProjectInfo(pinfo);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -87,25 +104,27 @@ QString CMakeProject::findCbpFile(const QDir &directory)
|
|||||||
// TODO the cbp file is named like the project() command in the CMakeList.txt file
|
// TODO the cbp file is named like the project() command in the CMakeList.txt file
|
||||||
// so this method below could find the wrong cbp file, if the user changes the project()
|
// so this method below could find the wrong cbp file, if the user changes the project()
|
||||||
// name
|
// name
|
||||||
foreach(const QString &cbpFile , directory.entryList())
|
foreach (const QString &cbpFile , directory.entryList()) {
|
||||||
{
|
if (cbpFile.endsWith(".cbp"))
|
||||||
if (cbpFile.endsWith(".cbp")) {
|
|
||||||
return directory.path() + "/" + cbpFile;
|
return directory.path() + "/" + cbpFile;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return QString::null;
|
return QString::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CMakeProject::createCbpFile(const QDir &directory)
|
||||||
QString CMakeProject::createCbpFile(const QDir &)
|
|
||||||
{
|
{
|
||||||
// TODO create a cbp file.
|
// We create a cbp file, only if we didn't find a cbp file in the base directory
|
||||||
// Issue: Where to create it? We want to do that in the build directory
|
// Yet that can still override cbp files in subdirectories
|
||||||
// but at this stage we don't know the build directory yet
|
// And we are creating tons of files in the source directories
|
||||||
// So create it in a temp directory?
|
// All of that is not really nice.
|
||||||
// Issue: We want to reuse whatever CMakeCache.txt that is alread there, which
|
// The mid term plan is to move away from the CodeBlocks Generator and use our own
|
||||||
// would indicate, creating it in the build directory
|
// QtCreator generator, which actually can be very similar to the CodeBlock Generator
|
||||||
// Or we could use a temp directory and use -C builddirectory
|
|
||||||
|
// TODO we need to pass on the same paremeters as the cmakestep
|
||||||
|
QProcess cmake;
|
||||||
|
cmake.setWorkingDirectory(directory.absolutePath());
|
||||||
|
cmake.start("cmake", QStringList() << "-GCodeBlocks - Unix Makefiles");
|
||||||
|
|
||||||
return QString::null;
|
return QString::null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +132,7 @@ void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::
|
|||||||
{
|
{
|
||||||
//m_rootNode->addFileNodes(fileList, m_rootNode);
|
//m_rootNode->addFileNodes(fileList, m_rootNode);
|
||||||
qSort(list.begin(), list.end(), ProjectExplorer::ProjectNode::sortNodesByPath);
|
qSort(list.begin(), list.end(), ProjectExplorer::ProjectNode::sortNodesByPath);
|
||||||
foreach( ProjectExplorer::FileNode *fn, list) {
|
foreach (ProjectExplorer::FileNode *fn, list) {
|
||||||
// Get relative path to rootNode
|
// Get relative path to rootNode
|
||||||
QString parentDir = QFileInfo(fn->path()).absolutePath();
|
QString parentDir = QFileInfo(fn->path()).absolutePath();
|
||||||
ProjectExplorer::FolderNode *folder = findOrCreateFolder(rootNode, parentDir);
|
ProjectExplorer::FolderNode *folder = findOrCreateFolder(rootNode, parentDir);
|
||||||
@@ -127,10 +146,10 @@ ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *
|
|||||||
QString relativePath = QDir(QFileInfo(rootNode->path()).path()).relativeFilePath(directory);
|
QString relativePath = QDir(QFileInfo(rootNode->path()).path()).relativeFilePath(directory);
|
||||||
QStringList parts = relativePath.split("/");
|
QStringList parts = relativePath.split("/");
|
||||||
ProjectExplorer::FolderNode *parent = rootNode;
|
ProjectExplorer::FolderNode *parent = rootNode;
|
||||||
foreach(const QString &part, parts) {
|
foreach (const QString &part, parts) {
|
||||||
// Find folder in subFolders
|
// Find folder in subFolders
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach(ProjectExplorer::FolderNode *folder, parent->subFolderNodes()) {
|
foreach (ProjectExplorer::FolderNode *folder, parent->subFolderNodes()) {
|
||||||
if (QFileInfo(folder->path()).fileName() == part) {
|
if (QFileInfo(folder->path()).fileName() == part) {
|
||||||
// yeah found something :)
|
// yeah found something :)
|
||||||
parent = folder;
|
parent = folder;
|
||||||
@@ -227,27 +246,35 @@ QStringList CMakeProject::files(FilesMode fileMode) const
|
|||||||
void CMakeProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer)
|
void CMakeProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
Q_UNUSED(writer);
|
Project::saveSettingsImpl(writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader)
|
void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
Q_UNUSED(reader);
|
Project::restoreSettingsImpl(reader);
|
||||||
if (buildConfigurations().isEmpty()) {
|
if (buildConfigurations().isEmpty()) {
|
||||||
// No build configuration, adding those
|
// No build configuration, adding those
|
||||||
|
|
||||||
// TODO do we want to create one build configuration per target?
|
|
||||||
// or how do we want to handle that?
|
|
||||||
|
|
||||||
CMakeStep *cmakeStep = new CMakeStep(this);
|
CMakeStep *cmakeStep = new CMakeStep(this);
|
||||||
MakeStep *makeStep = new MakeStep(this);
|
MakeStep *makeStep = new MakeStep(this);
|
||||||
|
|
||||||
insertBuildStep(0, cmakeStep);
|
insertBuildStep(0, cmakeStep);
|
||||||
insertBuildStep(1, makeStep);
|
insertBuildStep(1, makeStep);
|
||||||
|
|
||||||
addBuildConfiguration("all");
|
// Create build configurations of m_targets
|
||||||
|
qDebug()<<"Create build configurations of m_targets";
|
||||||
|
foreach(const CMakeTarget &ct, m_targets) {
|
||||||
|
addBuildConfiguration(ct.title);
|
||||||
|
makeStep->setValue(ct.title, "makeCommand", ct.makeCommand);
|
||||||
|
makeStep->setValue(ct.title, "makeCleanCommand", ct.makeCleanCommand);
|
||||||
|
|
||||||
|
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(this, ct.executable, ct.workingDirectory));
|
||||||
|
// TODO set build configuration to build before it can be run
|
||||||
|
addRunConfiguration(rc);
|
||||||
|
setActiveRunConfiguration(rc); // TODO what exactly shall be the active run configuration?
|
||||||
|
}
|
||||||
setActiveBuildConfiguration("all");
|
setActiveBuildConfiguration("all");
|
||||||
|
|
||||||
}
|
}
|
||||||
// Restoring is fine
|
// Restoring is fine
|
||||||
}
|
}
|
||||||
@@ -332,7 +359,7 @@ bool CMakeCbpParser::parseCbpFile(const QString &fileName)
|
|||||||
if (fi.exists() && fi.open(QFile::ReadOnly)) {
|
if (fi.exists() && fi.open(QFile::ReadOnly)) {
|
||||||
setDevice(&fi);
|
setDevice(&fi);
|
||||||
|
|
||||||
while(!atEnd()) {
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
if (name() == "CodeBlocks_project_file") {
|
if (name() == "CodeBlocks_project_file") {
|
||||||
parseCodeBlocks_project_file();
|
parseCodeBlocks_project_file();
|
||||||
@@ -350,7 +377,7 @@ bool CMakeCbpParser::parseCbpFile(const QString &fileName)
|
|||||||
|
|
||||||
void CMakeCbpParser::parseCodeBlocks_project_file()
|
void CMakeCbpParser::parseCodeBlocks_project_file()
|
||||||
{
|
{
|
||||||
while(!atEnd()) {
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
if (isEndElement()) {
|
if (isEndElement()) {
|
||||||
return;
|
return;
|
||||||
@@ -364,7 +391,7 @@ void CMakeCbpParser::parseCodeBlocks_project_file()
|
|||||||
|
|
||||||
void CMakeCbpParser::parseProject()
|
void CMakeCbpParser::parseProject()
|
||||||
{
|
{
|
||||||
while(!atEnd()) {
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
if (isEndElement()) {
|
if (isEndElement()) {
|
||||||
return;
|
return;
|
||||||
@@ -380,7 +407,7 @@ void CMakeCbpParser::parseProject()
|
|||||||
|
|
||||||
void CMakeCbpParser::parseBuild()
|
void CMakeCbpParser::parseBuild()
|
||||||
{
|
{
|
||||||
while(!atEnd()) {
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
if (isEndElement()) {
|
if (isEndElement()) {
|
||||||
return;
|
return;
|
||||||
@@ -394,14 +421,16 @@ void CMakeCbpParser::parseBuild()
|
|||||||
|
|
||||||
void CMakeCbpParser::parseTarget()
|
void CMakeCbpParser::parseTarget()
|
||||||
{
|
{
|
||||||
m_targetOutput.clear();
|
|
||||||
m_targetType = false;
|
m_targetType = false;
|
||||||
while(!atEnd()) {
|
m_target.clear();
|
||||||
|
|
||||||
|
if (attributes().hasAttribute("title"))
|
||||||
|
m_target.title = attributes().value("title").toString();
|
||||||
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
if (isEndElement()) {
|
if (isEndElement()) {
|
||||||
if (m_targetType && !m_targetOutput.isEmpty()) {
|
if (m_targetType || m_target.title == "all") {
|
||||||
qDebug()<<"found target "<<m_targetOutput;
|
m_targets.append(m_target);
|
||||||
m_targets.insert(m_targetOutput);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (name() == "Compiler") {
|
} else if (name() == "Compiler") {
|
||||||
@@ -417,10 +446,58 @@ void CMakeCbpParser::parseTarget()
|
|||||||
void CMakeCbpParser::parseTargetOption()
|
void CMakeCbpParser::parseTargetOption()
|
||||||
{
|
{
|
||||||
if (attributes().hasAttribute("output"))
|
if (attributes().hasAttribute("output"))
|
||||||
m_targetOutput = attributes().value("output").toString();
|
m_target.executable = attributes().value("output").toString();
|
||||||
else if (attributes().hasAttribute("type") && attributes().value("type") == "1")
|
else if (attributes().hasAttribute("type") && attributes().value("type") == "1")
|
||||||
m_targetType = true;
|
m_targetType = true;
|
||||||
while(!atEnd()) {
|
else if (attributes().hasAttribute("working_dir"))
|
||||||
|
m_target.workingDirectory = attributes().value("working_dir").toString();
|
||||||
|
while (!atEnd()) {
|
||||||
|
readNext();
|
||||||
|
if (isEndElement()) {
|
||||||
|
return;
|
||||||
|
} else if (name() == "MakeCommand") {
|
||||||
|
parseMakeCommand();
|
||||||
|
} else if (isStartElement()) {
|
||||||
|
parseUnknownElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeCbpParser::parseMakeCommand()
|
||||||
|
{
|
||||||
|
while (!atEnd()) {
|
||||||
|
readNext();
|
||||||
|
if (isEndElement()) {
|
||||||
|
return;
|
||||||
|
} else if (name() == "Build") {
|
||||||
|
parseTargetBuild();
|
||||||
|
} else if (name() == "Clean") {
|
||||||
|
parseTargetClean();
|
||||||
|
} else if (isStartElement()) {
|
||||||
|
parseUnknownElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeCbpParser::parseTargetBuild()
|
||||||
|
{
|
||||||
|
if (attributes().hasAttribute("command"))
|
||||||
|
m_target.makeCommand = attributes().value("command").toString();
|
||||||
|
while (!atEnd()) {
|
||||||
|
readNext();
|
||||||
|
if (isEndElement()) {
|
||||||
|
return;
|
||||||
|
} else if (isStartElement()) {
|
||||||
|
parseUnknownElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeCbpParser::parseTargetClean()
|
||||||
|
{
|
||||||
|
if (attributes().hasAttribute("command"))
|
||||||
|
m_target.makeCleanCommand = attributes().value("command").toString();
|
||||||
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
if (isEndElement()) {
|
if (isEndElement()) {
|
||||||
return;
|
return;
|
||||||
@@ -432,7 +509,7 @@ void CMakeCbpParser::parseTargetOption()
|
|||||||
|
|
||||||
void CMakeCbpParser::parseCompiler()
|
void CMakeCbpParser::parseCompiler()
|
||||||
{
|
{
|
||||||
while(!atEnd()) {
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
if (isEndElement()) {
|
if (isEndElement()) {
|
||||||
return;
|
return;
|
||||||
@@ -447,7 +524,7 @@ void CMakeCbpParser::parseCompiler()
|
|||||||
void CMakeCbpParser::parseAdd()
|
void CMakeCbpParser::parseAdd()
|
||||||
{
|
{
|
||||||
m_includeFiles.append(attributes().value("directory").toString());
|
m_includeFiles.append(attributes().value("directory").toString());
|
||||||
while(!atEnd()) {
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
if (isEndElement()) {
|
if (isEndElement()) {
|
||||||
return;
|
return;
|
||||||
@@ -463,7 +540,7 @@ void CMakeCbpParser::parseUnit()
|
|||||||
QString fileName = attributes().value("filename").toString();
|
QString fileName = attributes().value("filename").toString();
|
||||||
if (!fileName.endsWith(".rule"))
|
if (!fileName.endsWith(".rule"))
|
||||||
m_fileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::SourceType, false));
|
m_fileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::SourceType, false));
|
||||||
while(!atEnd()) {
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
if (isEndElement()) {
|
if (isEndElement()) {
|
||||||
return;
|
return;
|
||||||
@@ -475,7 +552,7 @@ void CMakeCbpParser::parseUnit()
|
|||||||
|
|
||||||
void CMakeCbpParser::parseUnknownElement()
|
void CMakeCbpParser::parseUnknownElement()
|
||||||
{
|
{
|
||||||
Q_ASSERT(isStartElement());
|
QTC_ASSERT(isStartElement(), /**/);
|
||||||
|
|
||||||
while (!atEnd()) {
|
while (!atEnd()) {
|
||||||
readNext();
|
readNext();
|
||||||
@@ -497,3 +574,18 @@ QStringList CMakeCbpParser::includeFiles()
|
|||||||
{
|
{
|
||||||
return m_includeFiles;
|
return m_includeFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<CMakeTarget> CMakeCbpParser::targets()
|
||||||
|
{
|
||||||
|
return m_targets;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeTarget::clear()
|
||||||
|
{
|
||||||
|
executable = QString::null;
|
||||||
|
makeCommand = QString::null;
|
||||||
|
makeCleanCommand = QString::null;
|
||||||
|
workingDirectory = QString::null;
|
||||||
|
title = QString::null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,16 @@ namespace Internal{
|
|||||||
|
|
||||||
class CMakeFile;
|
class CMakeFile;
|
||||||
|
|
||||||
|
struct CMakeTarget
|
||||||
|
{
|
||||||
|
QString title;
|
||||||
|
QString executable;
|
||||||
|
QString workingDirectory;
|
||||||
|
QString makeCommand;
|
||||||
|
QString makeCleanCommand;
|
||||||
|
void clear();
|
||||||
|
};
|
||||||
|
|
||||||
class CMakeProject : public ProjectExplorer::Project
|
class CMakeProject : public ProjectExplorer::Project
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -105,6 +115,7 @@ private:
|
|||||||
// TODO probably need a CMake specific node structure
|
// TODO probably need a CMake specific node structure
|
||||||
CMakeProjectNode* m_rootNode;
|
CMakeProjectNode* m_rootNode;
|
||||||
QStringList m_files;
|
QStringList m_files;
|
||||||
|
QList<CMakeTarget> m_targets;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
||||||
@@ -118,23 +129,27 @@ public:
|
|||||||
bool parseCbpFile(const QString &fileName);
|
bool parseCbpFile(const QString &fileName);
|
||||||
QList<ProjectExplorer::FileNode *> fileList();
|
QList<ProjectExplorer::FileNode *> fileList();
|
||||||
QStringList includeFiles();
|
QStringList includeFiles();
|
||||||
|
QList<CMakeTarget> targets();
|
||||||
private:
|
private:
|
||||||
void parseCodeBlocks_project_file();
|
void parseCodeBlocks_project_file();
|
||||||
void parseProject();
|
void parseProject();
|
||||||
void parseBuild();
|
void parseBuild();
|
||||||
void parseTarget();
|
void parseTarget();
|
||||||
void parseTargetOption();
|
void parseTargetOption();
|
||||||
|
void parseMakeCommand();
|
||||||
|
void parseTargetBuild();
|
||||||
|
void parseTargetClean();
|
||||||
void parseCompiler();
|
void parseCompiler();
|
||||||
void parseAdd();
|
void parseAdd();
|
||||||
void parseUnit();
|
void parseUnit();
|
||||||
void parseUnknownElement();
|
void parseUnknownElement();
|
||||||
|
|
||||||
QSet<QString> m_targets;
|
|
||||||
QList<ProjectExplorer::FileNode *> m_fileList;
|
QList<ProjectExplorer::FileNode *> m_fileList;
|
||||||
QStringList m_includeFiles;
|
QStringList m_includeFiles;
|
||||||
|
|
||||||
QString m_targetOutput;
|
CMakeTarget m_target;
|
||||||
bool m_targetType;
|
bool m_targetType;
|
||||||
|
QList<CMakeTarget> m_targets;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMakeFile : public Core::IFile
|
class CMakeFile : public Core::IFile
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ const char * const PROJECTCONTEXT = "CMakeProject.ProjectContext";
|
|||||||
const char * const CMAKEMIMETYPE = "text/x-cmake"; // TOOD check that this is correct
|
const char * const CMAKEMIMETYPE = "text/x-cmake"; // TOOD check that this is correct
|
||||||
const char * const CMAKESTEP = "CMakeProjectManager.CMakeStep";
|
const char * const CMAKESTEP = "CMakeProjectManager.CMakeStep";
|
||||||
const char * const MAKESTEP = "CMakeProjectManager.MakeStep";
|
const char * const MAKESTEP = "CMakeProjectManager.MakeStep";
|
||||||
|
const char * const CMAKERUNCONFIGURATION = "CMakeProjectManager.CMakeRunConfiguration";
|
||||||
|
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
|
|||||||
@@ -8,11 +8,13 @@ HEADERS = cmakeproject.h \
|
|||||||
cmakeprojectconstants.h \
|
cmakeprojectconstants.h \
|
||||||
cmakeprojectnodes.h \
|
cmakeprojectnodes.h \
|
||||||
cmakestep.h \
|
cmakestep.h \
|
||||||
makestep.h
|
makestep.h \
|
||||||
|
cmakerunconfiguration.h
|
||||||
SOURCES = cmakeproject.cpp \
|
SOURCES = cmakeproject.cpp \
|
||||||
cmakeprojectplugin.cpp \
|
cmakeprojectplugin.cpp \
|
||||||
cmakeprojectmanager.cpp \
|
cmakeprojectmanager.cpp \
|
||||||
cmakeprojectnodes.cpp \
|
cmakeprojectnodes.cpp \
|
||||||
cmakestep.cpp \
|
cmakestep.cpp \
|
||||||
makestep.cpp
|
makestep.cpp \
|
||||||
|
cmakerunconfiguration.cpp
|
||||||
RESOURCES += cmakeproject.qrc
|
RESOURCES += cmakeproject.qrc
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include "cmakeprojectplugin.h"
|
#include "cmakeprojectplugin.h"
|
||||||
#include "cmakeprojectmanager.h"
|
#include "cmakeprojectmanager.h"
|
||||||
|
#include "cmakerunconfiguration.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
#include <coreplugin/mimedatabase.h>
|
||||||
@@ -57,6 +58,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
|
|||||||
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage))
|
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage))
|
||||||
return false;
|
return false;
|
||||||
addAutoReleasedObject(new CMakeManager());
|
addAutoReleasedObject(new CMakeManager());
|
||||||
|
addAutoReleasedObject(new CMakeRunConfigurationFactory());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
157
src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
Normal file
157
src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** Non-Open Source Usage
|
||||||
|
**
|
||||||
|
** Licensees may use this file in accordance with the Qt Beta Version
|
||||||
|
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||||
|
** alternatively, in accordance with the terms contained in a written
|
||||||
|
** agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU General
|
||||||
|
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||||
|
** of this file. Please review the following information to ensure GNU
|
||||||
|
** General Public Licensing requirements will be met:
|
||||||
|
**
|
||||||
|
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||||
|
** http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||||
|
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "cmakerunconfiguration.h"
|
||||||
|
|
||||||
|
#include "cmakeproject.h"
|
||||||
|
#include "cmakeprojectconstants.h"
|
||||||
|
|
||||||
|
#include <projectexplorer/environment.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
using namespace CMakeProjectManager;
|
||||||
|
using namespace CMakeProjectManager::Internal;
|
||||||
|
|
||||||
|
CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &target, const QString &workingDirectory)
|
||||||
|
: ProjectExplorer::ApplicationRunConfiguration(pro), m_target(target), m_workingDirectory(workingDirectory)
|
||||||
|
{
|
||||||
|
setName(target);
|
||||||
|
}
|
||||||
|
|
||||||
|
CMakeRunConfiguration::~CMakeRunConfiguration()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeRunConfiguration::type() const
|
||||||
|
{
|
||||||
|
return Constants::CMAKERUNCONFIGURATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeRunConfiguration::executable() const
|
||||||
|
{
|
||||||
|
return m_target;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::ApplicationRunConfiguration::RunMode CMakeRunConfiguration::runMode() const
|
||||||
|
{
|
||||||
|
return ProjectExplorer::ApplicationRunConfiguration::Gui;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeRunConfiguration::workingDirectory() const
|
||||||
|
{
|
||||||
|
return m_workingDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList CMakeRunConfiguration::commandLineArguments() const
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return QStringList();
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::Environment CMakeRunConfiguration::environment() const
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
return ProjectExplorer::Environment::systemEnvironment();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeRunConfiguration::save(ProjectExplorer::PersistentSettingsWriter &writer) const
|
||||||
|
{
|
||||||
|
ProjectExplorer::ApplicationRunConfiguration::save(writer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMakeRunConfiguration::restore(const ProjectExplorer::PersistentSettingsReader &reader)
|
||||||
|
{
|
||||||
|
ProjectExplorer::ApplicationRunConfiguration::restore(reader);
|
||||||
|
}
|
||||||
|
|
||||||
|
QWidget *CMakeRunConfiguration::configurationWidget()
|
||||||
|
{
|
||||||
|
//TODO
|
||||||
|
return new QWidget();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Factory
|
||||||
|
CMakeRunConfigurationFactory::CMakeRunConfigurationFactory()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CMakeRunConfigurationFactory::~CMakeRunConfigurationFactory()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// used to recreate the runConfigurations when restoring settings
|
||||||
|
bool CMakeRunConfigurationFactory::canCreate(const QString &type) const
|
||||||
|
{
|
||||||
|
if (type.startsWith(Constants::CMAKERUNCONFIGURATION))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// used to show the list of possible additons to a project, returns a list of types
|
||||||
|
QStringList CMakeRunConfigurationFactory::canCreate(ProjectExplorer::Project *project) const
|
||||||
|
{
|
||||||
|
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||||
|
if (!pro)
|
||||||
|
return QStringList();
|
||||||
|
// TODO gather all targets and return them here
|
||||||
|
return QStringList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// used to translate the types to names to display to the user
|
||||||
|
QString CMakeRunConfigurationFactory::nameForType(const QString &type) const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(type.startsWith(Constants::CMAKERUNCONFIGURATION), /**/);
|
||||||
|
|
||||||
|
if (type == Constants::CMAKERUNCONFIGURATION)
|
||||||
|
return "CMake"; // Doesn't happen
|
||||||
|
else
|
||||||
|
return type.mid(QString(Constants::CMAKERUNCONFIGURATION).length());
|
||||||
|
}
|
||||||
|
|
||||||
|
QSharedPointer<ProjectExplorer::RunConfiguration> CMakeRunConfigurationFactory::create(ProjectExplorer::Project *project, const QString &type)
|
||||||
|
{
|
||||||
|
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||||
|
QTC_ASSERT(pro, /**/);
|
||||||
|
if (type == Constants::CMAKERUNCONFIGURATION) {
|
||||||
|
// Restoring, filename will be added by restoreSettings
|
||||||
|
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(pro, QString::null, QString::null));
|
||||||
|
return rc;
|
||||||
|
} else {
|
||||||
|
// Adding new
|
||||||
|
QString file = type.mid(QString(Constants::CMAKERUNCONFIGURATION).length());
|
||||||
|
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(pro, file, QString::null));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
93
src/plugins/cmakeprojectmanager/cmakerunconfiguration.h
Normal file
93
src/plugins/cmakeprojectmanager/cmakerunconfiguration.h
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** Non-Open Source Usage
|
||||||
|
**
|
||||||
|
** Licensees may use this file in accordance with the Qt Beta Version
|
||||||
|
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||||
|
** alternatively, in accordance with the terms contained in a written
|
||||||
|
** agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU General
|
||||||
|
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||||
|
** of this file. Please review the following information to ensure GNU
|
||||||
|
** General Public Licensing requirements will be met:
|
||||||
|
**
|
||||||
|
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||||
|
** http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||||
|
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CMAKERUNCONFIGURATION_H
|
||||||
|
#define CMAKERUNCONFIGURATION_H
|
||||||
|
|
||||||
|
#include <projectexplorer/applicationrunconfiguration.h>
|
||||||
|
#include <projectexplorer/environment.h>
|
||||||
|
#include <projectexplorer/persistentsettings.h>
|
||||||
|
|
||||||
|
namespace CMakeProjectManager {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class CMakeProject;
|
||||||
|
|
||||||
|
class CMakeRunConfiguration : public ProjectExplorer::ApplicationRunConfiguration
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CMakeRunConfiguration(CMakeProject *pro, const QString &target, const QString &workingDirectory);
|
||||||
|
virtual ~CMakeRunConfiguration();
|
||||||
|
virtual QString type() const;
|
||||||
|
virtual QString executable() const;
|
||||||
|
virtual RunMode runMode() const;
|
||||||
|
virtual QString workingDirectory() const;
|
||||||
|
virtual QStringList commandLineArguments() const;
|
||||||
|
virtual ProjectExplorer::Environment environment() const;
|
||||||
|
virtual QWidget *configurationWidget();
|
||||||
|
|
||||||
|
virtual void save(ProjectExplorer::PersistentSettingsWriter &writer) const;
|
||||||
|
virtual void restore(const ProjectExplorer::PersistentSettingsReader &reader);
|
||||||
|
private:
|
||||||
|
QString m_target;
|
||||||
|
QString m_workingDirectory;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* The run configuration factory is used for restoring run configurations from
|
||||||
|
* settings. And used to create new runconfigurations in the "Run Settings" Dialog.
|
||||||
|
* For the first case bool canCreate(const QString &type) and
|
||||||
|
* QSharedPointer<RunConfiguration> create(Project *project, QString type) are used.
|
||||||
|
* For the second type the functions QStringList canCreate(Project *pro) and
|
||||||
|
* QString nameForType(const QString&) are used to generate a list of creatable
|
||||||
|
* RunConfigurations, and create(..) is used to create it.
|
||||||
|
*/
|
||||||
|
class CMakeRunConfigurationFactory : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT;
|
||||||
|
public:
|
||||||
|
CMakeRunConfigurationFactory();
|
||||||
|
virtual ~CMakeRunConfigurationFactory();
|
||||||
|
// used to recreate the runConfigurations when restoring settings
|
||||||
|
virtual bool canCreate(const QString &type) const;
|
||||||
|
// used to show the list of possible additons to a project, returns a list of types
|
||||||
|
virtual QStringList canCreate(ProjectExplorer::Project *pro) const;
|
||||||
|
// used to translate the types to names to display to the user
|
||||||
|
virtual QString nameForType(const QString &type) const;
|
||||||
|
virtual QSharedPointer<ProjectExplorer::RunConfiguration> create(ProjectExplorer::Project *project, const QString &type);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // CMAKERUNCONFIGURATION_H
|
||||||
@@ -32,8 +32,11 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "cmakestep.h"
|
#include "cmakestep.h"
|
||||||
#include "cmakeprojectconstants.h"
|
|
||||||
#include "cmakeproject.h"
|
#include "cmakeproject.h"
|
||||||
|
#include "cmakeprojectconstants.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace CMakeProjectManager;
|
using namespace CMakeProjectManager;
|
||||||
using namespace CMakeProjectManager::Internal;
|
using namespace CMakeProjectManager::Internal;
|
||||||
@@ -41,12 +44,10 @@ using namespace CMakeProjectManager::Internal;
|
|||||||
CMakeStep::CMakeStep(CMakeProject *pro)
|
CMakeStep::CMakeStep(CMakeProject *pro)
|
||||||
: AbstractProcessStep(pro), m_pro(pro)
|
: AbstractProcessStep(pro), m_pro(pro)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeStep::~CMakeStep()
|
CMakeStep::~CMakeStep()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeStep::init(const QString &buildConfiguration)
|
bool CMakeStep::init(const QString &buildConfiguration)
|
||||||
@@ -61,6 +62,11 @@ bool CMakeStep::init(const QString &buildConfiguration)
|
|||||||
|
|
||||||
void CMakeStep::run(QFutureInterface<bool> &fi)
|
void CMakeStep::run(QFutureInterface<bool> &fi)
|
||||||
{
|
{
|
||||||
|
// TODO we want to only run cmake if the command line arguments or
|
||||||
|
// the CmakeLists.txt has actually changed
|
||||||
|
// And we want all of them to share the SAME command line arguments
|
||||||
|
// Shadow building ruins this, hmm, hmm
|
||||||
|
//
|
||||||
AbstractProcessStep::run(fi);
|
AbstractProcessStep::run(fi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,9 +115,9 @@ bool CMakeBuildStepFactory::canCreate(const QString &name) const
|
|||||||
|
|
||||||
ProjectExplorer::BuildStep *CMakeBuildStepFactory::create(ProjectExplorer::Project *project, const QString &name) const
|
ProjectExplorer::BuildStep *CMakeBuildStepFactory::create(ProjectExplorer::Project *project, const QString &name) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(name == Constants::CMAKESTEP);
|
QTC_ASSERT(name == Constants::CMAKESTEP, /**/);
|
||||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||||
Q_ASSERT(pro);
|
QTC_ASSERT(pro, /**/);
|
||||||
return new CMakeStep(pro);
|
return new CMakeStep(pro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,18 +35,18 @@
|
|||||||
#include "cmakeprojectconstants.h"
|
#include "cmakeprojectconstants.h"
|
||||||
#include "cmakeproject.h"
|
#include "cmakeproject.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace CMakeProjectManager;
|
using namespace CMakeProjectManager;
|
||||||
using namespace CMakeProjectManager::Internal;
|
using namespace CMakeProjectManager::Internal;
|
||||||
|
|
||||||
MakeStep::MakeStep(CMakeProject *pro)
|
MakeStep::MakeStep(CMakeProject *pro)
|
||||||
: AbstractProcessStep(pro), m_pro(pro)
|
: AbstractProcessStep(pro), m_pro(pro)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeStep::~MakeStep()
|
MakeStep::~MakeStep()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MakeStep::init(const QString &buildConfiguration)
|
bool MakeStep::init(const QString &buildConfiguration)
|
||||||
@@ -109,9 +109,9 @@ bool MakeBuildStepFactory::canCreate(const QString &name) const
|
|||||||
|
|
||||||
ProjectExplorer::BuildStep *MakeBuildStepFactory::create(ProjectExplorer::Project *project, const QString &name) const
|
ProjectExplorer::BuildStep *MakeBuildStepFactory::create(ProjectExplorer::Project *project, const QString &name) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(name == Constants::MAKESTEP);
|
QTC_ASSERT(name == Constants::MAKESTEP, return 0);
|
||||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||||
Q_ASSERT(pro);
|
QTC_ASSERT(pro, return 0);
|
||||||
return new MakeStep(pro);
|
return new MakeStep(pro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -456,7 +456,7 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (firstExtensionPageHit)
|
if (firstExtensionPageHit)
|
||||||
foreach(IFileWizardExtension *ex, extensions)
|
foreach (IFileWizardExtension *ex, extensions)
|
||||||
ex->firstExtensionPageShown(files);
|
ex->firstExtensionPageShown(files);
|
||||||
if (accepted)
|
if (accepted)
|
||||||
break;
|
break;
|
||||||
@@ -486,7 +486,7 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Run the extensions
|
// Run the extensions
|
||||||
foreach(IFileWizardExtension *ex, extensions)
|
foreach (IFileWizardExtension *ex, extensions)
|
||||||
if (!ex->process(files, &errorMessage)) {
|
if (!ex->process(files, &errorMessage)) {
|
||||||
QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage);
|
QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage);
|
||||||
return QStringList();
|
return QStringList();
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory,
|
|||||||
setupUi(this);
|
setupUi(this);
|
||||||
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||||
|
|
||||||
|
splitter->setCollapsible(1, false);
|
||||||
pageTree->header()->setVisible(false);
|
pageTree->header()->setVisible(false);
|
||||||
|
|
||||||
connect(pageTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
|
connect(pageTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
|
||||||
@@ -58,8 +59,8 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory,
|
|||||||
CoreImpl::instance()->pluginManager()->getObjects<IOptionsPage>();
|
CoreImpl::instance()->pluginManager()->getObjects<IOptionsPage>();
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
foreach(IOptionsPage *page, pages) {
|
foreach (IOptionsPage *page, pages) {
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem;
|
||||||
item->setText(0, page->name());
|
item->setText(0, page->name());
|
||||||
item->setData(0, Qt::UserRole, index);
|
item->setData(0, Qt::UserRole, index);
|
||||||
|
|
||||||
@@ -77,7 +78,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory,
|
|||||||
|
|
||||||
int catCount = 1;
|
int catCount = 1;
|
||||||
while (catCount < categoriesId.count()) {
|
while (catCount < categoriesId.count()) {
|
||||||
if(!categories.contains(currentCategory + QLatin1Char('|') + categoriesId.at(catCount))) {
|
if (!categories.contains(currentCategory + QLatin1Char('|') + categoriesId.at(catCount))) {
|
||||||
treeitem = new QTreeWidgetItem(categories.value(currentCategory));
|
treeitem = new QTreeWidgetItem(categories.value(currentCategory));
|
||||||
currentCategory += QLatin1Char('|') + categoriesId.at(catCount);
|
currentCategory += QLatin1Char('|') + categoriesId.at(catCount);
|
||||||
treeitem->setText(0, trCategories.at(catCount));
|
treeitem->setText(0, trCategories.at(catCount));
|
||||||
@@ -123,14 +124,14 @@ void SettingsDialog::pageSelected(QTreeWidgetItem *)
|
|||||||
|
|
||||||
void SettingsDialog::accept()
|
void SettingsDialog::accept()
|
||||||
{
|
{
|
||||||
foreach(IOptionsPage *page, m_pages)
|
foreach (IOptionsPage *page, m_pages)
|
||||||
page->finished(true);
|
page->finished(true);
|
||||||
done(QDialog::Accepted);
|
done(QDialog::Accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::reject()
|
void SettingsDialog::reject()
|
||||||
{
|
{
|
||||||
foreach(IOptionsPage *page, m_pages)
|
foreach (IOptionsPage *page, m_pages)
|
||||||
page->finished(false);
|
page->finished(false);
|
||||||
done(QDialog::Rejected);
|
done(QDialog::Rejected);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ QWidget *ShortcutSettings::createPage(QWidget *parent)
|
|||||||
void ShortcutSettings::finished(bool accepted)
|
void ShortcutSettings::finished(bool accepted)
|
||||||
{
|
{
|
||||||
if (accepted) {
|
if (accepted) {
|
||||||
foreach(ShortcutItem *item, m_scitems) {
|
foreach (ShortcutItem *item, m_scitems) {
|
||||||
item->m_cmd->setKeySequence(item->m_key);
|
item->m_cmd->setKeySequence(item->m_key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,7 +196,7 @@ bool ShortcutSettings::filter(const QString &f, const QTreeWidgetItem *item)
|
|||||||
if (f.isEmpty())
|
if (f.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
for (int i = 0; i < item->columnCount(); ++i) {
|
for (int i = 0; i < item->columnCount(); ++i) {
|
||||||
if(item->text(i).contains(f, Qt::CaseInsensitive))
|
if (item->text(i).contains(f, Qt::CaseInsensitive))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -242,7 +242,7 @@ void ShortcutSettings::importAction()
|
|||||||
CommandsFile cf(fileName);
|
CommandsFile cf(fileName);
|
||||||
QMap<QString, QKeySequence> mapping = cf.importCommands();
|
QMap<QString, QKeySequence> mapping = cf.importCommands();
|
||||||
|
|
||||||
foreach(ShortcutItem *item, m_scitems) {
|
foreach (ShortcutItem *item, m_scitems) {
|
||||||
QString sid = uidm->stringForUniqueIdentifier(item->m_cmd->id());
|
QString sid = uidm->stringForUniqueIdentifier(item->m_cmd->id());
|
||||||
if (mapping.contains(sid)) {
|
if (mapping.contains(sid)) {
|
||||||
item->m_key = mapping.value(sid);
|
item->m_key = mapping.value(sid);
|
||||||
@@ -256,7 +256,7 @@ void ShortcutSettings::importAction()
|
|||||||
|
|
||||||
void ShortcutSettings::defaultAction()
|
void ShortcutSettings::defaultAction()
|
||||||
{
|
{
|
||||||
foreach(ShortcutItem *item, m_scitems) {
|
foreach (ShortcutItem *item, m_scitems) {
|
||||||
item->m_key = item->m_cmd->defaultKeySequence();
|
item->m_key = item->m_cmd->defaultKeySequence();
|
||||||
item->m_item->setText(2, item->m_key);
|
item->m_item->setText(2, item->m_key);
|
||||||
if (item->m_item == m_page->commandList->currentItem())
|
if (item->m_item == m_page->commandList->currentItem())
|
||||||
|
|||||||
@@ -32,15 +32,18 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "editorgroup.h"
|
#include "editorgroup.h"
|
||||||
|
|
||||||
#include "editormanager.h"
|
#include "editormanager.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QtGui/QStyle>
|
#include <QtGui/QStyle>
|
||||||
#include <QtGui/QStyleOption>
|
#include <QtGui/QStyleOption>
|
||||||
#include <QtCore/QtDebug>
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
#include <QtGui/QMacStyle>
|
#include <QtGui/QMacStyle>
|
||||||
#endif
|
#endif
|
||||||
@@ -107,20 +110,20 @@ QVariant EditorModel::data(const QModelIndex &index, int role) const
|
|||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
IEditor *editor = m_editors.at(index.row());
|
IEditor *editor = m_editors.at(index.row());
|
||||||
Q_ASSERT(editor);
|
QTC_ASSERT(editor, return QVariant());
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
return editor->file()->isModified()
|
return editor->file()->isModified()
|
||||||
?editor->displayName()+QLatin1String("*")
|
? editor->displayName() + QLatin1String("*")
|
||||||
:editor->displayName();
|
: editor->displayName();
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
return editor->file()->isReadOnly()
|
return editor->file()->isReadOnly()
|
||||||
?QIcon(QLatin1String(":/qworkbench/images/locked.png"))
|
? QIcon(QLatin1String(":/qworkbench/images/locked.png"))
|
||||||
:QIcon();
|
: QIcon();
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
return editor->file()->fileName().isEmpty()
|
return editor->file()->fileName().isEmpty()
|
||||||
?editor->displayName()
|
? editor->displayName()
|
||||||
:QDir::toNativeSeparators(editor->file()->fileName());
|
: QDir::toNativeSeparators(editor->file()->fileName());
|
||||||
case Qt::UserRole:
|
case Qt::UserRole:
|
||||||
return qVariantFromValue(editor);
|
return qVariantFromValue(editor);
|
||||||
default:
|
default:
|
||||||
@@ -145,6 +148,7 @@ EditorGroupContext::EditorGroupContext(EditorGroup *editorGroup)
|
|||||||
m_editorGroup(editorGroup)
|
m_editorGroup(editorGroup)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> EditorGroupContext::context() const
|
QList<int> EditorGroupContext::context() const
|
||||||
{
|
{
|
||||||
return m_context;
|
return m_context;
|
||||||
|
|||||||
@@ -53,21 +53,23 @@
|
|||||||
#include <coreplugin/baseview.h>
|
#include <coreplugin/baseview.h>
|
||||||
#include <coreplugin/imode.h>
|
#include <coreplugin/imode.h>
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
#include <utils/qtcassert.h>
|
||||||
#include <QtCore/QSettings>
|
|
||||||
#include <QtCore/QMap>
|
|
||||||
#include <QtCore/QSet>
|
|
||||||
#include <QtCore/QProcess>
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
|
#include <QtCore/QMap>
|
||||||
|
#include <QtCore/QProcess>
|
||||||
|
#include <QtCore/QSet>
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QLayout>
|
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QSplitter>
|
|
||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
|
#include <QtGui/QLayout>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
#include <QtGui/QPushButton>
|
#include <QtGui/QPushButton>
|
||||||
|
#include <QtGui/QSplitter>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Core::Internal;
|
using namespace Core::Internal;
|
||||||
@@ -961,11 +963,10 @@ bool EditorManager::hasEditor(const QString &fileName) const
|
|||||||
|
|
||||||
void EditorManager::restoreEditorState(IEditor *editor)
|
void EditorManager::restoreEditorState(IEditor *editor)
|
||||||
{
|
{
|
||||||
Q_ASSERT(editor);
|
QTC_ASSERT(editor, return);
|
||||||
QString fileName = editor->file()->fileName();
|
QString fileName = editor->file()->fileName();
|
||||||
if (m_d->m_editorStates.contains(fileName)) {
|
if (m_d->m_editorStates.contains(fileName))
|
||||||
editor->restoreState(m_d->m_editorStates.value(fileName).toByteArray());
|
editor->restoreState(m_d->m_editorStates.value(fileName).toByteArray());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditorManager::saveEditor(IEditor *editor)
|
bool EditorManager::saveEditor(IEditor *editor)
|
||||||
@@ -1089,7 +1090,7 @@ bool EditorManager::saveFileAs(IEditor *editor)
|
|||||||
const bool success = editor->file()->save(absoluteFilePath);
|
const bool success = editor->file()->save(absoluteFilePath);
|
||||||
m_d->m_core->fileManager()->unblockFileChange(editor->file());
|
m_d->m_core->fileManager()->unblockFileChange(editor->file());
|
||||||
|
|
||||||
if(success)
|
if (success)
|
||||||
m_d->m_core->fileManager()->addToRecentFiles(editor->file()->fileName());
|
m_d->m_core->fileManager()->addToRecentFiles(editor->file()->fileName());
|
||||||
|
|
||||||
updateActions();
|
updateActions();
|
||||||
|
|||||||
@@ -32,16 +32,19 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "editorsplitter.h"
|
#include "editorsplitter.h"
|
||||||
|
|
||||||
#include "editormanager.h"
|
#include "editormanager.h"
|
||||||
|
#include "minisplitter.h"
|
||||||
#include "openeditorswindow.h"
|
#include "openeditorswindow.h"
|
||||||
#include "stackededitorgroup.h"
|
#include "stackededitorgroup.h"
|
||||||
#include "minisplitter.h"
|
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtGui/QHBoxLayout>
|
#include <QtGui/QHBoxLayout>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
@@ -160,7 +163,7 @@ void EditorSplitter::registerActions()
|
|||||||
void EditorSplitter::updateActions()
|
void EditorSplitter::updateActions()
|
||||||
{
|
{
|
||||||
const bool hasMultipleGroups = (qobject_cast<QSplitter*>(m_root) != 0);
|
const bool hasMultipleGroups = (qobject_cast<QSplitter*>(m_root) != 0);
|
||||||
Q_ASSERT(currentGroup());
|
QTC_ASSERT(currentGroup(), return);
|
||||||
const bool hasEditors = (currentGroup()->editorCount() != 0);
|
const bool hasEditors = (currentGroup()->editorCount() != 0);
|
||||||
m_unsplitAction->setEnabled(hasMultipleGroups);
|
m_unsplitAction->setEnabled(hasMultipleGroups);
|
||||||
#if 0
|
#if 0
|
||||||
@@ -245,7 +248,7 @@ void EditorSplitter::collectGroups(QWidget *widget, QList<EditorGroup*> &groups)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QSplitter *splitter = qobject_cast<QSplitter*>(widget);
|
QSplitter *splitter = qobject_cast<QSplitter*>(widget);
|
||||||
Q_ASSERT(splitter);
|
QTC_ASSERT(splitter, return);
|
||||||
collectGroups(splitter->widget(LEFT), groups);
|
collectGroups(splitter->widget(LEFT), groups);
|
||||||
collectGroups(splitter->widget(RIGHT), groups);
|
collectGroups(splitter->widget(RIGHT), groups);
|
||||||
}
|
}
|
||||||
@@ -330,7 +333,7 @@ void EditorSplitter::unsplit()
|
|||||||
if (!curGroup)
|
if (!curGroup)
|
||||||
return;
|
return;
|
||||||
QWidget *curGroupWidget = curGroup->widget();
|
QWidget *curGroupWidget = curGroup->widget();
|
||||||
Q_ASSERT(curGroupWidget);
|
QTC_ASSERT(curGroupWidget, return);
|
||||||
IEditor *selectedEditor = curGroup->currentEditor();
|
IEditor *selectedEditor = curGroup->currentEditor();
|
||||||
|
|
||||||
QSplitter *parentSplitter = qobject_cast<QSplitter*>(curGroupWidget->parentWidget());
|
QSplitter *parentSplitter = qobject_cast<QSplitter*>(curGroupWidget->parentWidget());
|
||||||
@@ -454,25 +457,25 @@ EditorGroup *EditorSplitter::groupFarthestOnSide(QWidget *node, Side side) const
|
|||||||
void EditorSplitter::selectNextGroup()
|
void EditorSplitter::selectNextGroup()
|
||||||
{
|
{
|
||||||
EditorGroup *curGroup = currentGroup();
|
EditorGroup *curGroup = currentGroup();
|
||||||
Q_ASSERT(curGroup);
|
QTC_ASSERT(curGroup, return);
|
||||||
setCurrentGroup(nextGroup(curGroup, RIGHT));
|
setCurrentGroup(nextGroup(curGroup, RIGHT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorSplitter::selectPreviousGroup()
|
void EditorSplitter::selectPreviousGroup()
|
||||||
{
|
{
|
||||||
EditorGroup *curGroup = currentGroup();
|
EditorGroup *curGroup = currentGroup();
|
||||||
Q_ASSERT(curGroup);
|
QTC_ASSERT(curGroup, return);
|
||||||
setCurrentGroup(nextGroup(curGroup, LEFT));
|
setCurrentGroup(nextGroup(curGroup, LEFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorGroup *EditorSplitter::nextGroup(EditorGroup *curGroup, Side side) const
|
EditorGroup *EditorSplitter::nextGroup(EditorGroup *curGroup, Side side) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(curGroup);
|
QTC_ASSERT(curGroup, return 0);
|
||||||
QWidget *curWidget = curGroup->widget();
|
QWidget *curWidget = curGroup->widget();
|
||||||
QWidget *parent = curWidget->parentWidget();
|
QWidget *parent = curWidget->parentWidget();
|
||||||
while (curWidget != m_root) {
|
while (curWidget != m_root) {
|
||||||
QSplitter *splitter = qobject_cast<QSplitter *>(parent);
|
QSplitter *splitter = qobject_cast<QSplitter *>(parent);
|
||||||
Q_ASSERT(splitter);
|
QTC_ASSERT(splitter, return 0);
|
||||||
if (splitter->widget(side) != curWidget) {
|
if (splitter->widget(side) != curWidget) {
|
||||||
curWidget = splitter->widget(side);
|
curWidget = splitter->widget(side);
|
||||||
break;
|
break;
|
||||||
@@ -486,7 +489,7 @@ EditorGroup *EditorSplitter::nextGroup(EditorGroup *curGroup, Side side) const
|
|||||||
void EditorSplitter::moveDocToAdjacentGroup(Side side)
|
void EditorSplitter::moveDocToAdjacentGroup(Side side)
|
||||||
{
|
{
|
||||||
EditorGroup *curGroup = currentGroup();
|
EditorGroup *curGroup = currentGroup();
|
||||||
Q_ASSERT(curGroup);
|
QTC_ASSERT(curGroup, return);
|
||||||
IEditor *editor = curGroup->currentEditor();
|
IEditor *editor = curGroup->currentEditor();
|
||||||
if (!editor)
|
if (!editor)
|
||||||
return;
|
return;
|
||||||
@@ -510,7 +513,7 @@ QWidget *EditorSplitter::recreateGroupTree(QWidget *node)
|
|||||||
QSplitter *splitter = qobject_cast<QSplitter *>(node);
|
QSplitter *splitter = qobject_cast<QSplitter *>(node);
|
||||||
if (!splitter) {
|
if (!splitter) {
|
||||||
EditorGroup *group = qobject_cast<EditorGroup *>(node);
|
EditorGroup *group = qobject_cast<EditorGroup *>(node);
|
||||||
Q_ASSERT(group);
|
QTC_ASSERT(group, return 0);
|
||||||
IEditor *currentEditor = group->currentEditor();
|
IEditor *currentEditor = group->currentEditor();
|
||||||
EditorGroup *newGroup = createGroup();
|
EditorGroup *newGroup = createGroup();
|
||||||
bool block = newGroup->widget()->blockSignals(true);
|
bool block = newGroup->widget()->blockSignals(true);
|
||||||
@@ -588,7 +591,7 @@ void EditorSplitter::saveState(QWidget *current, QDataStream &stream) const
|
|||||||
saveState(splitter->widget(1), stream);
|
saveState(splitter->widget(1), stream);
|
||||||
} else {
|
} else {
|
||||||
EditorGroup *group = qobject_cast<EditorGroup *>(current);
|
EditorGroup *group = qobject_cast<EditorGroup *>(current);
|
||||||
Q_ASSERT(group);
|
QTC_ASSERT(group, /**/);
|
||||||
if (group != currentGroup())
|
if (group != currentGroup())
|
||||||
type = 1;
|
type = 1;
|
||||||
else
|
else
|
||||||
@@ -639,7 +642,7 @@ void EditorSplitter::fillPathGroupMap(QWidget *current, QString currentPath,
|
|||||||
map.insert(currentPath, group);
|
map.insert(currentPath, group);
|
||||||
} else {
|
} else {
|
||||||
QSplitter *splitter = qobject_cast<QSplitter *>(current);
|
QSplitter *splitter = qobject_cast<QSplitter *>(current);
|
||||||
Q_ASSERT(splitter);
|
QTC_ASSERT(splitter, return);
|
||||||
fillPathGroupMap(splitter->widget(0), currentPath+"0", map);
|
fillPathGroupMap(splitter->widget(0), currentPath+"0", map);
|
||||||
fillPathGroupMap(splitter->widget(1), currentPath+"1", map);
|
fillPathGroupMap(splitter->widget(1), currentPath+"1", map);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/filemanager.h>
|
#include <coreplugin/filemanager.h>
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
@@ -70,7 +71,7 @@ OpenEditorsWidget::OpenEditorsWidget()
|
|||||||
m_ui.editorList->installEventFilter(this);
|
m_ui.editorList->installEventFilter(this);
|
||||||
m_ui.editorList->setFrameStyle(QFrame::NoFrame);
|
m_ui.editorList->setFrameStyle(QFrame::NoFrame);
|
||||||
EditorManager *em = EditorManager::instance();
|
EditorManager *em = EditorManager::instance();
|
||||||
foreach(IEditor *editor, em->openedEditors()) {
|
foreach (IEditor *editor, em->openedEditors()) {
|
||||||
registerEditor(editor);
|
registerEditor(editor);
|
||||||
}
|
}
|
||||||
connect(em, SIGNAL(editorOpened(Core::IEditor*)),
|
connect(em, SIGNAL(editorOpened(Core::IEditor*)),
|
||||||
@@ -197,7 +198,7 @@ void OpenEditorsWidget::selectEditor(QTreeWidgetItem *item)
|
|||||||
void OpenEditorsWidget::updateEditor()
|
void OpenEditorsWidget::updateEditor()
|
||||||
{
|
{
|
||||||
IEditor *editor = qobject_cast<IEditor *>(sender());
|
IEditor *editor = qobject_cast<IEditor *>(sender());
|
||||||
Q_ASSERT(editor);
|
QTC_ASSERT(editor, return);
|
||||||
int num = m_ui.editorList->topLevelItemCount();
|
int num = m_ui.editorList->topLevelItemCount();
|
||||||
for (int i = 0; i < num; ++i) {
|
for (int i = 0; i < num; ++i) {
|
||||||
QTreeWidgetItem *item = m_ui.editorList->topLevelItem(i);
|
QTreeWidgetItem *item = m_ui.editorList->topLevelItem(i);
|
||||||
|
|||||||
@@ -35,21 +35,24 @@
|
|||||||
#include "editormanager.h"
|
#include "editormanager.h"
|
||||||
#include "coreimpl.h"
|
#include "coreimpl.h"
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtCore/QMimeData>
|
#include <QtCore/QMimeData>
|
||||||
|
|
||||||
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QHBoxLayout>
|
#include <QtGui/QHBoxLayout>
|
||||||
|
#include <QtGui/QLabel>
|
||||||
|
#include <QtGui/QMouseEvent>
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
|
#include <QtGui/QStackedWidget>
|
||||||
#include <QtGui/QStyle>
|
#include <QtGui/QStyle>
|
||||||
#include <QtGui/QStyleOption>
|
#include <QtGui/QStyleOption>
|
||||||
#include <QtGui/QMouseEvent>
|
|
||||||
#include <QtGui/QApplication>
|
|
||||||
#include <QtGui/QToolBar>
|
#include <QtGui/QToolBar>
|
||||||
#include <QtGui/QToolButton>
|
#include <QtGui/QToolButton>
|
||||||
#include <QtGui/QLabel>
|
|
||||||
#include <QtGui/QStackedWidget>
|
|
||||||
#include <QtDebug>
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
#include <qmacstyle_mac.h>
|
#include <qmacstyle_mac.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -240,7 +243,7 @@ void StackedEditorGroup::sendCloseRequest()
|
|||||||
|
|
||||||
void StackedEditorGroup::removeEditor(IEditor *editor)
|
void StackedEditorGroup::removeEditor(IEditor *editor)
|
||||||
{
|
{
|
||||||
Q_ASSERT(editor);
|
QTC_ASSERT(editor, return);
|
||||||
EditorGroup::removeEditor(editor);
|
EditorGroup::removeEditor(editor);
|
||||||
const int index = m_container->indexOf(editor->widget());
|
const int index = m_container->indexOf(editor->widget());
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
@@ -280,7 +283,7 @@ void StackedEditorGroup::setCurrentEditor(IEditor *editor)
|
|||||||
return;
|
return;
|
||||||
m_toplevel->setVisible(true);
|
m_toplevel->setVisible(true);
|
||||||
const int idx = m_container->indexOf(editor->widget());
|
const int idx = m_container->indexOf(editor->widget());
|
||||||
Q_ASSERT(idx >= 0);
|
QTC_ASSERT(idx >= 0, return);
|
||||||
if (m_container->currentIndex() != idx) {
|
if (m_container->currentIndex() != idx) {
|
||||||
m_container->setCurrentIndex(idx);
|
m_container->setCurrentIndex(idx);
|
||||||
|
|
||||||
@@ -298,10 +301,11 @@ void StackedEditorGroup::setCurrentEditor(IEditor *editor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackedEditorGroup::updateEditorStatus(IEditor *editor) {
|
void StackedEditorGroup::updateEditorStatus(IEditor *editor)
|
||||||
|
{
|
||||||
if (!editor)
|
if (!editor)
|
||||||
editor = qobject_cast<IEditor *>(sender());
|
editor = qobject_cast<IEditor *>(sender());
|
||||||
Q_ASSERT(editor);
|
QTC_ASSERT(editor, return);
|
||||||
|
|
||||||
static const QIcon lockedIcon(QLatin1String(":/qworkbench/images/locked.png"));
|
static const QIcon lockedIcon(QLatin1String(":/qworkbench/images/locked.png"));
|
||||||
static const QIcon unlockedIcon(QLatin1String(":/qworkbench/images/unlocked.png"));
|
static const QIcon unlockedIcon(QLatin1String(":/qworkbench/images/unlocked.png"));
|
||||||
@@ -371,6 +375,6 @@ int StackedEditorGroup::indexOf(IEditor *editor)
|
|||||||
if (editor == model->data(model->index(i, 0), Qt::UserRole).value<IEditor*>())
|
if (editor == model->data(model->index(i, 0), Qt::UserRole).value<IEditor*>())
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
Q_ASSERT(false);
|
QTC_ASSERT(false, /**/);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ void FileIconProvider::registerIconForSuffix(const QIcon &icon, const QString &s
|
|||||||
{
|
{
|
||||||
// delete old icon, if it exists
|
// delete old icon, if it exists
|
||||||
QList<QPair<QString,QIcon> >::iterator iter = m_cache.begin();
|
QList<QPair<QString,QIcon> >::iterator iter = m_cache.begin();
|
||||||
for(; iter != m_cache.end(); ++iter) {
|
for (; iter != m_cache.end(); ++iter) {
|
||||||
if ((*iter).first == suffix) {
|
if ((*iter).first == suffix) {
|
||||||
iter = m_cache.erase(iter);
|
iter = m_cache.erase(iter);
|
||||||
break;
|
break;
|
||||||
@@ -118,7 +118,7 @@ QIcon FileIconProvider::iconForSuffix(const QString &suffix) const
|
|||||||
return icon;
|
return icon;
|
||||||
|
|
||||||
QList<QPair<QString,QIcon> >::const_iterator iter = m_cache.constBegin();
|
QList<QPair<QString,QIcon> >::const_iterator iter = m_cache.constBegin();
|
||||||
for(; iter != m_cache.constEnd(); ++iter) {
|
for (; iter != m_cache.constEnd(); ++iter) {
|
||||||
if ((*iter).first == suffix) {
|
if ((*iter).first == suffix) {
|
||||||
icon = (*iter).second;
|
icon = (*iter).second;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "filemanager.h"
|
#include "filemanager.h"
|
||||||
|
|
||||||
#include "ifile.h"
|
#include "ifile.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "saveitemsdialog.h"
|
#include "saveitemsdialog.h"
|
||||||
@@ -40,6 +41,8 @@
|
|||||||
#include "mimedatabase.h"
|
#include "mimedatabase.h"
|
||||||
#include "iversioncontrol.h"
|
#include "iversioncontrol.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
@@ -177,22 +180,20 @@ bool FileManager::removeFile(IFile *file)
|
|||||||
|
|
||||||
void FileManager::addWatch(const QString &filename)
|
void FileManager::addWatch(const QString &filename)
|
||||||
{
|
{
|
||||||
if (!filename.isEmpty() && managedFiles(filename).isEmpty()) {
|
if (!filename.isEmpty() && managedFiles(filename).isEmpty())
|
||||||
m_fileWatcher->addPath(filename);
|
m_fileWatcher->addPath(filename);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileManager::removeWatch(const QString &filename)
|
void FileManager::removeWatch(const QString &filename)
|
||||||
{
|
{
|
||||||
if (!filename.isEmpty() && managedFiles(filename).isEmpty()) {
|
if (!filename.isEmpty() && managedFiles(filename).isEmpty())
|
||||||
m_fileWatcher->removePath(filename);
|
m_fileWatcher->removePath(filename);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileManager::checkForNewFileName()
|
void FileManager::checkForNewFileName()
|
||||||
{
|
{
|
||||||
IFile *file = qobject_cast<IFile *>(sender());
|
IFile *file = qobject_cast<IFile *>(sender());
|
||||||
Q_ASSERT(file);
|
QTC_ASSERT(file, return);
|
||||||
const QString newfilename = fixFileName(file->fileName());
|
const QString newfilename = fixFileName(file->fileName());
|
||||||
const QString oldfilename = m_managedFiles.value(file).fileName;
|
const QString oldfilename = m_managedFiles.value(file).fileName;
|
||||||
if (!newfilename.isEmpty() && newfilename != oldfilename) {
|
if (!newfilename.isEmpty() && newfilename != oldfilename) {
|
||||||
|
|||||||
@@ -896,7 +896,7 @@ void MainWindow::removeContextObject(IContext *context)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_contextWidgets.remove(widget);
|
m_contextWidgets.remove(widget);
|
||||||
if(m_activeContext == context)
|
if (m_activeContext == context)
|
||||||
updateContextObject(0);
|
updateContextObject(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -957,10 +957,11 @@ void MainWindow::resetContext()
|
|||||||
updateContextObject(0);
|
updateContextObject(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu *MainWindow::createPopupMenu() {
|
QMenu *MainWindow::createPopupMenu()
|
||||||
|
{
|
||||||
QMenu *menu = new QMenu(this);
|
QMenu *menu = new QMenu(this);
|
||||||
QList<ActionContainer *> containers = m_actionManager->containers();
|
QList<ActionContainer *> containers = m_actionManager->containers();
|
||||||
foreach(ActionContainer *c, containers) {
|
foreach (ActionContainer *c, containers) {
|
||||||
if (c->toolBar())
|
if (c->toolBar())
|
||||||
menu->addAction(c->toolBar()->toggleViewAction());
|
menu->addAction(c->toolBar()->toggleViewAction());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,30 +33,34 @@
|
|||||||
|
|
||||||
#include "manhattanstyle.h"
|
#include "manhattanstyle.h"
|
||||||
|
|
||||||
#include <QStyleOption>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QScrollArea>
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QDockWidget>
|
|
||||||
#include <QPixmapCache>
|
|
||||||
#include <QDialogButtonBox>
|
|
||||||
#include <QPixmap>
|
|
||||||
#include <QToolBar>
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QLibrary>
|
|
||||||
#include <QStatusBar>
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QStyleFactory>
|
|
||||||
#include <QToolButton>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QSplitter>
|
|
||||||
#include <QMenuBar>
|
|
||||||
#include "stylehelper.h"
|
#include "stylehelper.h"
|
||||||
#include "styleanimator.h"
|
#include "styleanimator.h"
|
||||||
#include <qdebug.h>
|
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QLibrary>
|
||||||
|
|
||||||
|
#include <QtGui/QApplication>
|
||||||
|
#include <QtGui/QComboBox>
|
||||||
|
#include <QtGui/QDialog>
|
||||||
|
#include <QtGui/QDialogButtonBox>
|
||||||
|
#include <QtGui/QDockWidget>
|
||||||
|
#include <QtGui/QLabel>
|
||||||
|
#include <QtGui/QLineEdit>
|
||||||
|
#include <QtGui/QMainWindow>
|
||||||
|
#include <QtGui/QMenuBar>
|
||||||
|
#include <QtGui/QPainter>
|
||||||
|
#include <QtGui/QPixmap>
|
||||||
|
#include <QtGui/QPixmapCache>
|
||||||
|
#include <QtGui/QPushButton>
|
||||||
|
#include <QtGui/QScrollArea>
|
||||||
|
#include <QtGui/QSplitter>
|
||||||
|
#include <QtGui/QStatusBar>
|
||||||
|
#include <QtGui/QStyleFactory>
|
||||||
|
#include <QtGui/QStyleOption>
|
||||||
|
#include <QtGui/QToolBar>
|
||||||
|
#include <QtGui/QToolButton>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
// We define a currently unused state for indicating animations
|
// We define a currently unused state for indicating animations
|
||||||
#define State_Animating 0x00000040
|
#define State_Animating 0x00000040
|
||||||
@@ -97,7 +101,7 @@ public:
|
|||||||
ManhattanStylePrivate(const QString &baseStyleName)
|
ManhattanStylePrivate(const QString &baseStyleName)
|
||||||
{
|
{
|
||||||
style = QStyleFactory::create(baseStyleName);
|
style = QStyleFactory::create(baseStyleName);
|
||||||
Q_ASSERT(style);
|
QTC_ASSERT(style, /**/);
|
||||||
buttonImage_pressed = QImage(":/qworkbench/images/pushbutton_pressed.png");
|
buttonImage_pressed = QImage(":/qworkbench/images/pushbutton_pressed.png");
|
||||||
buttonImage = QImage(":/qworkbench/images/pushbutton.png");
|
buttonImage = QImage(":/qworkbench/images/pushbutton.png");
|
||||||
|
|
||||||
@@ -105,12 +109,15 @@ public:
|
|||||||
lineeditImage_disabled = QImage(":/qworkbench/images/inputfield_disabled.png");
|
lineeditImage_disabled = QImage(":/qworkbench/images/inputfield_disabled.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
~ManhattanStylePrivate() {
|
~ManhattanStylePrivate()
|
||||||
|
{
|
||||||
delete style;
|
delete style;
|
||||||
style = 0;
|
style = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
public:
|
||||||
QStyle *style;
|
QStyle *style;
|
||||||
QImage buttonImage;
|
QImage buttonImage;
|
||||||
QImage buttonImage_pressed;
|
QImage buttonImage_pressed;
|
||||||
@@ -140,7 +147,7 @@ void drawCornerImage(const QImage &img, QPainter *painter, QRect rect,
|
|||||||
if (top > 0) { //top
|
if (top > 0) { //top
|
||||||
painter->drawImage(QRect(rect.left() + left, rect.top(), rect.width() -right - left, top), img,
|
painter->drawImage(QRect(rect.left() + left, rect.top(), rect.width() -right - left, top), img,
|
||||||
QRect(left, 0, size.width() -right - left, top));
|
QRect(left, 0, size.width() -right - left, top));
|
||||||
if(left > 0) //top-left
|
if (left > 0) //top-left
|
||||||
painter->drawImage(QRect(rect.left(), rect.top(), left, top), img,
|
painter->drawImage(QRect(rect.left(), rect.top(), left, top), img,
|
||||||
QRect(0, 0, left, top));
|
QRect(0, 0, left, top));
|
||||||
if (right > 0) //top-right
|
if (right > 0) //top-right
|
||||||
|
|||||||
@@ -33,19 +33,22 @@
|
|||||||
|
|
||||||
#include "mimedatabase.h"
|
#include "mimedatabase.h"
|
||||||
|
|
||||||
#include <QtCore/QStringList>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QtCore/QByteArray>
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
|
#include <QtCore/QLocale>
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QMap>
|
||||||
#include <QtCore/QMultiHash>
|
#include <QtCore/QMultiHash>
|
||||||
#include <QtCore/QDebug>
|
|
||||||
#include <QtCore/QRegExp>
|
#include <QtCore/QRegExp>
|
||||||
#include <QtCore/QCoreApplication>
|
|
||||||
#include <QtCore/QFileInfo>
|
|
||||||
#include <QtCore/QByteArray>
|
|
||||||
#include <QtCore/QSharedData>
|
#include <QtCore/QSharedData>
|
||||||
#include <QtCore/QSharedPointer>
|
#include <QtCore/QSharedPointer>
|
||||||
|
#include <QtCore/QStringList>
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
#include <QtCore/QLocale>
|
|
||||||
#include <QtXml/QXmlStreamReader>
|
#include <QtXml/QXmlStreamReader>
|
||||||
|
|
||||||
enum { debugMimeDB = 0 };
|
enum { debugMimeDB = 0 };
|
||||||
@@ -299,7 +302,7 @@ void MimeTypeData::debug(QTextStream &str, int indent) const
|
|||||||
str << indentS << "SubClassesOf: " << subClassesOf.join(comma) << '\n';
|
str << indentS << "SubClassesOf: " << subClassesOf.join(comma) << '\n';
|
||||||
if (!globPatterns.empty()) {
|
if (!globPatterns.empty()) {
|
||||||
str << indentS << "Glob: ";
|
str << indentS << "Glob: ";
|
||||||
foreach(const QRegExp &r, globPatterns)
|
foreach (const QRegExp &r, globPatterns)
|
||||||
str << r.pattern() << ' ';
|
str << r.pattern() << ' ';
|
||||||
str << '\n';
|
str << '\n';
|
||||||
if (!suffixes.empty()) {
|
if (!suffixes.empty()) {
|
||||||
@@ -574,7 +577,7 @@ BaseMimeTypeParser:: BaseMimeTypeParser() :
|
|||||||
// "*.log[1-9]"
|
// "*.log[1-9]"
|
||||||
m_suffixPattern(QLatin1String("^\\*\\.[\\w]+$"))
|
m_suffixPattern(QLatin1String("^\\*\\.[\\w]+$"))
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_suffixPattern.isValid());
|
QTC_ASSERT(m_suffixPattern.isValid(), /**/);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseMimeTypeParser::addGlobPattern(const QString &pattern, MimeTypeData *d) const
|
void BaseMimeTypeParser::addGlobPattern(const QString &pattern, MimeTypeData *d) const
|
||||||
|
|||||||
@@ -32,11 +32,13 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "modemanager.h"
|
#include "modemanager.h"
|
||||||
|
|
||||||
#include "fancytabwidget.h"
|
#include "fancytabwidget.h"
|
||||||
#include "fancyactionbar.h"
|
#include "fancyactionbar.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include <aggregation/aggregate.h>
|
#include <aggregation/aggregate.h>
|
||||||
|
|
||||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||||
#include <coreplugin/actionmanager/icommand.h>
|
#include <coreplugin/actionmanager/icommand.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
@@ -44,9 +46,12 @@
|
|||||||
#include <coreplugin/imode.h>
|
#include <coreplugin/imode.h>
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QSignalMapper>
|
#include <QtCore/QSignalMapper>
|
||||||
|
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QTabWidget>
|
#include <QtGui/QTabWidget>
|
||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
@@ -225,7 +230,7 @@ void ModeManager::currentTabChanged(int index)
|
|||||||
void ModeManager::setFocusToCurrentMode()
|
void ModeManager::setFocusToCurrentMode()
|
||||||
{
|
{
|
||||||
IMode *mode = currentMode();
|
IMode *mode = currentMode();
|
||||||
Q_ASSERT(mode);
|
QTC_ASSERT(mode, return);
|
||||||
QWidget *widget = mode->widget();
|
QWidget *widget = mode->widget();
|
||||||
if (widget) {
|
if (widget) {
|
||||||
QWidget *focusWidget = widget->focusWidget();
|
QWidget *focusWidget = widget->focusWidget();
|
||||||
|
|||||||
@@ -87,8 +87,8 @@ void NavigationWidgetPlaceHolder::applyStoredSize(int width)
|
|||||||
QList<int> sizes = splitter->sizes();
|
QList<int> sizes = splitter->sizes();
|
||||||
int index = splitter->indexOf(this);
|
int index = splitter->indexOf(this);
|
||||||
int diff = width - sizes.at(index);
|
int diff = width - sizes.at(index);
|
||||||
int adjust = sizes.count() > 1? ( diff / (sizes.count() - 1)) : 0;
|
int adjust = sizes.count() > 1 ? (diff / (sizes.count() - 1)) : 0;
|
||||||
for(int i=0; i<sizes.count(); ++i) {
|
for (int i = 0; i < sizes.count(); ++i) {
|
||||||
if (i != index)
|
if (i != index)
|
||||||
sizes[i] += adjust;
|
sizes[i] += adjust;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ void OutputPane::init(ICore *core, ExtensionSystem::PluginManager *pm)
|
|||||||
|
|
||||||
connect(cmd->action(), SIGNAL(triggered()), this, SLOT(shortcutTriggered()));
|
connect(cmd->action(), SIGNAL(triggered()), this, SLOT(shortcutTriggered()));
|
||||||
connect(cmd->action(), SIGNAL(changed()), this, SLOT(updateToolTip()));
|
connect(cmd->action(), SIGNAL(changed()), this, SLOT(updateToolTip()));
|
||||||
} while(it != begin);
|
} while (it != begin);
|
||||||
|
|
||||||
changePage();
|
changePage();
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,7 @@ void OutputPane::shortcutTriggered()
|
|||||||
// but the outputpane doesn't have focus
|
// but the outputpane doesn't have focus
|
||||||
// then just give it focus
|
// then just give it focus
|
||||||
// else do the same as clicking on the button does
|
// else do the same as clicking on the button does
|
||||||
if(OutputPanePlaceHolder::m_current
|
if (OutputPanePlaceHolder::m_current
|
||||||
&& OutputPanePlaceHolder::m_current->isVisible()
|
&& OutputPanePlaceHolder::m_current->isVisible()
|
||||||
&& m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx) {
|
&& m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx) {
|
||||||
if (!outputPane->hasFocus() && outputPane->canFocus())
|
if (!outputPane->hasFocus() && outputPane->canFocus())
|
||||||
|
|||||||
@@ -40,11 +40,13 @@
|
|||||||
#include "uniqueidmanager.h"
|
#include "uniqueidmanager.h"
|
||||||
#include "viewmanagerinterface.h"
|
#include "viewmanagerinterface.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Core::Internal;
|
using namespace Core::Internal;
|
||||||
|
|
||||||
ProgressManager::ProgressManager(QObject *parent) :
|
ProgressManager::ProgressManager(QObject *parent)
|
||||||
ProgressManagerInterface(parent)
|
: ProgressManagerInterface(parent)
|
||||||
{
|
{
|
||||||
m_progressView = new ProgressView;
|
m_progressView = new ProgressView;
|
||||||
ICore *core = CoreImpl::instance();
|
ICore *core = CoreImpl::instance();
|
||||||
@@ -103,7 +105,7 @@ QWidget *ProgressManager::progressView()
|
|||||||
void ProgressManager::taskFinished()
|
void ProgressManager::taskFinished()
|
||||||
{
|
{
|
||||||
QObject *taskObject = sender();
|
QObject *taskObject = sender();
|
||||||
Q_ASSERT(taskObject);
|
QTC_ASSERT(taskObject, return);
|
||||||
QFutureWatcher<void> *task = static_cast<QFutureWatcher<void> *>(taskObject);
|
QFutureWatcher<void> *task = static_cast<QFutureWatcher<void> *>(taskObject);
|
||||||
m_runningTasks.remove(task);
|
m_runningTasks.remove(task);
|
||||||
delete task;
|
delete task;
|
||||||
|
|||||||
@@ -101,9 +101,9 @@ void ProgressBar::paintEvent(QPaintEvent *)
|
|||||||
double percent = 0.50;
|
double percent = 0.50;
|
||||||
if (range != 0)
|
if (range != 0)
|
||||||
percent = (value() - minimum()) / range;
|
percent = (value() - minimum()) / range;
|
||||||
if(percent > 1)
|
if (percent > 1)
|
||||||
percent = 1;
|
percent = 1;
|
||||||
else if(percent < 0)
|
else if (percent < 0)
|
||||||
percent = 0;
|
percent = 0;
|
||||||
|
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
#include "progressview.h"
|
#include "progressview.h"
|
||||||
#include "futureprogress.h"
|
#include "futureprogress.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtGui/QHBoxLayout>
|
#include <QtGui/QHBoxLayout>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
@@ -136,7 +138,7 @@ void ProgressView::removeTask(FutureProgress *task)
|
|||||||
void ProgressView::slotFinished()
|
void ProgressView::slotFinished()
|
||||||
{
|
{
|
||||||
FutureProgress *progress = qobject_cast<FutureProgress *>(sender());
|
FutureProgress *progress = qobject_cast<FutureProgress *>(sender());
|
||||||
Q_ASSERT(progress);
|
QTC_ASSERT(progress, return);
|
||||||
if (m_keep.contains(progress) && !m_keep.value(progress) && !progress->hasError())
|
if (m_keep.contains(progress) && !m_keep.value(progress) && !progress->hasError())
|
||||||
removeTask(progress);
|
removeTask(progress);
|
||||||
removeOldTasks(m_type.value(progress), true);
|
removeOldTasks(m_type.value(progress), true);
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ void RightPanePlaceHolder::applyStoredSize(int width)
|
|||||||
QList<int> sizes = splitter->sizes();
|
QList<int> sizes = splitter->sizes();
|
||||||
int index = splitter->indexOf(this);
|
int index = splitter->indexOf(this);
|
||||||
int diff = width - sizes.at(index);
|
int diff = width - sizes.at(index);
|
||||||
int adjust = sizes.count() > 1? ( diff / (sizes.count() - 1)) : 0;
|
int adjust = sizes.count() > 1 ? (diff / (sizes.count() - 1)) : 0;
|
||||||
for(int i=0; i<sizes.count(); ++i) {
|
for (int i = 0; i < sizes.count(); ++i) {
|
||||||
if (i != index)
|
if (i != index)
|
||||||
sizes[i] -= adjust;
|
sizes[i] -= adjust;
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ void RightPanePlaceHolder::currentModeChanged(Core::IMode *mode)
|
|||||||
RightPaneWidget *RightPaneWidget::m_instance = 0;
|
RightPaneWidget *RightPaneWidget::m_instance = 0;
|
||||||
|
|
||||||
RightPaneWidget::RightPaneWidget()
|
RightPaneWidget::RightPaneWidget()
|
||||||
:m_shown(true), m_width(0)
|
: m_shown(true), m_width(0)
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
|
|
||||||
|
|||||||
@@ -38,12 +38,15 @@
|
|||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/editormanager/editorgroup.h>
|
#include <coreplugin/editormanager/editorgroup.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
#include <QtGui/QStatusBar>
|
#include <QtGui/QStatusBar>
|
||||||
#include <QtGui/QToolBar>
|
#include <QtGui/QToolBar>
|
||||||
|
|
||||||
#include <QtScript/QScriptEngine>
|
#include <QtScript/QScriptEngine>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -107,7 +110,7 @@ QString CorePrototype::toString() const
|
|||||||
CorePrototype::ICore *CorePrototype::callee() const
|
CorePrototype::ICore *CorePrototype::callee() const
|
||||||
{
|
{
|
||||||
ICore *rc = qscriptvalue_cast<ICore *>(thisObject());
|
ICore *rc = qscriptvalue_cast<ICore *>(thisObject());
|
||||||
Q_ASSERT(rc);
|
QTC_ASSERT(rc, return 0);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,14 +124,14 @@ MessageManagerPrototype::MessageManagerPrototype(QObject *parent) :
|
|||||||
void MessageManagerPrototype::displayStatusBarMessage(const QString &text, int ms)
|
void MessageManagerPrototype::displayStatusBarMessage(const QString &text, int ms)
|
||||||
{
|
{
|
||||||
MessageManager *mm = qscriptvalue_cast<MessageManager *>(thisObject());
|
MessageManager *mm = qscriptvalue_cast<MessageManager *>(thisObject());
|
||||||
Q_ASSERT(mm);
|
QTC_ASSERT(mm, return);
|
||||||
mm->displayStatusBarMessage(text, ms);
|
mm->displayStatusBarMessage(text, ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageManagerPrototype::printToOutputPane(const QString &text, bool bringToForeground)
|
void MessageManagerPrototype::printToOutputPane(const QString &text, bool bringToForeground)
|
||||||
{
|
{
|
||||||
MessageManager *mm = qscriptvalue_cast<MessageManager *>(thisObject());
|
MessageManager *mm = qscriptvalue_cast<MessageManager *>(thisObject());
|
||||||
Q_ASSERT(mm);
|
QTC_ASSERT(mm, return);
|
||||||
mm->printToOutputPane(text, bringToForeground);
|
mm->printToOutputPane(text, bringToForeground);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,28 +150,66 @@ FileManagerPrototype::FileManagerPrototype(QObject *parent) :
|
|||||||
FileManager *FileManagerPrototype::callee() const
|
FileManager *FileManagerPrototype::callee() const
|
||||||
{
|
{
|
||||||
FileManager *rc = qscriptvalue_cast<FileManager *>(thisObject());
|
FileManager *rc = qscriptvalue_cast<FileManager *>(thisObject());
|
||||||
Q_ASSERT(rc);
|
QTC_ASSERT(rc, return 0);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileManagerPrototype::addFiles(const QList<Core::IFile *> &files) { return callee()->addFiles(files); }
|
bool FileManagerPrototype::addFiles(const QList<Core::IFile *> &files)
|
||||||
bool FileManagerPrototype::addFile(Core::IFile *file) { return callee()->addFile(file); }
|
{
|
||||||
bool FileManagerPrototype::removeFile(Core::IFile *file) { return callee()->removeFile(file); }
|
return callee()->addFiles(files);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FileManagerPrototype::addFile(Core::IFile *file)
|
||||||
|
{
|
||||||
|
return callee()->addFile(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FileManagerPrototype::removeFile(Core::IFile *file)
|
||||||
|
{
|
||||||
|
return callee()->removeFile(file);
|
||||||
|
}
|
||||||
|
|
||||||
QList<Core::IFile*>
|
QList<Core::IFile*>
|
||||||
FileManagerPrototype::saveModifiedFilesSilently(const QList<Core::IFile*> &files) { return callee()->saveModifiedFilesSilently(files); }
|
FileManagerPrototype::saveModifiedFilesSilently(const QList<Core::IFile*> &files)
|
||||||
|
{
|
||||||
|
return callee()->saveModifiedFilesSilently(files);
|
||||||
|
}
|
||||||
|
|
||||||
QString FileManagerPrototype::getSaveAsFileName(Core::IFile *file) { return callee()->getSaveAsFileName(file); }
|
QString FileManagerPrototype::getSaveAsFileName(Core::IFile *file)
|
||||||
|
{
|
||||||
|
return callee()->getSaveAsFileName(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FileManagerPrototype::isFileManaged(const QString &fileName) const
|
||||||
|
{
|
||||||
|
return callee()->isFileManaged(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
bool FileManagerPrototype::isFileManaged(const QString &fileName) const { return callee()->isFileManaged(fileName); }
|
|
||||||
QList<Core::IFile *>
|
QList<Core::IFile *>
|
||||||
FileManagerPrototype::managedFiles(const QString &fileName) const { return callee()->managedFiles(fileName); }
|
FileManagerPrototype::managedFiles(const QString &fileName) const
|
||||||
|
{
|
||||||
|
return callee()->managedFiles(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
void FileManagerPrototype::blockFileChange(Core::IFile *file) { callee()->blockFileChange(file); }
|
void FileManagerPrototype::blockFileChange(Core::IFile *file)
|
||||||
void FileManagerPrototype::unblockFileChange(Core::IFile *file) { return callee()->unblockFileChange(file); }
|
{
|
||||||
|
callee()->blockFileChange(file);
|
||||||
|
}
|
||||||
|
|
||||||
void FileManagerPrototype::addToRecentFiles(const QString &fileName) { return callee()->addToRecentFiles(fileName); }
|
void FileManagerPrototype::unblockFileChange(Core::IFile *file)
|
||||||
QStringList FileManagerPrototype::recentFiles() const { return callee()->recentFiles(); }
|
{
|
||||||
|
return callee()->unblockFileChange(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileManagerPrototype::addToRecentFiles(const QString &fileName)
|
||||||
|
{
|
||||||
|
return callee()->addToRecentFiles(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList FileManagerPrototype::recentFiles() const
|
||||||
|
{
|
||||||
|
return callee()->recentFiles();
|
||||||
|
}
|
||||||
|
|
||||||
QString FileManagerPrototype::toString() const
|
QString FileManagerPrototype::toString() const
|
||||||
{
|
{
|
||||||
@@ -185,7 +226,7 @@ FilePrototype::FilePrototype(QObject *parent) :
|
|||||||
IFile *FilePrototype::callee() const
|
IFile *FilePrototype::callee() const
|
||||||
{
|
{
|
||||||
IFile *rc = qscriptvalue_cast<IFile *>(thisObject());
|
IFile *rc = qscriptvalue_cast<IFile *>(thisObject());
|
||||||
Q_ASSERT(rc);
|
QTC_ASSERT(rc, return 0);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,39 +311,66 @@ QString EditorManagerPrototype::toString() const
|
|||||||
EditorManagerPrototype::EditorManager *EditorManagerPrototype::callee() const
|
EditorManagerPrototype::EditorManager *EditorManagerPrototype::callee() const
|
||||||
{
|
{
|
||||||
EditorManager *rc = qscriptvalue_cast<EditorManager *>(thisObject());
|
EditorManager *rc = qscriptvalue_cast<EditorManager *>(thisObject());
|
||||||
Q_ASSERT(rc);
|
QTC_ASSERT(rc, return 0);
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------- EditorPrototype
|
// ------------- EditorPrototype
|
||||||
|
|
||||||
EditorPrototype::EditorPrototype(QObject *parent) :
|
EditorPrototype::EditorPrototype(QObject *parent)
|
||||||
QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString EditorPrototype::displayName() const { return callee()->displayName(); }
|
QString EditorPrototype::displayName() const
|
||||||
void EditorPrototype::setDisplayName(const QString &title) { callee()->setDisplayName(title); }
|
{
|
||||||
|
return callee()->displayName();
|
||||||
|
}
|
||||||
|
|
||||||
QString EditorPrototype::kind() const { return QLatin1String(callee()->kind()); }
|
void EditorPrototype::setDisplayName(const QString &title)
|
||||||
bool EditorPrototype::duplicateSupported() const { return callee()->duplicateSupported(); }
|
{
|
||||||
|
callee()->setDisplayName(title);
|
||||||
|
}
|
||||||
|
|
||||||
bool EditorPrototype::createNew(const QString &contents) { return callee()->createNew(contents); }
|
QString EditorPrototype::kind() const
|
||||||
bool EditorPrototype::open(const QString &fileName) { return callee()->open(fileName); }
|
{
|
||||||
|
return QLatin1String(callee()->kind());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EditorPrototype::duplicateSupported() const
|
||||||
|
{
|
||||||
|
return callee()->duplicateSupported();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EditorPrototype::createNew(const QString &contents)
|
||||||
|
{
|
||||||
|
return callee()->createNew(contents);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EditorPrototype::open(const QString &fileName)
|
||||||
|
{
|
||||||
|
return callee()->open(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
Core::IEditor *EditorPrototype::duplicate(QWidget *parent)
|
Core::IEditor *EditorPrototype::duplicate(QWidget *parent)
|
||||||
{
|
{
|
||||||
return callee()->duplicate(parent);
|
return callee()->duplicate(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IFile *EditorPrototype::file() const { return callee()->file(); }
|
Core::IFile *EditorPrototype::file() const
|
||||||
QToolBar* EditorPrototype::toolBar() const { return callee()->toolBar();}
|
{
|
||||||
|
return callee()->file();
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolBar* EditorPrototype::toolBar() const
|
||||||
|
{
|
||||||
|
return callee()->toolBar();
|
||||||
|
}
|
||||||
|
|
||||||
Core::IEditor *EditorPrototype::callee() const
|
Core::IEditor *EditorPrototype::callee() const
|
||||||
{
|
{
|
||||||
IEditor *rc = qscriptvalue_cast<IEditor *>(thisObject());
|
IEditor *rc = qscriptvalue_cast<IEditor *>(thisObject());
|
||||||
Q_ASSERT(rc);
|
QTC_ASSERT(rc, return 0);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,7 +443,7 @@ QString EditorGroupPrototype::toString() const
|
|||||||
Core::EditorGroup *EditorGroupPrototype::callee() const
|
Core::EditorGroup *EditorGroupPrototype::callee() const
|
||||||
{
|
{
|
||||||
EditorGroup *rc = qscriptvalue_cast<EditorGroup *>(thisObject());
|
EditorGroup *rc = qscriptvalue_cast<EditorGroup *>(thisObject());
|
||||||
Q_ASSERT(rc);
|
QTC_ASSERT(rc, return 0);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,8 +36,10 @@
|
|||||||
#include "metatypedeclarations.h"
|
#include "metatypedeclarations.h"
|
||||||
|
|
||||||
#include <extensionsystem/ExtensionSystemInterfaces>
|
#include <extensionsystem/ExtensionSystemInterfaces>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
#include <interface_wrap_helpers.h>
|
#include <interface_wrap_helpers.h>
|
||||||
#include <wrap_helpers.h>
|
#include <wrap_helpers.h>
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
@@ -154,7 +156,7 @@ static QScriptValue inputDialogGetItem(QScriptContext *context, QScriptEngine *e
|
|||||||
// Script function template to pop up a file box
|
// Script function template to pop up a file box
|
||||||
// with a certain icon and buttons.
|
// with a certain icon and buttons.
|
||||||
template <int TAcceptMode, int TFileMode>
|
template <int TAcceptMode, int TFileMode>
|
||||||
static QScriptValue fileBox(QScriptContext *context, QScriptEngine *engine)
|
static QScriptValue fileBox(QScriptContext *context, QScriptEngine *engine)
|
||||||
{
|
{
|
||||||
const int argumentCount = context->argumentCount();
|
const int argumentCount = context->argumentCount();
|
||||||
if (argumentCount < 2)
|
if (argumentCount < 2)
|
||||||
@@ -170,7 +172,7 @@ template <int TAcceptMode, int TFileMode>
|
|||||||
if (fileDialog.exec() == QDialog::Rejected)
|
if (fileDialog.exec() == QDialog::Rejected)
|
||||||
return QScriptValue(engine, QScriptValue::NullValue);
|
return QScriptValue(engine, QScriptValue::NullValue);
|
||||||
const QStringList rc = fileDialog.selectedFiles();
|
const QStringList rc = fileDialog.selectedFiles();
|
||||||
Q_ASSERT(!rc.empty());
|
QTC_ASSERT(!rc.empty(), /**/);
|
||||||
return TFileMode == QFileDialog::ExistingFiles ?
|
return TFileMode == QFileDialog::ExistingFiles ?
|
||||||
engine->toScriptValue(rc) : engine->toScriptValue(rc.front());
|
engine->toScriptValue(rc) : engine->toScriptValue(rc.front());
|
||||||
}
|
}
|
||||||
@@ -249,7 +251,7 @@ void ScriptManager::ensureEngineInitialized()
|
|||||||
{
|
{
|
||||||
if (m_initialized)
|
if (m_initialized)
|
||||||
return;
|
return;
|
||||||
Q_ASSERT(m_core);
|
QTC_ASSERT(m_core, return);
|
||||||
// register QObjects that occur as properties
|
// register QObjects that occur as properties
|
||||||
SharedTools::registerQObject<QMainWindow>(m_engine);
|
SharedTools::registerQObject<QMainWindow>(m_engine);
|
||||||
SharedTools::registerQObject<QStatusBar>(m_engine);
|
SharedTools::registerQObject<QStatusBar>(m_engine);
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ void Animation::paint(QPainter *painter, const QStyleOption *option)
|
|||||||
Q_UNUSED(painter);
|
Q_UNUSED(painter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) {
|
void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha)
|
||||||
|
{
|
||||||
if (_secondaryImage.isNull() || _primaryImage.isNull())
|
if (_secondaryImage.isNull() || _primaryImage.isNull())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -64,7 +65,7 @@ void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) {
|
|||||||
const int sw = _primaryImage.width();
|
const int sw = _primaryImage.width();
|
||||||
const int sh = _primaryImage.height();
|
const int sh = _primaryImage.height();
|
||||||
const int bpl = _primaryImage.bytesPerLine();
|
const int bpl = _primaryImage.bytesPerLine();
|
||||||
switch(_primaryImage.depth()) {
|
switch (_primaryImage.depth()) {
|
||||||
case 32:
|
case 32:
|
||||||
{
|
{
|
||||||
uchar *mixed_data = _tempImage.bits();
|
uchar *mixed_data = _tempImage.bits();
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void VCSManager::setVCSEnabled(const QString &directory)
|
|||||||
qDebug() << Q_FUNC_INFO << directory;
|
qDebug() << Q_FUNC_INFO << directory;
|
||||||
IVersionControl* managingVCS = findVersionControlForDirectory(directory);
|
IVersionControl* managingVCS = findVersionControlForDirectory(directory);
|
||||||
const VersionControlList versionControls = allVersionControls();
|
const VersionControlList versionControls = allVersionControls();
|
||||||
foreach(IVersionControl *versionControl, versionControls) {
|
foreach (IVersionControl *versionControl, versionControls) {
|
||||||
const bool newEnabled = versionControl == managingVCS;
|
const bool newEnabled = versionControl == managingVCS;
|
||||||
if (newEnabled != versionControl->isEnabled())
|
if (newEnabled != versionControl->isEnabled())
|
||||||
versionControl->setEnabled(newEnabled);
|
versionControl->setEnabled(newEnabled);
|
||||||
@@ -89,7 +89,7 @@ void VCSManager::setAllVCSEnabled()
|
|||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
const VersionControlList versionControls = allVersionControls();
|
const VersionControlList versionControls = allVersionControls();
|
||||||
foreach(IVersionControl *versionControl, versionControls)
|
foreach (IVersionControl *versionControl, versionControls)
|
||||||
if (!versionControl->isEnabled())
|
if (!versionControl->isEnabled())
|
||||||
versionControl->setEnabled(true);
|
versionControl->setEnabled(true);
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ IVersionControl* VCSManager::findVersionControlForDirectory(const QString &direc
|
|||||||
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
const QChar slash = QLatin1Char('/');
|
const QChar slash = QLatin1Char('/');
|
||||||
while(true) {
|
while (true) {
|
||||||
int index = directory.indexOf(slash, pos);
|
int index = directory.indexOf(slash, pos);
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
break;
|
break;
|
||||||
@@ -119,7 +119,7 @@ IVersionControl* VCSManager::findVersionControlForDirectory(const QString &direc
|
|||||||
|
|
||||||
// ah nothing so ask the IVersionControls directly
|
// ah nothing so ask the IVersionControls directly
|
||||||
const VersionControlList versionControls = allVersionControls();
|
const VersionControlList versionControls = allVersionControls();
|
||||||
foreach(IVersionControl * versionControl, versionControls) {
|
foreach (IVersionControl * versionControl, versionControls) {
|
||||||
if (versionControl->managesDirectory(directory)) {
|
if (versionControl->managesDirectory(directory)) {
|
||||||
m_d->m_cachedMatches.insert(versionControl->findTopLevelForDirectory(directory), versionControl);
|
m_d->m_cachedMatches.insert(versionControl->findTopLevelForDirectory(directory), versionControl);
|
||||||
return versionControl;
|
return versionControl;
|
||||||
|
|||||||
@@ -32,21 +32,25 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "versiondialog.h"
|
#include "versiondialog.h"
|
||||||
|
|
||||||
#include "coreconstants.h"
|
#include "coreconstants.h"
|
||||||
#include "coreimpl.h"
|
#include "coreimpl.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QtCore/QDate>
|
||||||
|
#include <QtCore/QFile>
|
||||||
|
|
||||||
|
#include <QtGui/QDialogButtonBox>
|
||||||
|
#include <QtGui/QGridLayout>
|
||||||
|
#include <QtGui/QLabel>
|
||||||
|
#include <QtGui/QPushButton>
|
||||||
|
#include <QtGui/QTextBrowser>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Core::Internal;
|
using namespace Core::Internal;
|
||||||
using namespace Core::Constants;
|
using namespace Core::Constants;
|
||||||
|
|
||||||
#include <QtCore/QDate>
|
|
||||||
#include <QtCore/QFile>
|
|
||||||
#include <QtGui/QGridLayout>
|
|
||||||
#include <QtGui/QLabel>
|
|
||||||
#include <QtGui/QPushButton>
|
|
||||||
#include <QtGui/QDialogButtonBox>
|
|
||||||
#include <QtGui/QTextBrowser>
|
|
||||||
|
|
||||||
VersionDialog::VersionDialog(QWidget *parent)
|
VersionDialog::VersionDialog(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
@@ -90,7 +94,7 @@ VersionDialog::VersionDialog(QWidget *parent)
|
|||||||
|
|
||||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
|
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||||
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
|
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
|
||||||
Q_ASSERT(closeButton);
|
QTC_ASSERT(closeButton, /**/);
|
||||||
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
|
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
|
||||||
connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
|
connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
|
||||||
|
|
||||||
@@ -118,7 +122,7 @@ void VersionDialog::popupLicense()
|
|||||||
|
|
||||||
// Read file into string
|
// Read file into string
|
||||||
ICore * core = CoreImpl::instance();
|
ICore * core = CoreImpl::instance();
|
||||||
Q_ASSERT(core != NULL);
|
QTC_ASSERT(core, return);
|
||||||
QString fileName = core->resourcePath() + "/license.txt";
|
QString fileName = core->resourcePath() + "/license.txt";
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
|
|
||||||
|
|||||||
@@ -36,12 +36,14 @@
|
|||||||
|
|
||||||
#include <utils/codegeneration.h>
|
#include <utils/codegeneration.h>
|
||||||
#include <utils/newclasswidget.h>
|
#include <utils/newclasswidget.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QTextStream>
|
|
||||||
#include <QtCore/QDir>
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtGui/QComboBox>
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QTextStream>
|
||||||
|
|
||||||
#include <QtGui/QCheckBox>
|
#include <QtGui/QCheckBox>
|
||||||
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
#include <QtGui/QWizard>
|
#include <QtGui/QWizard>
|
||||||
@@ -196,7 +198,7 @@ bool CppClassWizard::generateHeaderAndSource(const CppClassWizardParameters &par
|
|||||||
<< "\n#define " << guard << '\n' << '\n';
|
<< "\n#define " << guard << '\n' << '\n';
|
||||||
|
|
||||||
const QRegExp qtClassExpr(QLatin1String("^Q[A-Z3].+"));
|
const QRegExp qtClassExpr(QLatin1String("^Q[A-Z3].+"));
|
||||||
Q_ASSERT(qtClassExpr.isValid());
|
QTC_ASSERT(qtClassExpr.isValid(), /**/);
|
||||||
const bool superIsQtClass = qtClassExpr.exactMatch(params.baseClass);
|
const bool superIsQtClass = qtClassExpr.exactMatch(params.baseClass);
|
||||||
if (superIsQtClass) {
|
if (superIsQtClass) {
|
||||||
Core::Utils::writeIncludeFileDirective(params.baseClass, true, headerStr);
|
Core::Utils::writeIncludeFileDirective(params.baseClass, true, headerStr);
|
||||||
|
|||||||
@@ -520,6 +520,15 @@ void CPPEditor::jumpToDefinition()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
foreach (const Document::MacroUse use, doc->macroUses()) {
|
||||||
|
if (use.contains(endOfName - 1)) {
|
||||||
|
const Macro ¯o = use.macro();
|
||||||
|
const QString fileName = QString::fromUtf8(macro.fileName);
|
||||||
|
if (TextEditor::BaseTextEditor::openEditorAt(fileName, macro.line, 0))
|
||||||
|
return; // done
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
qDebug() << "No results for expression:" << expression;
|
qDebug() << "No results for expression:" << expression;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "cppcodecompletion.h"
|
#include "cppcodecompletion.h"
|
||||||
|
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
|
|
||||||
#include <Control.h>
|
#include <Control.h>
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
#include <SymbolVisitor.h>
|
#include <SymbolVisitor.h>
|
||||||
#include <Scope.h>
|
#include <Scope.h>
|
||||||
#include <TranslationUnit.h>
|
#include <TranslationUnit.h>
|
||||||
|
|
||||||
#include <cplusplus/ResolveExpression.h>
|
#include <cplusplus/ResolveExpression.h>
|
||||||
#include <cplusplus/LookupContext.h>
|
#include <cplusplus/LookupContext.h>
|
||||||
#include <cplusplus/Overview.h>
|
#include <cplusplus/Overview.h>
|
||||||
@@ -55,6 +57,7 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <texteditor/itexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
#include <texteditor/itexteditable.h>
|
#include <texteditor/itexteditable.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/basetexteditor.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
@@ -540,7 +543,7 @@ bool CppCodeCompletion::completeMember(FullySpecifiedType,
|
|||||||
const QList<TypeOfExpression::Result> &results,
|
const QList<TypeOfExpression::Result> &results,
|
||||||
const LookupContext &context)
|
const LookupContext &context)
|
||||||
{
|
{
|
||||||
Q_ASSERT(! results.isEmpty());
|
QTC_ASSERT(!results.isEmpty(), return false);
|
||||||
|
|
||||||
QList<Symbol *> classObjectCandidates;
|
QList<Symbol *> classObjectCandidates;
|
||||||
|
|
||||||
@@ -938,7 +941,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
|
|||||||
if (m_completionOperator == T_LPAREN) {
|
if (m_completionOperator == T_LPAREN) {
|
||||||
if (symbol) {
|
if (symbol) {
|
||||||
Function *function = symbol->type()->asFunction();
|
Function *function = symbol->type()->asFunction();
|
||||||
Q_ASSERT(function != 0);
|
QTC_ASSERT(function, return);
|
||||||
|
|
||||||
m_functionArgumentWidget = new FunctionArgumentWidget(m_core);
|
m_functionArgumentWidget = new FunctionArgumentWidget(m_core);
|
||||||
m_functionArgumentWidget->showFunctionHint(function);
|
m_functionArgumentWidget->showFunctionHint(function);
|
||||||
|
|||||||
50
src/plugins/cpptools/cppfunctionsfilter.cpp
Normal file
50
src/plugins/cpptools/cppfunctionsfilter.cpp
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** Non-Open Source Usage
|
||||||
|
**
|
||||||
|
** Licensees may use this file in accordance with the Qt Beta Version
|
||||||
|
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||||
|
** alternatively, in accordance with the terms contained in a written
|
||||||
|
** agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU General
|
||||||
|
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||||
|
** of this file. Please review the following information to ensure GNU
|
||||||
|
** General Public Licensing requirements will be met:
|
||||||
|
**
|
||||||
|
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||||
|
** http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||||
|
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "cppfunctionsfilter.h"
|
||||||
|
|
||||||
|
using namespace CppTools::Internal;
|
||||||
|
|
||||||
|
CppFunctionsFilter::CppFunctionsFilter(CppModelManager *manager, Core::EditorManager *editorManager)
|
||||||
|
: CppQuickOpenFilter(manager, editorManager)
|
||||||
|
{
|
||||||
|
setShortcutString("m");
|
||||||
|
setIncludedByDefault(false);
|
||||||
|
|
||||||
|
search.setSymbolsToSearchFor(SearchSymbols::Functions);
|
||||||
|
search.setSeparateScope(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
CppFunctionsFilter::~CppFunctionsFilter()
|
||||||
|
{
|
||||||
|
}
|
||||||
58
src/plugins/cpptools/cppfunctionsfilter.h
Normal file
58
src/plugins/cpptools/cppfunctionsfilter.h
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** Non-Open Source Usage
|
||||||
|
**
|
||||||
|
** Licensees may use this file in accordance with the Qt Beta Version
|
||||||
|
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||||
|
** alternatively, in accordance with the terms contained in a written
|
||||||
|
** agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU General
|
||||||
|
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||||
|
** of this file. Please review the following information to ensure GNU
|
||||||
|
** General Public Licensing requirements will be met:
|
||||||
|
**
|
||||||
|
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||||
|
** http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||||
|
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CPPFUNCTIONSFILTER_H
|
||||||
|
#define CPPFUNCTIONSFILTER_H
|
||||||
|
|
||||||
|
#include <cppquickopenfilter.h>
|
||||||
|
|
||||||
|
namespace CppTools {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class CppFunctionsFilter : public CppQuickOpenFilter
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CppFunctionsFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
||||||
|
~CppFunctionsFilter();
|
||||||
|
|
||||||
|
QString trName() const { return tr("Methods"); }
|
||||||
|
QString name() const { return QLatin1String("Methods"); }
|
||||||
|
Priority priority() const { return Medium; }
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
} // namespace CppTools
|
||||||
|
|
||||||
|
#endif // CPPFUNCTIONSFILTER_H
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
#include <texteditor/itexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
|
#include <texteditor/basetexteditor.h>
|
||||||
#include <debugger/debuggerconstants.h>
|
#include <debugger/debuggerconstants.h>
|
||||||
|
|
||||||
#include <CoreTypes.h>
|
#include <CoreTypes.h>
|
||||||
@@ -51,13 +52,13 @@
|
|||||||
#include <cplusplus/TypeOfExpression.h>
|
#include <cplusplus/TypeOfExpression.h>
|
||||||
|
|
||||||
#include <QtGui/QToolTip>
|
#include <QtGui/QToolTip>
|
||||||
#include <QtGui/QPlainTextEdit>
|
|
||||||
#include <QtGui/QTextCursor>
|
#include <QtGui/QTextCursor>
|
||||||
#include <QtGui/QTextBlock>
|
#include <QtGui/QTextBlock>
|
||||||
#include <QtHelp/QHelpEngineCore>
|
#include <QtHelp/QHelpEngineCore>
|
||||||
#include <QtCore/QtCore>
|
#include <QtCore/QtCore>
|
||||||
|
|
||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
CppHoverHandler::CppHoverHandler(CppModelManager *manager, QObject *parent)
|
CppHoverHandler::CppHoverHandler(CppModelManager *manager, QObject *parent)
|
||||||
: QObject(parent), m_manager(manager), m_helpEngineNeedsSetup(false)
|
: QObject(parent), m_manager(manager), m_helpEngineNeedsSetup(false)
|
||||||
@@ -104,11 +105,9 @@ void CppHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString buildHelpId(const CPlusPlus::FullySpecifiedType &type,
|
static QString buildHelpId(const FullySpecifiedType &type,
|
||||||
const CPlusPlus::Symbol *symbol)
|
const Symbol *symbol)
|
||||||
{
|
{
|
||||||
using namespace CPlusPlus;
|
|
||||||
|
|
||||||
Name *name = 0;
|
Name *name = 0;
|
||||||
Scope *scope = 0;
|
Scope *scope = 0;
|
||||||
|
|
||||||
@@ -156,12 +155,10 @@ static QString buildHelpId(const CPlusPlus::FullySpecifiedType &type,
|
|||||||
|
|
||||||
void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos)
|
void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos)
|
||||||
{
|
{
|
||||||
using namespace CPlusPlus;
|
|
||||||
|
|
||||||
m_helpId.clear();
|
m_helpId.clear();
|
||||||
m_toolTip.clear();
|
m_toolTip.clear();
|
||||||
|
|
||||||
QPlainTextEdit *edit = qobject_cast<QPlainTextEdit *>(editor->widget());
|
TextEditor::BaseTextEditor *edit = qobject_cast<TextEditor::BaseTextEditor *>(editor->widget());
|
||||||
if (!edit)
|
if (!edit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -169,8 +166,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
|||||||
tc.setPosition(pos);
|
tc.setPosition(pos);
|
||||||
|
|
||||||
const int lineNumber = tc.block().blockNumber() + 1;
|
const int lineNumber = tc.block().blockNumber() + 1;
|
||||||
|
const QString fileName = editor->file()->fileName();
|
||||||
QString fileName = editor->file()->fileName();
|
|
||||||
Document::Ptr doc = m_manager->document(fileName);
|
Document::Ptr doc = m_manager->document(fileName);
|
||||||
if (doc) {
|
if (doc) {
|
||||||
foreach (Document::DiagnosticMessage m, doc->diagnosticMessages()) {
|
foreach (Document::DiagnosticMessage m, doc->diagnosticMessages()) {
|
||||||
@@ -235,6 +231,16 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doc && m_toolTip.isEmpty()) {
|
||||||
|
foreach (const Document::MacroUse &use, doc->macroUses()) {
|
||||||
|
if (use.contains(pos)) {
|
||||||
|
m_toolTip = use.macro().toString();
|
||||||
|
m_helpId = use.macro().name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_helpEngineNeedsSetup
|
if (m_helpEngineNeedsSetup
|
||||||
&& m_helpEngine->registeredDocumentations().count() > 0) {
|
&& m_helpEngine->registeredDocumentations().count() > 0) {
|
||||||
m_helpEngine->setupData();
|
m_helpEngine->setupData();
|
||||||
@@ -243,7 +249,8 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
|||||||
|
|
||||||
if (!m_helpId.isEmpty() && !m_helpEngine->linksForIdentifier(m_helpId).isEmpty()) {
|
if (!m_helpId.isEmpty() && !m_helpEngine->linksForIdentifier(m_helpId).isEmpty()) {
|
||||||
m_toolTip = QString(QLatin1String("<table><tr><td valign=middle><nobr>%1</td>"
|
m_toolTip = QString(QLatin1String("<table><tr><td valign=middle><nobr>%1</td>"
|
||||||
"<td><img src=\":/cpptools/images/f1.svg\"></td></tr></table>")).arg(Qt::escape(m_toolTip));
|
"<td><img src=\":/cpptools/images/f1.svg\"></td></tr></table>"))
|
||||||
|
.arg(Qt::escape(m_toolTip));
|
||||||
editor->setContextHelpId(m_helpId);
|
editor->setContextHelpId(m_helpId);
|
||||||
} else if (!m_toolTip.isEmpty()) {
|
} else if (!m_toolTip.isEmpty()) {
|
||||||
m_toolTip = QString(QLatin1String("<nobr>%1")).arg(Qt::escape(m_toolTip));
|
m_toolTip = QString(QLatin1String("<nobr>%1")).arg(Qt::escape(m_toolTip));
|
||||||
|
|||||||
@@ -52,6 +52,8 @@
|
|||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/progressmanager/progressmanager.h>
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <TranslationUnit.h>
|
#include <TranslationUnit.h>
|
||||||
#include <Semantic.h>
|
#include <Semantic.h>
|
||||||
#include <AST.h>
|
#include <AST.h>
|
||||||
@@ -64,10 +66,11 @@
|
|||||||
#include <Lexer.h>
|
#include <Lexer.h>
|
||||||
#include <Token.h>
|
#include <Token.h>
|
||||||
|
|
||||||
#include <QPlainTextEdit>
|
#include <QtCore/QDebug>
|
||||||
#include <QMutexLocker>
|
#include <QtCore/QMutexLocker>
|
||||||
#include <QTime>
|
#include <QtCore/QTime>
|
||||||
#include <QDebug>
|
|
||||||
|
//#include <QtGui/QPlainTextEdit>
|
||||||
|
|
||||||
using namespace CppTools;
|
using namespace CppTools;
|
||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
@@ -299,14 +302,14 @@ void CppPreprocessor::macroAdded(const Macro ¯o)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CppPreprocessor::startExpandingMacro(unsigned offset,
|
void CppPreprocessor::startExpandingMacro(unsigned offset,
|
||||||
const Macro &,
|
const Macro ¯o,
|
||||||
const QByteArray &originalText)
|
const QByteArray &originalText)
|
||||||
{
|
{
|
||||||
if (! m_currentDoc)
|
if (! m_currentDoc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//qDebug() << "start expanding:" << macro.name << "text:" << originalText;
|
//qDebug() << "start expanding:" << macro.name << "text:" << originalText;
|
||||||
m_currentDoc->addMacroUse(offset, originalText.length());
|
m_currentDoc->addMacroUse(macro, offset, originalText.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppPreprocessor::stopExpandingMacro(unsigned, const Macro &)
|
void CppPreprocessor::stopExpandingMacro(unsigned, const Macro &)
|
||||||
@@ -387,17 +390,17 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type)
|
|||||||
} else {
|
} else {
|
||||||
Document::Ptr previousDoc = switchDocument(Document::create(fileName));
|
Document::Ptr previousDoc = switchDocument(Document::create(fileName));
|
||||||
|
|
||||||
const QByteArray previousFile = env.current_file;
|
const QByteArray previousFile = env.currentFile;
|
||||||
const unsigned previousLine = env.currentLine;
|
const unsigned previousLine = env.currentLine;
|
||||||
|
|
||||||
env.current_file = QByteArray(m_currentDoc->translationUnit()->fileName(),
|
env.currentFile = QByteArray(m_currentDoc->translationUnit()->fileName(),
|
||||||
m_currentDoc->translationUnit()->fileNameLength());
|
m_currentDoc->translationUnit()->fileNameLength());
|
||||||
|
|
||||||
QByteArray preprocessedCode;
|
QByteArray preprocessedCode;
|
||||||
m_proc(contents, &preprocessedCode);
|
m_proc(contents, &preprocessedCode);
|
||||||
//qDebug() << preprocessedCode;
|
//qDebug() << preprocessedCode;
|
||||||
|
|
||||||
env.current_file = previousFile;
|
env.currentFile = previousFile;
|
||||||
env.currentLine = previousLine;
|
env.currentLine = previousLine;
|
||||||
|
|
||||||
m_currentDoc->setSource(preprocessedCode);
|
m_currentDoc->setSource(preprocessedCode);
|
||||||
@@ -439,10 +442,10 @@ CppModelManager::CppModelManager(QObject *parent) :
|
|||||||
m_projectExplorer = ExtensionSystem::PluginManager::instance()
|
m_projectExplorer = ExtensionSystem::PluginManager::instance()
|
||||||
->getObject<ProjectExplorer::ProjectExplorerPlugin>();
|
->getObject<ProjectExplorer::ProjectExplorerPlugin>();
|
||||||
|
|
||||||
Q_ASSERT(m_projectExplorer);
|
QTC_ASSERT(m_projectExplorer, return);
|
||||||
|
|
||||||
ProjectExplorer::SessionManager *session = m_projectExplorer->session();
|
ProjectExplorer::SessionManager *session = m_projectExplorer->session();
|
||||||
Q_ASSERT(session != 0);
|
QTC_ASSERT(session, return);
|
||||||
|
|
||||||
connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
||||||
this, SLOT(onProjectAdded(ProjectExplorer::Project*)));
|
this, SLOT(onProjectAdded(ProjectExplorer::Project*)));
|
||||||
@@ -626,7 +629,7 @@ void CppModelManager::editorOpened(Core::IEditor *editor)
|
|||||||
{
|
{
|
||||||
if (isCppEditor(editor)) {
|
if (isCppEditor(editor)) {
|
||||||
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
|
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
|
||||||
Q_ASSERT(textEditor != 0);
|
QTC_ASSERT(textEditor, return);
|
||||||
|
|
||||||
CppEditorSupport *editorSupport = new CppEditorSupport(this);
|
CppEditorSupport *editorSupport = new CppEditorSupport(this);
|
||||||
editorSupport->setTextEditor(textEditor);
|
editorSupport->setTextEditor(textEditor);
|
||||||
@@ -646,7 +649,7 @@ void CppModelManager::editorAboutToClose(Core::IEditor *editor)
|
|||||||
{
|
{
|
||||||
if (isCppEditor(editor)) {
|
if (isCppEditor(editor)) {
|
||||||
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
|
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
|
||||||
Q_ASSERT(textEditor != 0);
|
QTC_ASSERT(textEditor, return);
|
||||||
|
|
||||||
CppEditorSupport *editorSupport = m_editorSupport.value(textEditor);
|
CppEditorSupport *editorSupport = m_editorSupport.value(textEditor);
|
||||||
m_editorSupport.remove(textEditor);
|
m_editorSupport.remove(textEditor);
|
||||||
@@ -785,7 +788,7 @@ void CppModelManager::parse(QFutureInterface<void> &future,
|
|||||||
CppPreprocessor *preproc,
|
CppPreprocessor *preproc,
|
||||||
QStringList files)
|
QStringList files)
|
||||||
{
|
{
|
||||||
Q_ASSERT(! files.isEmpty());
|
QTC_ASSERT(!files.isEmpty(), return);
|
||||||
|
|
||||||
// Change the priority of the background parser thread to idle.
|
// Change the priority of the background parser thread to idle.
|
||||||
QThread::currentThread()->setPriority(QThread::IdlePriority);
|
QThread::currentThread()->setPriority(QThread::IdlePriority);
|
||||||
|
|||||||
@@ -75,6 +75,12 @@ void CppQuickOpenFilter::refresh(QFutureInterface<void> &future)
|
|||||||
Q_UNUSED(future);
|
Q_UNUSED(future);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool compareLexigraphically(const QuickOpen::FilterEntry &a,
|
||||||
|
const QuickOpen::FilterEntry &b)
|
||||||
|
{
|
||||||
|
return a.displayName < b.displayName;
|
||||||
|
}
|
||||||
|
|
||||||
QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &origEntry)
|
QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &origEntry)
|
||||||
{
|
{
|
||||||
QString entry = trimWildcards(origEntry);
|
QString entry = trimWildcards(origEntry);
|
||||||
@@ -109,6 +115,9 @@ QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &orig
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (entries.size() < 1000)
|
||||||
|
qSort(entries.begin(), entries.end(), compareLexigraphically);
|
||||||
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "cpptools.h"
|
#include "cpptools.h"
|
||||||
#include "cppclassesfilter.h"
|
#include "cppclassesfilter.h"
|
||||||
#include "cppcodecompletion.h"
|
#include "cppcodecompletion.h"
|
||||||
|
#include "cppfunctionsfilter.h"
|
||||||
#include "cpphoverhandler.h"
|
#include "cpphoverhandler.h"
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
#include "cpptoolsconstants.h"
|
#include "cpptoolsconstants.h"
|
||||||
@@ -89,6 +90,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *)
|
|||||||
m_core->editorManager());
|
m_core->editorManager());
|
||||||
addAutoReleasedObject(quickOpenFilter);
|
addAutoReleasedObject(quickOpenFilter);
|
||||||
addAutoReleasedObject(new CppClassesFilter(m_modelManager, m_core->editorManager()));
|
addAutoReleasedObject(new CppClassesFilter(m_modelManager, m_core->editorManager()));
|
||||||
|
addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, m_core->editorManager()));
|
||||||
|
|
||||||
// Menus
|
// Menus
|
||||||
Core::IActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS);
|
Core::IActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS);
|
||||||
|
|||||||
@@ -10,15 +10,16 @@ unix:QMAKE_CXXFLAGS_DEBUG += -O3
|
|||||||
INCLUDEPATH += .
|
INCLUDEPATH += .
|
||||||
DEFINES += CPPTOOLS_LIBRARY
|
DEFINES += CPPTOOLS_LIBRARY
|
||||||
CONFIG += help
|
CONFIG += help
|
||||||
|
|
||||||
HEADERS += cpptools_global.h \
|
HEADERS += cpptools_global.h \
|
||||||
cppquickopenfilter.h \
|
cppquickopenfilter.h \
|
||||||
cppclassesfilter.h \
|
cppclassesfilter.h \
|
||||||
searchsymbols.h
|
searchsymbols.h \
|
||||||
|
cppfunctionsfilter.h
|
||||||
SOURCES += cppquickopenfilter.cpp \
|
SOURCES += cppquickopenfilter.cpp \
|
||||||
cpptoolseditorsupport.cpp \
|
cpptoolseditorsupport.cpp \
|
||||||
cppclassesfilter.cpp \
|
cppclassesfilter.cpp \
|
||||||
searchsymbols.cpp
|
searchsymbols.cpp \
|
||||||
|
cppfunctionsfilter.cpp
|
||||||
|
|
||||||
# Input
|
# Input
|
||||||
SOURCES += cpptools.cpp \
|
SOURCES += cpptools.cpp \
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <Literals.h>
|
#include <Literals.h>
|
||||||
#include <Scope.h>
|
#include <Scope.h>
|
||||||
|
#include <Names.h>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
@@ -97,12 +98,24 @@ bool SearchSymbols::visit(Function *symbol)
|
|||||||
if (!(symbolsToSearchFor & Functions))
|
if (!(symbolsToSearchFor & Functions))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
QString extraScope;
|
||||||
|
if (Name *name = symbol->name()) {
|
||||||
|
if (QualifiedNameId *nameId = name->asQualifiedNameId()) {
|
||||||
|
if (nameId->nameCount() > 1) {
|
||||||
|
extraScope = overview.prettyName(nameId->nameAt(nameId->nameCount() - 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QString fullScope = _scope;
|
||||||
|
if (!_scope.isEmpty() && !extraScope.isEmpty())
|
||||||
|
fullScope += QLatin1String("::");
|
||||||
|
fullScope += extraScope;
|
||||||
QString name = symbolName(symbol);
|
QString name = symbolName(symbol);
|
||||||
QString scopedName = scopedSymbolName(name);
|
QString scopedName = scopedSymbolName(name);
|
||||||
QString type = overview.prettyType(symbol->type(),
|
QString type = overview.prettyType(symbol->type(),
|
||||||
separateScope ? symbol->name() : 0);
|
separateScope ? symbol->identity() : 0);
|
||||||
appendItem(separateScope ? type : scopedName,
|
appendItem(separateScope ? type : scopedName,
|
||||||
separateScope ? _scope : type,
|
separateScope ? fullScope : type,
|
||||||
ModelItemInfo::Method, symbol);
|
ModelItemInfo::Method, symbol);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -153,7 +166,7 @@ bool SearchSymbols::visit(Class *symbol)
|
|||||||
QString SearchSymbols::scopedSymbolName(const QString &symbolName) const
|
QString SearchSymbols::scopedSymbolName(const QString &symbolName) const
|
||||||
{
|
{
|
||||||
QString name = _scope;
|
QString name = _scope;
|
||||||
if (! name.isEmpty())
|
if (!name.isEmpty())
|
||||||
name += QLatin1String("::");
|
name += QLatin1String("::");
|
||||||
name += symbolName;
|
name += symbolName;
|
||||||
return name;
|
return name;
|
||||||
@@ -196,6 +209,9 @@ void SearchSymbols::appendItem(const QString &name,
|
|||||||
ModelItemInfo::ItemType type,
|
ModelItemInfo::ItemType type,
|
||||||
const Symbol *symbol)
|
const Symbol *symbol)
|
||||||
{
|
{
|
||||||
|
if (!symbol->name())
|
||||||
|
return;
|
||||||
|
|
||||||
const QIcon icon = icons.iconForSymbol(symbol);
|
const QIcon icon = icons.iconForSymbol(symbol);
|
||||||
items.append(ModelItemInfo(name, info, type,
|
items.append(ModelItemInfo(name, info, type,
|
||||||
QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()),
|
QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()),
|
||||||
|
|||||||
@@ -152,13 +152,12 @@ void AttachExternalDialog::rebuildProcessList()
|
|||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
#ifdef Q_OS_WINDOWS
|
||||||
|
|
||||||
// Forward declarations:
|
BOOL GetProcessList();
|
||||||
BOOL GetProcessList( );
|
BOOL ListProcessModules(DWORD dwPID);
|
||||||
BOOL ListProcessModules( DWORD dwPID );
|
BOOL ListProcessThreads(DWORD dwOwnerPID);
|
||||||
BOOL ListProcessThreads( DWORD dwOwnerPID );
|
void printError(TCHAR *msg);
|
||||||
void printError( TCHAR* msg );
|
|
||||||
|
|
||||||
BOOL GetProcessList( )
|
BOOL GetProcessList()
|
||||||
{
|
{
|
||||||
HANDLE hProcessSnap;
|
HANDLE hProcessSnap;
|
||||||
HANDLE hProcess;
|
HANDLE hProcess;
|
||||||
@@ -167,7 +166,7 @@ BOOL GetProcessList( )
|
|||||||
|
|
||||||
// Take a snapshot of all processes in the system.
|
// Take a snapshot of all processes in the system.
|
||||||
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
|
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
|
||||||
if( hProcessSnap == INVALID_HANDLE_VALUE )
|
if (hProcessSnap == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
printError( TEXT("CreateToolhelp32Snapshot (of processes)") );
|
printError( TEXT("CreateToolhelp32Snapshot (of processes)") );
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
@@ -178,7 +177,7 @@ BOOL GetProcessList( )
|
|||||||
|
|
||||||
// Retrieve information about the first process,
|
// Retrieve information about the first process,
|
||||||
// and exit if unsuccessful
|
// and exit if unsuccessful
|
||||||
if( !Process32First( hProcessSnap, &pe32 ) )
|
if (!Process32First( hProcessSnap, &pe32 ))
|
||||||
{
|
{
|
||||||
printError( TEXT("Process32First") ); // show cause of failure
|
printError( TEXT("Process32First") ); // show cause of failure
|
||||||
CloseHandle( hProcessSnap ); // clean the snapshot object
|
CloseHandle( hProcessSnap ); // clean the snapshot object
|
||||||
@@ -196,12 +195,12 @@ BOOL GetProcessList( )
|
|||||||
// Retrieve the priority class.
|
// Retrieve the priority class.
|
||||||
dwPriorityClass = 0;
|
dwPriorityClass = 0;
|
||||||
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID );
|
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID );
|
||||||
if( hProcess == NULL )
|
if (hProcess == NULL)
|
||||||
printError( TEXT("OpenProcess") );
|
printError( TEXT("OpenProcess") );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dwPriorityClass = GetPriorityClass( hProcess );
|
dwPriorityClass = GetPriorityClass( hProcess );
|
||||||
if( !dwPriorityClass )
|
if (!dwPriorityClass)
|
||||||
printError( TEXT("GetPriorityClass") );
|
printError( TEXT("GetPriorityClass") );
|
||||||
CloseHandle( hProcess );
|
CloseHandle( hProcess );
|
||||||
}
|
}
|
||||||
@@ -210,31 +209,30 @@ BOOL GetProcessList( )
|
|||||||
printf( "\n Thread count = %d", pe32.cntThreads );
|
printf( "\n Thread count = %d", pe32.cntThreads );
|
||||||
printf( "\n Parent process ID = 0x%08X", pe32.th32ParentProcessID );
|
printf( "\n Parent process ID = 0x%08X", pe32.th32ParentProcessID );
|
||||||
printf( "\n Priority base = %d", pe32.pcPriClassBase );
|
printf( "\n Priority base = %d", pe32.pcPriClassBase );
|
||||||
if( dwPriorityClass )
|
if (dwPriorityClass)
|
||||||
printf( "\n Priority class = %d", dwPriorityClass );
|
printf( "\n Priority class = %d", dwPriorityClass );
|
||||||
|
|
||||||
// List the modules and threads associated with this process
|
// List the modules and threads associated with this process
|
||||||
ListProcessModules( pe32.th32ProcessID );
|
ListProcessModules( pe32.th32ProcessID );
|
||||||
ListProcessThreads( pe32.th32ProcessID );
|
ListProcessThreads( pe32.th32ProcessID );
|
||||||
|
|
||||||
} while( Process32Next( hProcessSnap, &pe32 ) );
|
} while (Process32Next(hProcessSnap, &pe32));
|
||||||
|
|
||||||
CloseHandle( hProcessSnap );
|
CloseHandle(hProcessSnap);
|
||||||
return( TRUE );
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL ListProcessModules( DWORD dwPID )
|
BOOL ListProcessModules(DWORD dwPID)
|
||||||
{
|
{
|
||||||
HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
|
HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
|
||||||
MODULEENTRY32 me32;
|
MODULEENTRY32 me32;
|
||||||
|
|
||||||
// Take a snapshot of all modules in the specified process.
|
// Take a snapshot of all modules in the specified process.
|
||||||
hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
|
hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
|
||||||
if( hModuleSnap == INVALID_HANDLE_VALUE )
|
if (hModuleSnap == INVALID_HANDLE_VALUE) {
|
||||||
{
|
printError(TEXT("CreateToolhelp32Snapshot (of modules)"));
|
||||||
printError( TEXT("CreateToolhelp32Snapshot (of modules)") );
|
return FALSE;
|
||||||
return( FALSE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the size of the structure before using it.
|
// Set the size of the structure before using it.
|
||||||
@@ -242,7 +240,7 @@ BOOL ListProcessModules( DWORD dwPID )
|
|||||||
|
|
||||||
// Retrieve information about the first module,
|
// Retrieve information about the first module,
|
||||||
// and exit if unsuccessful
|
// and exit if unsuccessful
|
||||||
if( !Module32First( hModuleSnap, &me32 ) )
|
if (!Module32First( hModuleSnap, &me32))
|
||||||
{
|
{
|
||||||
printError( TEXT("Module32First") ); // show cause of failure
|
printError( TEXT("Module32First") ); // show cause of failure
|
||||||
CloseHandle( hModuleSnap ); // clean the snapshot object
|
CloseHandle( hModuleSnap ); // clean the snapshot object
|
||||||
@@ -261,10 +259,10 @@ BOOL ListProcessModules( DWORD dwPID )
|
|||||||
printf( "\n Base address = 0x%08X", (DWORD) me32.modBaseAddr );
|
printf( "\n Base address = 0x%08X", (DWORD) me32.modBaseAddr );
|
||||||
printf( "\n Base size = %d", me32.modBaseSize );
|
printf( "\n Base size = %d", me32.modBaseSize );
|
||||||
|
|
||||||
} while( Module32Next( hModuleSnap, &me32 ) );
|
} while (Module32Next(hModuleSnap, &me32));
|
||||||
|
|
||||||
CloseHandle( hModuleSnap );
|
CloseHandle(hModuleSnap);
|
||||||
return( TRUE );
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ListProcessThreads( DWORD dwOwnerPID )
|
BOOL ListProcessThreads( DWORD dwOwnerPID )
|
||||||
@@ -274,7 +272,7 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
|||||||
|
|
||||||
// Take a snapshot of all running threads
|
// Take a snapshot of all running threads
|
||||||
hThreadSnap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 );
|
hThreadSnap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 );
|
||||||
if( hThreadSnap == INVALID_HANDLE_VALUE )
|
if (hThreadSnap == INVALID_HANDLE_VALUE)
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
|
|
||||||
// Fill in the size of the structure before using it.
|
// Fill in the size of the structure before using it.
|
||||||
@@ -282,7 +280,7 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
|||||||
|
|
||||||
// Retrieve information about the first thread,
|
// Retrieve information about the first thread,
|
||||||
// and exit if unsuccessful
|
// and exit if unsuccessful
|
||||||
if( !Thread32First( hThreadSnap, &te32 ) )
|
if (!Thread32First( hThreadSnap, &te32 ))
|
||||||
{
|
{
|
||||||
printError( TEXT("Thread32First") ); // show cause of failure
|
printError( TEXT("Thread32First") ); // show cause of failure
|
||||||
CloseHandle( hThreadSnap ); // clean the snapshot object
|
CloseHandle( hThreadSnap ); // clean the snapshot object
|
||||||
@@ -294,13 +292,13 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
|||||||
// associated with the specified process
|
// associated with the specified process
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if( te32.th32OwnerProcessID == dwOwnerPID )
|
if (te32.th32OwnerProcessID == dwOwnerPID)
|
||||||
{
|
{
|
||||||
printf( "\n\n THREAD ID = 0x%08X", te32.th32ThreadID );
|
printf( "\n\n THREAD ID = 0x%08X", te32.th32ThreadID );
|
||||||
printf( "\n Base priority = %d", te32.tpBasePri );
|
printf( "\n Base priority = %d", te32.tpBasePri );
|
||||||
printf( "\n Delta priority = %d", te32.tpDeltaPri );
|
printf( "\n Delta priority = %d", te32.tpDeltaPri );
|
||||||
}
|
}
|
||||||
} while( Thread32Next(hThreadSnap, &te32 ) );
|
} while (Thread32Next(hThreadSnap, &te32));
|
||||||
|
|
||||||
CloseHandle( hThreadSnap );
|
CloseHandle( hThreadSnap );
|
||||||
return( TRUE );
|
return( TRUE );
|
||||||
@@ -320,10 +318,12 @@ void printError( TCHAR* msg )
|
|||||||
|
|
||||||
// Trim the end of the line and terminate it with a null
|
// Trim the end of the line and terminate it with a null
|
||||||
p = sysMsg;
|
p = sysMsg;
|
||||||
while( ( *p > 31 ) || ( *p == 9 ) )
|
while (*p > 31 || *p == 9 )
|
||||||
++p;
|
++p;
|
||||||
do { *p-- = 0; } while( ( p >= sysMsg ) &&
|
|
||||||
( ( *p == '.' ) || ( *p < 33 ) ) );
|
do {
|
||||||
|
*p-- = 0;
|
||||||
|
} while( p >= sysMsg && (*p == '.' || *p < 33));
|
||||||
|
|
||||||
// Display the message
|
// Display the message
|
||||||
_tprintf( TEXT("\n WARNING: %s failed with error %d (%s)"), msg, eNum, sysMsg );
|
_tprintf( TEXT("\n WARNING: %s failed with error %d (%s)"), msg, eNum, sysMsg );
|
||||||
@@ -331,7 +331,6 @@ void printError( TCHAR* msg )
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void AttachExternalDialog::procSelected(const QModelIndex &index0)
|
void AttachExternalDialog::procSelected(const QModelIndex &index0)
|
||||||
{
|
{
|
||||||
QModelIndex index = index0.sibling(index0.row(), 0);
|
QModelIndex index = index0.sibling(index0.row(), 0);
|
||||||
|
|||||||
@@ -150,10 +150,10 @@ void AttachRemoteDialog::rebuildProcessList()
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
// Forward declarations:
|
// Forward declarations:
|
||||||
BOOL GetProcessList( );
|
BOOL GetProcessList();
|
||||||
BOOL ListProcessModules( DWORD dwPID );
|
BOOL ListProcessModules(DWORD dwPID);
|
||||||
BOOL ListProcessThreads( DWORD dwOwnerPID );
|
BOOL ListProcessThreads(DWORD dwOwnerPID);
|
||||||
void printError( TCHAR* msg );
|
void printError(TCHAR* msg);
|
||||||
|
|
||||||
BOOL GetProcessList( )
|
BOOL GetProcessList( )
|
||||||
{
|
{
|
||||||
@@ -164,7 +164,7 @@ BOOL GetProcessList( )
|
|||||||
|
|
||||||
// Take a snapshot of all processes in the system.
|
// Take a snapshot of all processes in the system.
|
||||||
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
|
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
|
||||||
if( hProcessSnap == INVALID_HANDLE_VALUE )
|
if (hProcessSnap == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
printError( TEXT("CreateToolhelp32Snapshot (of processes)") );
|
printError( TEXT("CreateToolhelp32Snapshot (of processes)") );
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
@@ -175,7 +175,7 @@ BOOL GetProcessList( )
|
|||||||
|
|
||||||
// Retrieve information about the first process,
|
// Retrieve information about the first process,
|
||||||
// and exit if unsuccessful
|
// and exit if unsuccessful
|
||||||
if( !Process32First( hProcessSnap, &pe32 ) )
|
if (!Process32First( hProcessSnap, &pe32 ))
|
||||||
{
|
{
|
||||||
printError( TEXT("Process32First") ); // show cause of failure
|
printError( TEXT("Process32First") ); // show cause of failure
|
||||||
CloseHandle( hProcessSnap ); // clean the snapshot object
|
CloseHandle( hProcessSnap ); // clean the snapshot object
|
||||||
@@ -193,12 +193,12 @@ BOOL GetProcessList( )
|
|||||||
// Retrieve the priority class.
|
// Retrieve the priority class.
|
||||||
dwPriorityClass = 0;
|
dwPriorityClass = 0;
|
||||||
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID );
|
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID );
|
||||||
if( hProcess == NULL )
|
if (hProcess == NULL)
|
||||||
printError( TEXT("OpenProcess") );
|
printError( TEXT("OpenProcess") );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dwPriorityClass = GetPriorityClass( hProcess );
|
dwPriorityClass = GetPriorityClass( hProcess );
|
||||||
if( !dwPriorityClass )
|
if (!dwPriorityClass)
|
||||||
printError( TEXT("GetPriorityClass") );
|
printError( TEXT("GetPriorityClass") );
|
||||||
CloseHandle( hProcess );
|
CloseHandle( hProcess );
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ BOOL GetProcessList( )
|
|||||||
printf( "\n Thread count = %d", pe32.cntThreads );
|
printf( "\n Thread count = %d", pe32.cntThreads );
|
||||||
printf( "\n Parent process ID = 0x%08X", pe32.th32ParentProcessID );
|
printf( "\n Parent process ID = 0x%08X", pe32.th32ParentProcessID );
|
||||||
printf( "\n Priority base = %d", pe32.pcPriClassBase );
|
printf( "\n Priority base = %d", pe32.pcPriClassBase );
|
||||||
if( dwPriorityClass )
|
if (dwPriorityClass)
|
||||||
printf( "\n Priority class = %d", dwPriorityClass );
|
printf( "\n Priority class = %d", dwPriorityClass );
|
||||||
|
|
||||||
// List the modules and threads associated with this process
|
// List the modules and threads associated with this process
|
||||||
@@ -228,7 +228,7 @@ BOOL ListProcessModules( DWORD dwPID )
|
|||||||
|
|
||||||
// Take a snapshot of all modules in the specified process.
|
// Take a snapshot of all modules in the specified process.
|
||||||
hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
|
hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
|
||||||
if( hModuleSnap == INVALID_HANDLE_VALUE )
|
if (hModuleSnap == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
printError( TEXT("CreateToolhelp32Snapshot (of modules)") );
|
printError( TEXT("CreateToolhelp32Snapshot (of modules)") );
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
@@ -239,7 +239,7 @@ BOOL ListProcessModules( DWORD dwPID )
|
|||||||
|
|
||||||
// Retrieve information about the first module,
|
// Retrieve information about the first module,
|
||||||
// and exit if unsuccessful
|
// and exit if unsuccessful
|
||||||
if( !Module32First( hModuleSnap, &me32 ) )
|
if (!Module32First( hModuleSnap, &me32 ))
|
||||||
{
|
{
|
||||||
printError( TEXT("Module32First") ); // show cause of failure
|
printError( TEXT("Module32First") ); // show cause of failure
|
||||||
CloseHandle( hModuleSnap ); // clean the snapshot object
|
CloseHandle( hModuleSnap ); // clean the snapshot object
|
||||||
@@ -271,7 +271,7 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
|||||||
|
|
||||||
// Take a snapshot of all running threads
|
// Take a snapshot of all running threads
|
||||||
hThreadSnap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 );
|
hThreadSnap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 );
|
||||||
if( hThreadSnap == INVALID_HANDLE_VALUE )
|
if (hThreadSnap == INVALID_HANDLE_VALUE)
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
|
|
||||||
// Fill in the size of the structure before using it.
|
// Fill in the size of the structure before using it.
|
||||||
@@ -279,7 +279,7 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
|||||||
|
|
||||||
// Retrieve information about the first thread,
|
// Retrieve information about the first thread,
|
||||||
// and exit if unsuccessful
|
// and exit if unsuccessful
|
||||||
if( !Thread32First( hThreadSnap, &te32 ) )
|
if (!Thread32First( hThreadSnap, &te32 ))
|
||||||
{
|
{
|
||||||
printError( TEXT("Thread32First") ); // show cause of failure
|
printError( TEXT("Thread32First") ); // show cause of failure
|
||||||
CloseHandle( hThreadSnap ); // clean the snapshot object
|
CloseHandle( hThreadSnap ); // clean the snapshot object
|
||||||
@@ -291,7 +291,7 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
|||||||
// associated with the specified process
|
// associated with the specified process
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if( te32.th32OwnerProcessID == dwOwnerPID )
|
if (te32.th32OwnerProcessID == dwOwnerPID)
|
||||||
{
|
{
|
||||||
printf( "\n\n THREAD ID = 0x%08X", te32.th32ThreadID );
|
printf( "\n\n THREAD ID = 0x%08X", te32.th32ThreadID );
|
||||||
printf( "\n Base priority = %d", te32.tpBasePri );
|
printf( "\n Base priority = %d", te32.tpBasePri );
|
||||||
|
|||||||
@@ -33,9 +33,10 @@
|
|||||||
|
|
||||||
#include "breakhandler.h"
|
#include "breakhandler.h"
|
||||||
|
|
||||||
#include "assert.h"
|
|
||||||
#include "imports.h" // TextEditor::BaseTextMark
|
#include "imports.h" // TextEditor::BaseTextMark
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
@@ -371,7 +372,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
|
|||||||
static const QIcon icon2(":/gdbdebugger/images/breakpoint_pending.svg");
|
static const QIcon icon2(":/gdbdebugger/images/breakpoint_pending.svg");
|
||||||
static const QString empty = QString(QLatin1Char('-'));
|
static const QString empty = QString(QLatin1Char('-'));
|
||||||
|
|
||||||
QWB_ASSERT(mi.isValid(), return QVariant());
|
QTC_ASSERT(mi.isValid(), return QVariant());
|
||||||
|
|
||||||
if (mi.row() >= size())
|
if (mi.row() >= size())
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@@ -550,7 +551,7 @@ void BreakHandler::breakByFunction(const QString &functionName)
|
|||||||
// One per function is enough for now
|
// One per function is enough for now
|
||||||
for (int index = size(); --index >= 0;) {
|
for (int index = size(); --index >= 0;) {
|
||||||
const BreakpointData *data = at(index);
|
const BreakpointData *data = at(index);
|
||||||
QWB_ASSERT(data, break);
|
QTC_ASSERT(data, break);
|
||||||
if (data->funcName == functionName && data->condition.isEmpty()
|
if (data->funcName == functionName && data->condition.isEmpty()
|
||||||
&& data->ignoreCount.isEmpty())
|
&& data->ignoreCount.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ include(../../libs/cplusplus/cplusplus.pri)
|
|||||||
# DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
|
# DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
|
||||||
QT += gui network script
|
QT += gui network script
|
||||||
|
|
||||||
HEADERS += assert.h \
|
HEADERS += attachexternaldialog.h \
|
||||||
attachexternaldialog.h \
|
|
||||||
attachremotedialog.h \
|
attachremotedialog.h \
|
||||||
breakhandler.h \
|
breakhandler.h \
|
||||||
breakwindow.h \
|
breakwindow.h \
|
||||||
|
|||||||
@@ -352,6 +352,15 @@ void DebuggerManager::init()
|
|||||||
m_useFastStartAction->setCheckable(true);
|
m_useFastStartAction->setCheckable(true);
|
||||||
m_useFastStartAction->setChecked(true);
|
m_useFastStartAction->setChecked(true);
|
||||||
|
|
||||||
|
m_useToolTipsAction = new QAction(this);
|
||||||
|
m_useToolTipsAction->setText(tr("Use Tooltips While Debugging"));
|
||||||
|
m_useToolTipsAction->setToolTip(tr("Checking this will make enable "
|
||||||
|
"tooltips for variable values during debugging. Since this can slow "
|
||||||
|
"down debugging and does not provide reliable information as it does "
|
||||||
|
"not use scope information, it is switched off by default."));
|
||||||
|
m_useToolTipsAction->setCheckable(true);
|
||||||
|
m_useToolTipsAction->setChecked(false);
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
m_useFastStartAction->setChecked(false);
|
m_useFastStartAction->setChecked(false);
|
||||||
m_useFastStartAction->setEnabled(false);
|
m_useFastStartAction->setEnabled(false);
|
||||||
@@ -943,6 +952,8 @@ void DebuggerManager::loadSessionData()
|
|||||||
QVariant value;
|
QVariant value;
|
||||||
querySessionValue(QLatin1String("UseFastStart"), &value);
|
querySessionValue(QLatin1String("UseFastStart"), &value);
|
||||||
m_useFastStartAction->setChecked(value.toBool());
|
m_useFastStartAction->setChecked(value.toBool());
|
||||||
|
querySessionValue(QLatin1String("UseToolTips"), &value);
|
||||||
|
m_useToolTipsAction->setChecked(value.toBool());
|
||||||
querySessionValue(QLatin1String("UseCustomDumpers"), &value);
|
querySessionValue(QLatin1String("UseCustomDumpers"), &value);
|
||||||
m_useCustomDumpersAction->setChecked(!value.isValid() || value.toBool());
|
m_useCustomDumpersAction->setChecked(!value.isValid() || value.toBool());
|
||||||
querySessionValue(QLatin1String("SkipKnownFrames"), &value);
|
querySessionValue(QLatin1String("SkipKnownFrames"), &value);
|
||||||
@@ -956,6 +967,8 @@ void DebuggerManager::saveSessionData()
|
|||||||
|
|
||||||
setSessionValue(QLatin1String("UseFastStart"),
|
setSessionValue(QLatin1String("UseFastStart"),
|
||||||
m_useFastStartAction->isChecked());
|
m_useFastStartAction->isChecked());
|
||||||
|
setSessionValue(QLatin1String("UseToolTips"),
|
||||||
|
m_useToolTipsAction->isChecked());
|
||||||
setSessionValue(QLatin1String("UseCustomDumpers"),
|
setSessionValue(QLatin1String("UseCustomDumpers"),
|
||||||
m_useCustomDumpersAction->isChecked());
|
m_useCustomDumpersAction->isChecked());
|
||||||
setSessionValue(QLatin1String("SkipKnownFrames"),
|
setSessionValue(QLatin1String("SkipKnownFrames"),
|
||||||
|
|||||||
@@ -308,6 +308,7 @@ private:
|
|||||||
ThreadsHandler *threadsHandler() { return m_threadsHandler; }
|
ThreadsHandler *threadsHandler() { return m_threadsHandler; }
|
||||||
WatchHandler *watchHandler() { return m_watchHandler; }
|
WatchHandler *watchHandler() { return m_watchHandler; }
|
||||||
QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; }
|
QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; }
|
||||||
|
QAction *useToolTipsAction() const { return m_useToolTipsAction; }
|
||||||
QAction *debugDumpersAction() const { return m_debugDumpersAction; }
|
QAction *debugDumpersAction() const { return m_debugDumpersAction; }
|
||||||
bool skipKnownFrames() const;
|
bool skipKnownFrames() const;
|
||||||
bool debugDumpers() const;
|
bool debugDumpers() const;
|
||||||
@@ -431,6 +432,7 @@ private:
|
|||||||
QAction *m_debugDumpersAction;
|
QAction *m_debugDumpersAction;
|
||||||
QAction *m_useCustomDumpersAction;
|
QAction *m_useCustomDumpersAction;
|
||||||
QAction *m_useFastStartAction;
|
QAction *m_useFastStartAction;
|
||||||
|
QAction *m_useToolTipsAction;
|
||||||
QAction *m_dumpLogAction;
|
QAction *m_dumpLogAction;
|
||||||
|
|
||||||
QWidget *m_breakWindow;
|
QWidget *m_breakWindow;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include "debuggerplugin.h"
|
#include "debuggerplugin.h"
|
||||||
|
|
||||||
#include "assert.h"
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "debuggermanager.h"
|
#include "debuggermanager.h"
|
||||||
#include "debuggerrunner.h"
|
#include "debuggerrunner.h"
|
||||||
@@ -48,20 +47,27 @@
|
|||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
#include <coreplugin/modemanager.h>
|
#include <coreplugin/modemanager.h>
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
|
|
||||||
#include <cplusplus/ExpressionUnderCursor.h>
|
#include <cplusplus/ExpressionUnderCursor.h>
|
||||||
|
|
||||||
#include <cppeditor/cppeditorconstants.h>
|
#include <cppeditor/cppeditorconstants.h>
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
|
|
||||||
|
#include <texteditor/basetexteditor.h>
|
||||||
#include <texteditor/basetextmark.h>
|
#include <texteditor/basetextmark.h>
|
||||||
#include <texteditor/itexteditor.h>
|
#include <texteditor/itexteditor.h>
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/qplugin.h>
|
#include <QtCore/qplugin.h>
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QPoint>
|
#include <QtCore/QPoint>
|
||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
#include <QtGui/QPlainTextEdit>
|
#include <QtGui/QPlainTextEdit>
|
||||||
#include <QtGui/QTextBlock>
|
#include <QtGui/QTextBlock>
|
||||||
#include <QtGui/QTextCursor>
|
#include <QtGui/QTextCursor>
|
||||||
@@ -91,6 +97,7 @@ const char * const DEBUG_DUMPERS = "Debugger.DebugDumpers";
|
|||||||
const char * const ADD_TO_WATCH = "Debugger.AddToWatch";
|
const char * const ADD_TO_WATCH = "Debugger.AddToWatch";
|
||||||
const char * const USE_CUSTOM_DUMPERS = "Debugger.UseCustomDumpers";
|
const char * const USE_CUSTOM_DUMPERS = "Debugger.UseCustomDumpers";
|
||||||
const char * const USE_FAST_START = "Debugger.UseFastStart";
|
const char * const USE_FAST_START = "Debugger.UseFastStart";
|
||||||
|
const char * const USE_TOOL_TIPS = "Debugger.UseToolTips";
|
||||||
const char * const SKIP_KNOWN_FRAMES = "Debugger.SkipKnownFrames";
|
const char * const SKIP_KNOWN_FRAMES = "Debugger.SkipKnownFrames";
|
||||||
const char * const DUMP_LOG = "Debugger.DumpLog";
|
const char * const DUMP_LOG = "Debugger.DumpLog";
|
||||||
|
|
||||||
@@ -188,7 +195,7 @@ void DebuggerPlugin::shutdown()
|
|||||||
{
|
{
|
||||||
if (m_debugMode)
|
if (m_debugMode)
|
||||||
m_debugMode->shutdown(); // saves state including manager information
|
m_debugMode->shutdown(); // saves state including manager information
|
||||||
QWB_ASSERT(m_manager, /**/);
|
QTC_ASSERT(m_manager, /**/);
|
||||||
if (m_manager)
|
if (m_manager)
|
||||||
m_manager->shutdown();
|
m_manager->shutdown();
|
||||||
|
|
||||||
@@ -225,13 +232,13 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
|||||||
m_pm = ExtensionSystem::PluginManager::instance();
|
m_pm = ExtensionSystem::PluginManager::instance();
|
||||||
|
|
||||||
ICore *core = m_pm->getObject<Core::ICore>();
|
ICore *core = m_pm->getObject<Core::ICore>();
|
||||||
QWB_ASSERT(core, return false);
|
QTC_ASSERT(core, return false);
|
||||||
|
|
||||||
Core::ActionManagerInterface *actionManager = core->actionManager();
|
Core::ActionManagerInterface *actionManager = core->actionManager();
|
||||||
QWB_ASSERT(actionManager, return false);
|
QTC_ASSERT(actionManager, return false);
|
||||||
|
|
||||||
Core::UniqueIDManager *uidm = core->uniqueIDManager();
|
Core::UniqueIDManager *uidm = core->uniqueIDManager();
|
||||||
QWB_ASSERT(uidm, return false);
|
QTC_ASSERT(uidm, return false);
|
||||||
|
|
||||||
QList<int> globalcontext;
|
QList<int> globalcontext;
|
||||||
globalcontext << Core::Constants::C_GLOBAL_ID;
|
globalcontext << Core::Constants::C_GLOBAL_ID;
|
||||||
@@ -374,13 +381,17 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
|||||||
Constants::USE_FAST_START, globalcontext);
|
Constants::USE_FAST_START, globalcontext);
|
||||||
mdebug->addAction(cmd);
|
mdebug->addAction(cmd);
|
||||||
|
|
||||||
|
cmd = actionManager->registerAction(m_manager->m_useToolTipsAction,
|
||||||
|
Constants::USE_TOOL_TIPS, globalcontext);
|
||||||
|
mdebug->addAction(cmd);
|
||||||
|
|
||||||
|
#ifdef QT_DEBUG
|
||||||
cmd = actionManager->registerAction(m_manager->m_dumpLogAction,
|
cmd = actionManager->registerAction(m_manager->m_dumpLogAction,
|
||||||
Constants::DUMP_LOG, globalcontext);
|
Constants::DUMP_LOG, globalcontext);
|
||||||
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L")));
|
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L")));
|
||||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11")));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11")));
|
||||||
mdebug->addAction(cmd);
|
mdebug->addAction(cmd);
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
|
||||||
cmd = actionManager->registerAction(m_manager->m_debugDumpersAction,
|
cmd = actionManager->registerAction(m_manager->m_debugDumpersAction,
|
||||||
Constants::DEBUG_DUMPERS, debuggercontext);
|
Constants::DEBUG_DUMPERS, debuggercontext);
|
||||||
mdebug->addAction(cmd);
|
mdebug->addAction(cmd);
|
||||||
@@ -549,6 +560,9 @@ void DebuggerPlugin::requestMark(TextEditor::ITextEditor *editor, int lineNumber
|
|||||||
void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
|
void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
|
||||||
const QPoint &point, int pos)
|
const QPoint &point, int pos)
|
||||||
{
|
{
|
||||||
|
if (!m_manager->useToolTipsAction()->isChecked())
|
||||||
|
return;
|
||||||
|
|
||||||
QPlainTextEdit *plaintext = qobject_cast<QPlainTextEdit*>(editor->widget());
|
QPlainTextEdit *plaintext = qobject_cast<QPlainTextEdit*>(editor->widget());
|
||||||
if (!plaintext)
|
if (!plaintext)
|
||||||
return;
|
return;
|
||||||
@@ -590,13 +604,13 @@ void DebuggerPlugin::querySessionValue(const QString &name, QVariant *value)
|
|||||||
|
|
||||||
void DebuggerPlugin::setConfigValue(const QString &name, const QVariant &value)
|
void DebuggerPlugin::setConfigValue(const QString &name, const QVariant &value)
|
||||||
{
|
{
|
||||||
QWB_ASSERT(m_debugMode, return);
|
QTC_ASSERT(m_debugMode, return);
|
||||||
m_debugMode->settings()->setValue(name, value);
|
m_debugMode->settings()->setValue(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPlugin::queryConfigValue(const QString &name, QVariant *value)
|
void DebuggerPlugin::queryConfigValue(const QString &name, QVariant *value)
|
||||||
{
|
{
|
||||||
QWB_ASSERT(m_debugMode, return);
|
QTC_ASSERT(m_debugMode, return);
|
||||||
*value = m_debugMode->settings()->value(name);
|
*value = m_debugMode->settings()->value(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include "debuggerrunner.h"
|
#include "debuggerrunner.h"
|
||||||
|
|
||||||
#include "assert.h"
|
|
||||||
#include "debuggermanager.h"
|
#include "debuggermanager.h"
|
||||||
|
|
||||||
#include <projectexplorer/applicationrunconfiguration.h>
|
#include <projectexplorer/applicationrunconfiguration.h>
|
||||||
@@ -41,9 +40,12 @@
|
|||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
|
||||||
#include <QtGui/QTextDocument>
|
#include <QtGui/QTextDocument>
|
||||||
|
|
||||||
using namespace Debugger::Internal;
|
using namespace Debugger::Internal;
|
||||||
@@ -76,11 +78,10 @@ QString DebuggerRunner::displayName() const
|
|||||||
|
|
||||||
RunControl* DebuggerRunner::run(RunConfigurationPtr runConfiguration, const QString &mode)
|
RunControl* DebuggerRunner::run(RunConfigurationPtr runConfiguration, const QString &mode)
|
||||||
{
|
{
|
||||||
Q_UNUSED(mode);
|
QTC_ASSERT(mode == ProjectExplorer::Constants::DEBUGMODE, return 0);
|
||||||
Q_ASSERT(mode == ProjectExplorer::Constants::DEBUGMODE);
|
|
||||||
ApplicationRunConfigurationPtr rc =
|
ApplicationRunConfigurationPtr rc =
|
||||||
qSharedPointerCast<ApplicationRunConfiguration>(runConfiguration);
|
qSharedPointerCast<ApplicationRunConfiguration>(runConfiguration);
|
||||||
Q_ASSERT(rc);
|
QTC_ASSERT(rc, return 0);
|
||||||
//qDebug() << "***** Debugging" << rc->name() << rc->executable();
|
//qDebug() << "***** Debugging" << rc->name() << rc->executable();
|
||||||
return new DebuggerRunControl(m_manager, rc);
|
return new DebuggerRunControl(m_manager, rc);
|
||||||
}
|
}
|
||||||
@@ -118,9 +119,9 @@ void DebuggerRunControl::start()
|
|||||||
m_running = true;
|
m_running = true;
|
||||||
ApplicationRunConfigurationPtr rc =
|
ApplicationRunConfigurationPtr rc =
|
||||||
qSharedPointerCast<ApplicationRunConfiguration>(runConfiguration());
|
qSharedPointerCast<ApplicationRunConfiguration>(runConfiguration());
|
||||||
QWB_ASSERT(rc, return);
|
QTC_ASSERT(rc, return);
|
||||||
ProjectExplorer::Project *project = rc->project();
|
ProjectExplorer::Project *project = rc->project();
|
||||||
QWB_ASSERT(project, return);
|
QTC_ASSERT(project, return);
|
||||||
|
|
||||||
m_manager->m_executable = rc->executable();
|
m_manager->m_executable = rc->executable();
|
||||||
m_manager->m_environment = rc->environment().toStringList();
|
m_manager->m_environment = rc->environment().toStringList();
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include "gdbengine.h"
|
#include "gdbengine.h"
|
||||||
|
|
||||||
#include "assert.h"
|
|
||||||
#include "debuggerconstants.h"
|
#include "debuggerconstants.h"
|
||||||
#include "debuggermanager.h"
|
#include "debuggermanager.h"
|
||||||
#include "gdbmi.h"
|
#include "gdbmi.h"
|
||||||
@@ -49,6 +48,8 @@
|
|||||||
#include "startexternaldialog.h"
|
#include "startexternaldialog.h"
|
||||||
#include "attachexternaldialog.h"
|
#include "attachexternaldialog.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
@@ -278,25 +279,8 @@ void GdbEngine::init()
|
|||||||
connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), q,
|
connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), q,
|
||||||
SLOT(exitDebugger()));
|
SLOT(exitDebugger()));
|
||||||
|
|
||||||
// Custom dumpers
|
|
||||||
//m_dumperServerConnection = 0;
|
|
||||||
//m_dumperServer = new DumperServer(this);
|
|
||||||
//QString name = "gdb-" +
|
|
||||||
// QDateTime::currentDateTime().toString("yyyy_MM_dd-hh_mm_ss_zzz");
|
|
||||||
//m_dumperServer->listen(name);
|
|
||||||
//connect(m_dumperServer, SIGNAL(newConnection()),
|
|
||||||
// this, SLOT(acceptConnection()));
|
|
||||||
|
|
||||||
//if (!m_dumperServer->isListening()) {
|
|
||||||
// QMessageBox::critical(q->mainWindow(), tr("Dumper Server Setup Failed"),
|
|
||||||
// tr("Unable to create server listening for data: %1.\n"
|
|
||||||
// "Server name: %2").arg(m_dumperServer->errorString(), name),
|
|
||||||
// QMessageBox::Retry | QMessageBox::Cancel);
|
|
||||||
// }
|
|
||||||
|
|
||||||
connect(qq->debugDumpersAction(), SIGNAL(toggled(bool)),
|
connect(qq->debugDumpersAction(), SIGNAL(toggled(bool)),
|
||||||
this, SLOT(setDebugDumpers(bool)));
|
this, SLOT(setDebugDumpers(bool)));
|
||||||
|
|
||||||
connect(qq->useCustomDumpersAction(), SIGNAL(toggled(bool)),
|
connect(qq->useCustomDumpersAction(), SIGNAL(toggled(bool)),
|
||||||
this, SLOT(setCustomDumpersWanted(bool)));
|
this, SLOT(setCustomDumpersWanted(bool)));
|
||||||
|
|
||||||
@@ -442,8 +426,7 @@ void GdbEngine::handleResponse()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (token == -1 && *from != '&' && *from != '~' && *from != '*'
|
if (token == -1 && *from != '&' && *from != '~' && *from != '*') {
|
||||||
&& *from != '=') {
|
|
||||||
// FIXME: On Linux the application's std::out is merged in here.
|
// FIXME: On Linux the application's std::out is merged in here.
|
||||||
// High risk of falsely interpreting this as MI output.
|
// High risk of falsely interpreting this as MI output.
|
||||||
// We assume that we _always_ use tokens, so not finding a token
|
// We assume that we _always_ use tokens, so not finding a token
|
||||||
@@ -452,7 +435,7 @@ void GdbEngine::handleResponse()
|
|||||||
while (from != to && *from != '\n')
|
while (from != to && *from != '\n')
|
||||||
s += *from++;
|
s += *from++;
|
||||||
//qDebug() << "UNREQUESTED DATA " << s << " TAKEN AS APPLICATION OUTPUT";
|
//qDebug() << "UNREQUESTED DATA " << s << " TAKEN AS APPLICATION OUTPUT";
|
||||||
s += '\n';
|
//s += '\n';
|
||||||
|
|
||||||
m_inbuffer = QByteArray(from, to - from);
|
m_inbuffer = QByteArray(from, to - from);
|
||||||
emit applicationOutputAvailable("app-stdout: ", s);
|
emit applicationOutputAvailable("app-stdout: ", s);
|
||||||
@@ -648,7 +631,7 @@ void GdbEngine::readGdbStandardOutput()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_inbuffer.append(out);
|
m_inbuffer.append(out);
|
||||||
//QWB_ASSERT(!m_inbuffer.isEmpty(), return);
|
//QTC_ASSERT(!m_inbuffer.isEmpty(), return);
|
||||||
|
|
||||||
char c = m_inbuffer[m_inbuffer.size() - 1];
|
char c = m_inbuffer[m_inbuffer.size() - 1];
|
||||||
static const QByteArray termArray("(gdb) ");
|
static const QByteArray termArray("(gdb) ");
|
||||||
@@ -1416,7 +1399,7 @@ void GdbEngine::handleFileExecAndSymbols
|
|||||||
QString msg = response.data.findChild("msg").data();
|
QString msg = response.data.findChild("msg").data();
|
||||||
QMessageBox::critical(q->mainWindow(), tr("Error"),
|
QMessageBox::critical(q->mainWindow(), tr("Error"),
|
||||||
tr("Starting executable failed:\n") + msg);
|
tr("Starting executable failed:\n") + msg);
|
||||||
QWB_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
|
QTC_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
|
||||||
interruptInferior();
|
interruptInferior();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1437,7 +1420,7 @@ void GdbEngine::handleExecRun(const GdbResultRecord &response)
|
|||||||
} else {
|
} else {
|
||||||
QMessageBox::critical(q->mainWindow(), tr("Error"),
|
QMessageBox::critical(q->mainWindow(), tr("Error"),
|
||||||
tr("Starting executable failed:\n") + msg);
|
tr("Starting executable failed:\n") + msg);
|
||||||
QWB_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
|
QTC_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
|
||||||
interruptInferior();
|
interruptInferior();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2432,7 +2415,7 @@ void GdbEngine::selectThread(int index)
|
|||||||
threadsHandler->setCurrentThread(index);
|
threadsHandler->setCurrentThread(index);
|
||||||
|
|
||||||
QList<ThreadData> threads = threadsHandler->threads();
|
QList<ThreadData> threads = threadsHandler->threads();
|
||||||
QWB_ASSERT(index < threads.size(), return);
|
QTC_ASSERT(index < threads.size(), return);
|
||||||
int id = threads.at(index).id;
|
int id = threads.at(index).id;
|
||||||
q->showStatusMessage(tr("Retrieving data for stack view..."), 10000);
|
q->showStatusMessage(tr("Retrieving data for stack view..."), 10000);
|
||||||
sendCommand(QLatin1String("-thread-select ") + QString::number(id),
|
sendCommand(QLatin1String("-thread-select ") + QString::number(id),
|
||||||
@@ -2449,7 +2432,7 @@ void GdbEngine::activateFrame(int frameIndex)
|
|||||||
//qDebug() << "ACTIVATE FRAME: " << frameIndex << oldIndex
|
//qDebug() << "ACTIVATE FRAME: " << frameIndex << oldIndex
|
||||||
// << stackHandler->currentIndex();
|
// << stackHandler->currentIndex();
|
||||||
|
|
||||||
QWB_ASSERT(frameIndex < stackHandler->stackSize(), return);
|
QTC_ASSERT(frameIndex < stackHandler->stackSize(), return);
|
||||||
|
|
||||||
if (oldIndex != frameIndex) {
|
if (oldIndex != frameIndex) {
|
||||||
// Assuming this always succeeds saves a roundtrip.
|
// Assuming this always succeeds saves a roundtrip.
|
||||||
@@ -2970,7 +2953,7 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
|
|||||||
void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
||||||
{
|
{
|
||||||
WatchData data = data0;
|
WatchData data = data0;
|
||||||
QWB_ASSERT(!data.exp.isEmpty(), return);
|
QTC_ASSERT(!data.exp.isEmpty(), return);
|
||||||
QString tmplate;
|
QString tmplate;
|
||||||
QString inner;
|
QString inner;
|
||||||
bool isTemplate = extractTemplate(data.type, &tmplate, &inner);
|
bool isTemplate = extractTemplate(data.type, &tmplate, &inner);
|
||||||
@@ -3111,7 +3094,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
|||||||
#if DEBUG_SUBITEM
|
#if DEBUG_SUBITEM
|
||||||
qDebug() << "UPDATE SUBITEM: " << data.toString();
|
qDebug() << "UPDATE SUBITEM: " << data.toString();
|
||||||
#endif
|
#endif
|
||||||
QWB_ASSERT(data.isValid(), return);
|
QTC_ASSERT(data.isValid(), return);
|
||||||
|
|
||||||
// in any case we need the type first
|
// in any case we need the type first
|
||||||
if (data.isTypeNeeded()) {
|
if (data.isTypeNeeded()) {
|
||||||
@@ -3139,7 +3122,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we should have a type now. this is relied upon further below
|
// we should have a type now. this is relied upon further below
|
||||||
QWB_ASSERT(!data.type.isEmpty(), return);
|
QTC_ASSERT(!data.type.isEmpty(), return);
|
||||||
|
|
||||||
// a common case that can be easily solved
|
// a common case that can be easily solved
|
||||||
if (data.isChildrenNeeded() && isPointerType(data.type)
|
if (data.isChildrenNeeded() && isPointerType(data.type)
|
||||||
@@ -3197,7 +3180,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.isValueNeeded()) {
|
if (data.isValueNeeded()) {
|
||||||
QWB_ASSERT(!data.variable.isEmpty(), return); // tested above
|
QTC_ASSERT(!data.variable.isEmpty(), return); // tested above
|
||||||
#if DEBUG_SUBITEM
|
#if DEBUG_SUBITEM
|
||||||
qDebug() << "UPDATE SUBITEM: VALUE";
|
qDebug() << "UPDATE SUBITEM: VALUE";
|
||||||
#endif
|
#endif
|
||||||
@@ -3226,7 +3209,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.isChildrenNeeded()) {
|
if (data.isChildrenNeeded()) {
|
||||||
QWB_ASSERT(!data.variable.isEmpty(), return); // tested above
|
QTC_ASSERT(!data.variable.isEmpty(), return); // tested above
|
||||||
QString cmd = "-var-list-children --all-values \"" + data.variable + "\"";
|
QString cmd = "-var-list-children --all-values \"" + data.variable + "\"";
|
||||||
sendSynchronizedCommand(cmd, WatchVarListChildren, QVariant::fromValue(data));
|
sendSynchronizedCommand(cmd, WatchVarListChildren, QVariant::fromValue(data));
|
||||||
return;
|
return;
|
||||||
@@ -3251,14 +3234,14 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.isChildCountNeeded()) {
|
if (data.isChildCountNeeded()) {
|
||||||
QWB_ASSERT(!data.variable.isEmpty(), return); // tested above
|
QTC_ASSERT(!data.variable.isEmpty(), return); // tested above
|
||||||
QString cmd = "-var-list-children --all-values \"" + data.variable + "\"";
|
QString cmd = "-var-list-children --all-values \"" + data.variable + "\"";
|
||||||
sendCommand(cmd, WatchVarListChildren, QVariant::fromValue(data));
|
sendCommand(cmd, WatchVarListChildren, QVariant::fromValue(data));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "FIXME: UPDATE SUBITEM: " << data.toString();
|
qDebug() << "FIXME: UPDATE SUBITEM: " << data.toString();
|
||||||
QWB_ASSERT(false, return);
|
QTC_ASSERT(false, return);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::updateWatchModel()
|
void GdbEngine::updateWatchModel()
|
||||||
@@ -3272,7 +3255,7 @@ void GdbEngine::updateWatchModel2()
|
|||||||
{
|
{
|
||||||
PENDING_DEBUG("UPDATE WATCH MODEL");
|
PENDING_DEBUG("UPDATE WATCH MODEL");
|
||||||
QList<WatchData> incomplete = qq->watchHandler()->takeCurrentIncompletes();
|
QList<WatchData> incomplete = qq->watchHandler()->takeCurrentIncompletes();
|
||||||
//QWB_ASSERT(incomplete.isEmpty(), /**/);
|
//QTC_ASSERT(incomplete.isEmpty(), /**/);
|
||||||
if (!incomplete.isEmpty()) {
|
if (!incomplete.isEmpty()) {
|
||||||
#if DEBUG_PENDING
|
#if DEBUG_PENDING
|
||||||
qDebug() << "##############################################";
|
qDebug() << "##############################################";
|
||||||
@@ -3437,7 +3420,7 @@ void GdbEngine::handleEvaluateExpression(const GdbResultRecord &record,
|
|||||||
const WatchData &data0)
|
const WatchData &data0)
|
||||||
{
|
{
|
||||||
WatchData data = data0;
|
WatchData data = data0;
|
||||||
QWB_ASSERT(data.isValid(), qDebug() << "HUH?");
|
QTC_ASSERT(data.isValid(), qDebug() << "HUH?");
|
||||||
if (record.resultClass == GdbResultDone) {
|
if (record.resultClass == GdbResultDone) {
|
||||||
//if (col == 0)
|
//if (col == 0)
|
||||||
// data.name = record.data.findChild("value").data();
|
// data.name = record.data.findChild("value").data();
|
||||||
@@ -3465,7 +3448,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
|
|||||||
const WatchData &data0)
|
const WatchData &data0)
|
||||||
{
|
{
|
||||||
WatchData data = data0;
|
WatchData data = data0;
|
||||||
QWB_ASSERT(data.isValid(), return);
|
QTC_ASSERT(data.isValid(), return);
|
||||||
if (record.resultClass == GdbResultDone) {
|
if (record.resultClass == GdbResultDone) {
|
||||||
// ignore this case, data will follow
|
// ignore this case, data will follow
|
||||||
} else if (record.resultClass == GdbResultError) {
|
} else if (record.resultClass == GdbResultError) {
|
||||||
@@ -3499,7 +3482,7 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
|
|||||||
const WatchData &data0)
|
const WatchData &data0)
|
||||||
{
|
{
|
||||||
WatchData data = data0;
|
WatchData data = data0;
|
||||||
QWB_ASSERT(data.isValid(), return);
|
QTC_ASSERT(data.isValid(), return);
|
||||||
//qDebug() << "CUSTOM VALUE RESULT: " << record.toString();
|
//qDebug() << "CUSTOM VALUE RESULT: " << record.toString();
|
||||||
//qDebug() << "FOR DATA: " << data.toString() << record.resultClass;
|
//qDebug() << "FOR DATA: " << data.toString() << record.resultClass;
|
||||||
if (record.resultClass == GdbResultDone) {
|
if (record.resultClass == GdbResultDone) {
|
||||||
@@ -3660,7 +3643,17 @@ void GdbEngine::setLocals(const QList<GdbMi> &locals)
|
|||||||
QHash<QString, int> seen;
|
QHash<QString, int> seen;
|
||||||
|
|
||||||
foreach (const GdbMi &item, locals) {
|
foreach (const GdbMi &item, locals) {
|
||||||
|
// Local variables of inlined code are reported as
|
||||||
|
// 26^done,locals={varobj={exp="this",value="",name="var4",exp="this",
|
||||||
|
// numchild="1",type="const QtSharedPointer::Basic<CPlusPlus::..."
|
||||||
|
// We do not want these at all. Current hypotheses is that those
|
||||||
|
// "spurious" locals have _two_ "exp" field. Try to filter them:
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
|
int numExps = 0;
|
||||||
|
foreach (const GdbMi &child, item.children())
|
||||||
|
numExps += int(child.name() == "exp");
|
||||||
|
if (numExps > 1)
|
||||||
|
continue;
|
||||||
QString name = item.findChild("exp").data();
|
QString name = item.findChild("exp").data();
|
||||||
#else
|
#else
|
||||||
QString name = item.findChild("name").data();
|
QString name = item.findChild("name").data();
|
||||||
|
|||||||
@@ -34,6 +34,9 @@
|
|||||||
#ifndef DEBUGGER_GDBENGINE_H
|
#ifndef DEBUGGER_GDBENGINE_H
|
||||||
#define DEBUGGER_GDBENGINE_H
|
#define DEBUGGER_GDBENGINE_H
|
||||||
|
|
||||||
|
#include "idebuggerengine.h"
|
||||||
|
#include "gdbmi.h"
|
||||||
|
|
||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
#include <QtCore/QHash>
|
#include <QtCore/QHash>
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QMap>
|
||||||
@@ -48,9 +51,6 @@ class QAbstractItemModel;
|
|||||||
class QWidget;
|
class QWidget;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#include "idebuggerengine.h"
|
|
||||||
#include "gdbmi.h"
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,10 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "gdbmi.h"
|
#include "gdbmi.h"
|
||||||
#include "assert.h"
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
#include <QtCore/QDebug>
|
|
||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
@@ -138,7 +138,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);
|
||||||
QWB_ASSERT(*from == '{', /**/);
|
QTC_ASSERT(*from == '{', /**/);
|
||||||
++from;
|
++from;
|
||||||
parseTuple_helper(from, to);
|
parseTuple_helper(from, to);
|
||||||
}
|
}
|
||||||
@@ -166,7 +166,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);
|
||||||
QWB_ASSERT(*from == '[', /**/);
|
QTC_ASSERT(*from == '[', /**/);
|
||||||
++from;
|
++from;
|
||||||
m_type = List;
|
m_type = List;
|
||||||
while (from < to) {
|
while (from < to) {
|
||||||
|
|||||||
@@ -59,10 +59,10 @@ TypeMacroPage::TypeMacroPage(GdbSettings *settings)
|
|||||||
//insert qt4 defaults
|
//insert qt4 defaults
|
||||||
m_settings->m_scriptFile = coreIFace->resourcePath() +
|
m_settings->m_scriptFile = coreIFace->resourcePath() +
|
||||||
QLatin1String("/gdb/qt4macros");
|
QLatin1String("/gdb/qt4macros");
|
||||||
for (int i=0; i<3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
QDataStream stream(&data, QIODevice::WriteOnly);
|
QDataStream stream(&data, QIODevice::WriteOnly);
|
||||||
switch(i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
stream << QString("printqstring") << (int)1;
|
stream << QString("printqstring") << (int)1;
|
||||||
m_settings->m_typeMacros.insert(QLatin1String("QString"), data);
|
m_settings->m_typeMacros.insert(QLatin1String("QString"), data);
|
||||||
@@ -154,7 +154,7 @@ void TypeMacroPage::finished(bool accepted)
|
|||||||
m_settings->m_typeMacros.clear();
|
m_settings->m_typeMacros.clear();
|
||||||
m_settings->m_scriptFile = m_ui.scriptEdit->text();
|
m_settings->m_scriptFile = m_ui.scriptEdit->text();
|
||||||
|
|
||||||
for (int i=0; i<m_ui.treeWidget->topLevelItemCount(); ++i) {
|
for (int i = 0; i < m_ui.treeWidget->topLevelItemCount(); ++i) {
|
||||||
QTreeWidgetItem *item = m_ui.treeWidget->topLevelItem(i);
|
QTreeWidgetItem *item = m_ui.treeWidget->topLevelItem(i);
|
||||||
QByteArray data;
|
QByteArray data;
|
||||||
QDataStream stream(&data, QIODevice::WriteOnly);
|
QDataStream stream(&data, QIODevice::WriteOnly);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user