forked from qt-creator/qt-creator
Merge branch 'master' of scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
me=$(dirname $0)
|
me=$(dirname $0)
|
||||||
|
|
||||||
for i in $QTDIR/src/declarative/qml/parser/*.{h,cpp,pri}; do
|
for i in $QTDIR/src/declarative/qml/parser/*.{g,h,cpp,pri}; do
|
||||||
sed -f $me/cmd.sed $i > $me/$(echo $(basename $i) | sed s/qdeclarativejs/qmljs/)
|
sed -f $me/cmd.sed $i > $me/$(echo $(basename $i) | sed s/qdeclarativejs/qmljs/)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,7 @@
|
|||||||
%token T_PUBLIC "public"
|
%token T_PUBLIC "public"
|
||||||
%token T_IMPORT "import"
|
%token T_IMPORT "import"
|
||||||
%token T_AS "as"
|
%token T_AS "as"
|
||||||
|
%token T_ON "on"
|
||||||
|
|
||||||
--- feed tokens
|
--- feed tokens
|
||||||
%token T_FEED_UI_PROGRAM
|
%token T_FEED_UI_PROGRAM
|
||||||
@@ -653,18 +654,15 @@ case $rule_number: {
|
|||||||
node = makeAstNode<AST::UiImport>(driver->nodePool(), importIdLiteral->value);
|
node = makeAstNode<AST::UiImport>(driver->nodePool(), importIdLiteral->value);
|
||||||
node->fileNameToken = loc(2);
|
node->fileNameToken = loc(2);
|
||||||
} else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) {
|
} else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) {
|
||||||
QString text;
|
|
||||||
for (AST::UiQualifiedId *q = qualifiedId; q; q = q->next) {
|
|
||||||
text += q->name->asString();
|
|
||||||
if (q->next) text += QLatin1String(".");
|
|
||||||
}
|
|
||||||
node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId);
|
node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId);
|
||||||
node->fileNameToken = loc(2);
|
node->fileNameToken = loc(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
sym(1).Node = node;
|
sym(1).Node = node;
|
||||||
|
|
||||||
if (! node) {
|
if (node) {
|
||||||
|
node->importToken = loc(1);
|
||||||
|
} else {
|
||||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),
|
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),
|
||||||
QLatin1String("Expected a qualified name id or a string literal")));
|
QLatin1String("Expected a qualified name id or a string literal")));
|
||||||
|
|
||||||
@@ -773,6 +771,17 @@ case $rule_number: {
|
|||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
|
UiObjectMember: UiQualifiedId T_ON UiQualifiedId UiObjectInitializer ;
|
||||||
|
/.
|
||||||
|
case $rule_number: {
|
||||||
|
AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(),
|
||||||
|
sym(3).UiQualifiedId, sym(1).UiQualifiedId, sym(4).UiObjectInitializer);
|
||||||
|
node->colonToken = loc(2);
|
||||||
|
node->hasOnToken = true;
|
||||||
|
sym(1).Node = node;
|
||||||
|
} break;
|
||||||
|
./
|
||||||
|
|
||||||
UiObjectMember: UiQualifiedId T_COLON Block ;
|
UiObjectMember: UiQualifiedId T_COLON Block ;
|
||||||
/.case $rule_number:./
|
/.case $rule_number:./
|
||||||
|
|
||||||
@@ -870,8 +879,8 @@ case $rule_number: {
|
|||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT T_IDENTIFIER T_AUTOMATIC_SEMICOLON ;
|
UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_AUTOMATIC_SEMICOLON ;
|
||||||
UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT T_IDENTIFIER T_SEMICOLON ;
|
UiObjectMember: T_PROPERTY T_IDENTIFIER T_LT UiPropertyType T_GT JsIdentifier T_SEMICOLON ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
|
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
|
||||||
@@ -885,8 +894,8 @@ case $rule_number: {
|
|||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_AUTOMATIC_SEMICOLON ;
|
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEMICOLON ;
|
||||||
UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_SEMICOLON ;
|
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
|
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
|
||||||
@@ -898,8 +907,8 @@ case $rule_number: {
|
|||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_AUTOMATIC_SEMICOLON ;
|
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_AUTOMATIC_SEMICOLON ;
|
||||||
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_SEMICOLON ;
|
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_SEMICOLON ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval);
|
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval);
|
||||||
@@ -913,8 +922,8 @@ case $rule_number: {
|
|||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_AUTOMATIC_SEMICOLON ;
|
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_AUTOMATIC_SEMICOLON ;
|
||||||
UiObjectMember: T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_SEMICOLON ;
|
UiObjectMember: T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_SEMICOLON ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
|
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
|
||||||
@@ -928,8 +937,8 @@ case $rule_number: {
|
|||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_AUTOMATIC_SEMICOLON ;
|
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_AUTOMATIC_SEMICOLON ;
|
||||||
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_SEMICOLON ;
|
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_SEMICOLON ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
|
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
|
||||||
@@ -945,8 +954,8 @@ case $rule_number: {
|
|||||||
} break;
|
} break;
|
||||||
./
|
./
|
||||||
|
|
||||||
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_AUTOMATIC_SEMICOLON ;
|
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_AUTOMATIC_SEMICOLON ;
|
||||||
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType T_IDENTIFIER T_COLON Expression T_SEMICOLON ;
|
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType JsIdentifier T_COLON Expression T_SEMICOLON ;
|
||||||
/.
|
/.
|
||||||
case $rule_number: {
|
case $rule_number: {
|
||||||
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
|
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
|
||||||
@@ -1005,6 +1014,15 @@ case $rule_number: {
|
|||||||
}
|
}
|
||||||
./
|
./
|
||||||
|
|
||||||
|
JsIdentifier: T_ON ;
|
||||||
|
/.
|
||||||
|
case $rule_number: {
|
||||||
|
QString s = QLatin1String(QmlJSGrammar::spell[T_ON]);
|
||||||
|
sym(1).sval = driver->intern(s.constData(), s.length());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
./
|
||||||
|
|
||||||
--------------------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------------
|
||||||
-- Expressions
|
-- Expressions
|
||||||
--------------------------------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------------------------------
|
||||||
@@ -1086,6 +1104,9 @@ case $rule_number: {
|
|||||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
|
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
|
||||||
return false; // ### remove me
|
return false; // ### remove me
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loc(1).length = lexer->tokenLength();
|
||||||
|
|
||||||
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
|
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
|
||||||
node->literalToken = loc(1);
|
node->literalToken = loc(1);
|
||||||
sym(1).Node = node;
|
sym(1).Node = node;
|
||||||
@@ -1103,6 +1124,9 @@ case $rule_number: {
|
|||||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
|
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loc(1).length = lexer->tokenLength();
|
||||||
|
|
||||||
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
|
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
|
||||||
node->literalToken = loc(1);
|
node->literalToken = loc(1);
|
||||||
sym(1).Node = node;
|
sym(1).Node = node;
|
||||||
|
|||||||
@@ -273,11 +273,6 @@ case 20: {
|
|||||||
node = makeAstNode<AST::UiImport>(driver->nodePool(), importIdLiteral->value);
|
node = makeAstNode<AST::UiImport>(driver->nodePool(), importIdLiteral->value);
|
||||||
node->fileNameToken = loc(2);
|
node->fileNameToken = loc(2);
|
||||||
} else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) {
|
} else if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(2).Expression)) {
|
||||||
QString text;
|
|
||||||
for (AST::UiQualifiedId *q = qualifiedId; q; q = q->next) {
|
|
||||||
text += q->name->asString();
|
|
||||||
if (q->next) text += QLatin1String(".");
|
|
||||||
}
|
|
||||||
node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId);
|
node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId);
|
||||||
node->fileNameToken = loc(2);
|
node->fileNameToken = loc(2);
|
||||||
}
|
}
|
||||||
@@ -571,6 +566,9 @@ case 76: {
|
|||||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
|
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
|
||||||
return false; // ### remove me
|
return false; // ### remove me
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loc(1).length = lexer->tokenLength();
|
||||||
|
|
||||||
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
|
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
|
||||||
node->literalToken = loc(1);
|
node->literalToken = loc(1);
|
||||||
sym(1).Node = node;
|
sym(1).Node = node;
|
||||||
@@ -582,6 +580,9 @@ case 77: {
|
|||||||
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
|
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loc(1).length = lexer->tokenLength();
|
||||||
|
|
||||||
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
|
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
|
||||||
node->literalToken = loc(1);
|
node->literalToken = loc(1);
|
||||||
sym(1).Node = node;
|
sym(1).Node = node;
|
||||||
|
|||||||
@@ -290,8 +290,8 @@ public:
|
|||||||
WizardProgress *m_wizardProgress;
|
WizardProgress *m_wizardProgress;
|
||||||
};
|
};
|
||||||
|
|
||||||
Wizard::Wizard(QWidget *parent) :
|
Wizard::Wizard(QWidget *parent, Qt::WindowFlags flags) :
|
||||||
QWizard(parent), d_ptr(new WizardPrivate)
|
QWizard(parent, flags), d_ptr(new WizardPrivate)
|
||||||
{
|
{
|
||||||
d_ptr->q_ptr = this;
|
d_ptr->q_ptr = this;
|
||||||
d_ptr->m_wizardProgress = new WizardProgress(this);
|
d_ptr->m_wizardProgress = new WizardProgress(this);
|
||||||
@@ -301,6 +301,11 @@ Wizard::Wizard(QWidget *parent) :
|
|||||||
setSideWidget(new LinearProgressWidget(d_ptr->m_wizardProgress, this));
|
setSideWidget(new LinearProgressWidget(d_ptr->m_wizardProgress, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Wizard::~Wizard()
|
||||||
|
{
|
||||||
|
delete d_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool Wizard::isAutomaticProgressCreationEnabled() const
|
bool Wizard::isAutomaticProgressCreationEnabled() const
|
||||||
{
|
{
|
||||||
Q_D(const Wizard);
|
Q_D(const Wizard);
|
||||||
@@ -563,6 +568,7 @@ WizardProgress::~WizardProgress()
|
|||||||
delete it.key();
|
delete it.key();
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
delete d_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
WizardProgressItem *WizardProgress::addItem(const QString &title)
|
WizardProgressItem *WizardProgress::addItem(const QString &title)
|
||||||
@@ -764,7 +770,7 @@ WizardProgressItem::WizardProgressItem(WizardProgress *progress, const QString &
|
|||||||
|
|
||||||
WizardProgressItem::~WizardProgressItem()
|
WizardProgressItem::~WizardProgressItem()
|
||||||
{
|
{
|
||||||
|
delete d_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WizardProgressItem::addPage(int pageId)
|
void WizardProgressItem::addPage(int pageId)
|
||||||
|
|||||||
@@ -47,7 +47,8 @@ class QTCREATOR_UTILS_EXPORT Wizard : public QWizard
|
|||||||
Q_PROPERTY(bool automaticProgressCreationEnabled READ isAutomaticProgressCreationEnabled WRITE setAutomaticProgressCreationEnabled)
|
Q_PROPERTY(bool automaticProgressCreationEnabled READ isAutomaticProgressCreationEnabled WRITE setAutomaticProgressCreationEnabled)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Wizard(QWidget *parent = 0);
|
explicit Wizard(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||||
|
virtual ~Wizard();
|
||||||
|
|
||||||
bool isAutomaticProgressCreationEnabled() const;
|
bool isAutomaticProgressCreationEnabled() const;
|
||||||
void setAutomaticProgressCreationEnabled(bool enabled);
|
void setAutomaticProgressCreationEnabled(bool enabled);
|
||||||
@@ -66,7 +67,7 @@ private:
|
|||||||
Q_DISABLE_COPY(Wizard)
|
Q_DISABLE_COPY(Wizard)
|
||||||
Q_DECLARE_PRIVATE(Wizard)
|
Q_DECLARE_PRIVATE(Wizard)
|
||||||
|
|
||||||
QScopedPointer<WizardPrivate> d_ptr;
|
class WizardPrivate *d_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WizardProgressItem;
|
class WizardProgressItem;
|
||||||
@@ -118,7 +119,7 @@ private:
|
|||||||
Q_DISABLE_COPY(WizardProgress)
|
Q_DISABLE_COPY(WizardProgress)
|
||||||
Q_DECLARE_PRIVATE(WizardProgress)
|
Q_DECLARE_PRIVATE(WizardProgress)
|
||||||
|
|
||||||
QScopedPointer<WizardProgressPrivate> d_ptr;
|
class WizardProgressPrivate *d_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WizardProgressItemPrivate;
|
class WizardProgressItemPrivate;
|
||||||
@@ -150,7 +151,7 @@ private:
|
|||||||
Q_DISABLE_COPY(WizardProgressItem)
|
Q_DISABLE_COPY(WizardProgressItem)
|
||||||
Q_DECLARE_PRIVATE(WizardProgressItem)
|
Q_DECLARE_PRIVATE(WizardProgressItem)
|
||||||
|
|
||||||
QScopedPointer<WizardProgressItemPrivate> d_ptr;
|
class WizardProgressItemPrivate *d_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ namespace Internal {
|
|||||||
|
|
||||||
// ----------- Category model
|
// ----------- Category model
|
||||||
|
|
||||||
struct Category {
|
class Category {
|
||||||
|
public:
|
||||||
QString id;
|
QString id;
|
||||||
QString displayName;
|
QString displayName;
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ namespace Core {
|
|||||||
EditorToolBar::EditorToolBar(QWidget *parent) :
|
EditorToolBar::EditorToolBar(QWidget *parent) :
|
||||||
Utils::StyledBar(parent),
|
Utils::StyledBar(parent),
|
||||||
m_editorList(new QComboBox(this)),
|
m_editorList(new QComboBox(this)),
|
||||||
m_rightToolBar(new QToolBar(this)),
|
|
||||||
m_closeButton(new QToolButton),
|
m_closeButton(new QToolButton),
|
||||||
m_lockButton(new QToolButton),
|
m_lockButton(new QToolButton),
|
||||||
|
|
||||||
@@ -124,10 +123,6 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
|
|||||||
m_forwardButton= new QToolButton(this);
|
m_forwardButton= new QToolButton(this);
|
||||||
m_forwardButton->setDefaultAction(m_goForwardAction);
|
m_forwardButton->setDefaultAction(m_goForwardAction);
|
||||||
|
|
||||||
m_rightToolBar->setLayoutDirection(Qt::RightToLeft);
|
|
||||||
m_rightToolBar->addWidget(m_closeButton);
|
|
||||||
m_rightToolBar->addWidget(m_lockButton);
|
|
||||||
|
|
||||||
QHBoxLayout *toplayout = new QHBoxLayout(this);
|
QHBoxLayout *toplayout = new QHBoxLayout(this);
|
||||||
toplayout->setSpacing(0);
|
toplayout->setSpacing(0);
|
||||||
toplayout->setMargin(0);
|
toplayout->setMargin(0);
|
||||||
@@ -135,7 +130,8 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
|
|||||||
toplayout->addWidget(m_forwardButton);
|
toplayout->addWidget(m_forwardButton);
|
||||||
toplayout->addWidget(m_editorList);
|
toplayout->addWidget(m_editorList);
|
||||||
toplayout->addWidget(m_toolBarPlaceholder, 1); // Custom toolbar stretches
|
toplayout->addWidget(m_toolBarPlaceholder, 1); // Custom toolbar stretches
|
||||||
toplayout->addWidget(m_rightToolBar);
|
toplayout->addWidget(m_lockButton);
|
||||||
|
toplayout->addWidget(m_closeButton);
|
||||||
|
|
||||||
setLayout(toplayout);
|
setLayout(toplayout);
|
||||||
|
|
||||||
|
|||||||
@@ -111,8 +111,6 @@ private:
|
|||||||
IEditor *currentEditor() const;
|
IEditor *currentEditor() const;
|
||||||
Core::OpenEditorsModel *m_editorsListModel;
|
Core::OpenEditorsModel *m_editorsListModel;
|
||||||
QComboBox *m_editorList;
|
QComboBox *m_editorList;
|
||||||
QToolBar *m_centerToolBar;
|
|
||||||
QToolBar *m_rightToolBar;
|
|
||||||
QToolButton *m_closeButton;
|
QToolButton *m_closeButton;
|
||||||
QToolButton *m_lockButton;
|
QToolButton *m_lockButton;
|
||||||
QAction *m_goBackAction;
|
QAction *m_goBackAction;
|
||||||
|
|||||||
@@ -264,31 +264,8 @@ FancyActionBar::FancyActionBar(QWidget *parent)
|
|||||||
spacerLayout->setSpacing(0);
|
spacerLayout->setSpacing(0);
|
||||||
setLayout(spacerLayout);
|
setLayout(spacerLayout);
|
||||||
setContentsMargins(0,2,0,0);
|
setContentsMargins(0,2,0,0);
|
||||||
|
|
||||||
m_runButton = m_debugButton = 0;
|
|
||||||
m_inDebugMode = false;
|
|
||||||
|
|
||||||
connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
|
|
||||||
this, SLOT(modeChanged(Core::IMode*)));
|
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
|
||||||
qApp->installEventFilter(this);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
|
||||||
bool FancyActionBar::eventFilter(QObject *, QEvent *e)
|
|
||||||
{
|
|
||||||
if (e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease) {
|
|
||||||
if (static_cast<QKeyEvent *>(e)->key() == Qt::Key_Alt)
|
|
||||||
updateRunDebug();
|
|
||||||
} else if (e->type() == QEvent::WindowDeactivate)
|
|
||||||
updateRunDebug();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void FancyActionBar::addProjectSelector(QAction *action)
|
void FancyActionBar::addProjectSelector(QAction *action)
|
||||||
{
|
{
|
||||||
FancyToolButton* toolButton = new FancyToolButton(this);
|
FancyToolButton* toolButton = new FancyToolButton(this);
|
||||||
@@ -300,40 +277,11 @@ void FancyActionBar::addProjectSelector(QAction *action)
|
|||||||
void FancyActionBar::insertAction(int index, QAction *action)
|
void FancyActionBar::insertAction(int index, QAction *action)
|
||||||
{
|
{
|
||||||
FancyToolButton *toolButton = new FancyToolButton(this);
|
FancyToolButton *toolButton = new FancyToolButton(this);
|
||||||
if (action->objectName() == QLatin1String("ProjectExplorer.Run"))
|
|
||||||
m_runButton = toolButton;
|
|
||||||
if (action->objectName() == QLatin1String("ProjectExplorer.Debug"))
|
|
||||||
m_debugButton = toolButton;
|
|
||||||
|
|
||||||
toolButton->setDefaultAction(action);
|
toolButton->setDefaultAction(action);
|
||||||
connect(action, SIGNAL(changed()), toolButton, SLOT(actionChanged()));
|
connect(action, SIGNAL(changed()), toolButton, SLOT(actionChanged()));
|
||||||
m_actionsLayout->insertWidget(index, toolButton);
|
m_actionsLayout->insertWidget(index, toolButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FancyActionBar::modeChanged(Core::IMode *mode)
|
|
||||||
{
|
|
||||||
m_inDebugMode = (mode->id() == QLatin1String("Debugger.Mode.Debug"));
|
|
||||||
updateRunDebug();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FancyActionBar::updateRunDebug()
|
|
||||||
{
|
|
||||||
if (!m_runButton || !m_debugButton)
|
|
||||||
return;
|
|
||||||
|
|
||||||
bool doDebug = m_inDebugMode;
|
|
||||||
#ifdef Q_WS_MAC
|
|
||||||
if (QApplication::keyboardModifiers() && Qt::AltModifier)
|
|
||||||
doDebug = !doDebug;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
layout()->setEnabled(false);
|
|
||||||
m_runButton->forceVisible(!doDebug);
|
|
||||||
m_debugButton->forceVisible(doDebug);
|
|
||||||
layout()->setEnabled(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QLayout *FancyActionBar::actionsLayout() const
|
QLayout *FancyActionBar::actionsLayout() const
|
||||||
{
|
{
|
||||||
return m_actionsLayout;
|
return m_actionsLayout;
|
||||||
|
|||||||
@@ -75,23 +75,13 @@ class FancyActionBar : public QWidget
|
|||||||
public:
|
public:
|
||||||
FancyActionBar(QWidget *parent = 0);
|
FancyActionBar(QWidget *parent = 0);
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
|
||||||
bool eventFilter(QObject *, QEvent *);
|
|
||||||
#endif
|
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
void insertAction(int index, QAction *action);
|
void insertAction(int index, QAction *action);
|
||||||
void addProjectSelector(QAction *action);
|
void addProjectSelector(QAction *action);
|
||||||
QLayout *actionsLayout() const;
|
QLayout *actionsLayout() const;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void modeChanged(Core::IMode *mode);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateRunDebug();
|
|
||||||
bool m_inDebugMode;
|
|
||||||
QVBoxLayout *m_actionsLayout;
|
QVBoxLayout *m_actionsLayout;
|
||||||
FancyToolButton *m_runButton;
|
|
||||||
FancyToolButton *m_debugButton;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ enum { debug = 0 };
|
|||||||
|
|
||||||
namespace CodePaster {
|
namespace CodePaster {
|
||||||
|
|
||||||
CodePasterProtocol::CodePasterProtocol() :
|
CodePasterProtocol::CodePasterProtocol(const NetworkAccessManagerProxyPtr &nw) :
|
||||||
|
NetworkProtocol(nw),
|
||||||
m_page(new CodePaster::CodePasterSettingsPage),
|
m_page(new CodePaster::CodePasterSettingsPage),
|
||||||
m_pasteReply(0),
|
m_pasteReply(0),
|
||||||
m_fetchReply(0),
|
m_fetchReply(0),
|
||||||
@@ -98,10 +99,7 @@ void CodePasterProtocol::fetch(const QString &id)
|
|||||||
link.append(hostName);
|
link.append(hostName);
|
||||||
link.append("/?format=raw&id=");
|
link.append("/?format=raw&id=");
|
||||||
link.append(id);
|
link.append(id);
|
||||||
QUrl url(link);
|
m_fetchReply = httpGet(link);
|
||||||
QNetworkRequest r(url);
|
|
||||||
|
|
||||||
m_fetchReply = m_manager.get(r);
|
|
||||||
connect(m_fetchReply, SIGNAL(finished()), this, SLOT(fetchFinished()));
|
connect(m_fetchReply, SIGNAL(finished()), this, SLOT(fetchFinished()));
|
||||||
m_fetchId = id;
|
m_fetchId = id;
|
||||||
}
|
}
|
||||||
@@ -116,9 +114,7 @@ void CodePasterProtocol::list()
|
|||||||
QString link = QLatin1String("http://");
|
QString link = QLatin1String("http://");
|
||||||
link += hostName;
|
link += hostName;
|
||||||
link += QLatin1String("/?command=browse&format=raw");
|
link += QLatin1String("/?command=browse&format=raw");
|
||||||
QUrl url(link);
|
m_listReply = httpGet(link);
|
||||||
QNetworkRequest r(url);
|
|
||||||
m_listReply = m_manager.get(r);
|
|
||||||
connect(m_listReply, SIGNAL(finished()), this, SLOT(listFinished()));
|
connect(m_listReply, SIGNAL(finished()), this, SLOT(listFinished()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,9 +138,7 @@ void CodePasterProtocol::paste(const QString &text,
|
|||||||
data += "&poster=";
|
data += "&poster=";
|
||||||
data += CGI::encodeURL(username).toLatin1();
|
data += CGI::encodeURL(username).toLatin1();
|
||||||
|
|
||||||
QUrl url(QLatin1String("http://") + hostName);
|
m_pasteReply = httpPost(QLatin1String("http://") + hostName, data);
|
||||||
QNetworkRequest r(url);
|
|
||||||
m_pasteReply = m_manager.post(r, data);
|
|
||||||
connect(m_pasteReply, SIGNAL(finished()), this, SLOT(pasteFinished()));
|
connect(m_pasteReply, SIGNAL(finished()), this, SLOT(pasteFinished()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,6 @@
|
|||||||
|
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
#include <QtNetwork/QNetworkAccessManager>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QNetworkReply;
|
class QNetworkReply;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
@@ -42,11 +40,11 @@ namespace CodePaster {
|
|||||||
|
|
||||||
class CodePasterSettingsPage;
|
class CodePasterSettingsPage;
|
||||||
|
|
||||||
class CodePasterProtocol : public Protocol
|
class CodePasterProtocol : public NetworkProtocol
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CodePasterProtocol();
|
explicit CodePasterProtocol(const NetworkAccessManagerProxyPtr &nw);
|
||||||
~CodePasterProtocol();
|
~CodePasterProtocol();
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
@@ -70,7 +68,6 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
bool isValidHostName(const QString& hostName);
|
bool isValidHostName(const QString& hostName);
|
||||||
CodePasterSettingsPage *m_page;
|
CodePasterSettingsPage *m_page;
|
||||||
QNetworkAccessManager m_manager;
|
|
||||||
QNetworkReply *m_pasteReply;
|
QNetworkReply *m_pasteReply;
|
||||||
QNetworkReply *m_fetchReply;
|
QNetworkReply *m_fetchReply;
|
||||||
QNetworkReply *m_listReply;
|
QNetworkReply *m_listReply;
|
||||||
|
|||||||
@@ -65,7 +65,9 @@ using namespace CodePaster;
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
CodepasterPlugin::CodepasterPlugin() : m_settings(new Settings)
|
CodepasterPlugin::CodepasterPlugin() :
|
||||||
|
m_settings(new Settings),
|
||||||
|
m_postEditorAction(0), m_postClipboardAction(0), m_fetchAction(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,9 +91,10 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m
|
|||||||
addAutoReleasedObject(settingsPage);
|
addAutoReleasedObject(settingsPage);
|
||||||
|
|
||||||
// Create the protocols and append them to the Settings
|
// Create the protocols and append them to the Settings
|
||||||
Protocol *protos[] = { new CodePasterProtocol(),
|
const QSharedPointer<NetworkAccessManagerProxy> networkAccessMgrProxy(new NetworkAccessManagerProxy);
|
||||||
new PasteBinDotComProtocol(),
|
Protocol *protos[] = { new CodePasterProtocol(networkAccessMgrProxy),
|
||||||
new PasteBinDotCaProtocol(),
|
new PasteBinDotComProtocol(networkAccessMgrProxy),
|
||||||
|
new PasteBinDotCaProtocol(networkAccessMgrProxy),
|
||||||
0};
|
0};
|
||||||
for(int i=0; protos[i] != 0; ++i) {
|
for(int i=0; protos[i] != 0; ++i) {
|
||||||
connect(protos[i], SIGNAL(pasteDone(QString)), this, SLOT(finishPost(QString)));
|
connect(protos[i], SIGNAL(pasteDone(QString)), this, SLOT(finishPost(QString)));
|
||||||
@@ -116,10 +119,15 @@ bool CodepasterPlugin::initialize(const QStringList &arguments, QString *error_m
|
|||||||
|
|
||||||
Core::Command *command;
|
Core::Command *command;
|
||||||
|
|
||||||
m_postAction = new QAction(tr("Paste Snippet..."), this);
|
m_postEditorAction = new QAction(tr("Paste Snippet..."), this);
|
||||||
command = actionManager->registerAction(m_postAction, "CodePaster.Post", globalcontext);
|
command = actionManager->registerAction(m_postEditorAction, "CodePaster.Post", globalcontext);
|
||||||
command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+P")));
|
command->setDefaultKeySequence(QKeySequence(tr("Alt+C,Alt+P")));
|
||||||
connect(m_postAction, SIGNAL(triggered()), this, SLOT(post()));
|
connect(m_postEditorAction, SIGNAL(triggered()), this, SLOT(postEditor()));
|
||||||
|
cpContainer->addAction(command);
|
||||||
|
|
||||||
|
m_postClipboardAction = new QAction(tr("Paste Clipboard..."), this);
|
||||||
|
command = actionManager->registerAction(m_postClipboardAction, "CodePaster.PostClipboard", globalcontext);
|
||||||
|
connect(m_postClipboardAction, SIGNAL(triggered()), this, SLOT(postClipboard()));
|
||||||
cpContainer->addAction(command);
|
cpContainer->addAction(command);
|
||||||
|
|
||||||
m_fetchAction = new QAction(tr("Fetch Snippet..."), this);
|
m_fetchAction = new QAction(tr("Fetch Snippet..."), this);
|
||||||
@@ -145,6 +153,28 @@ void CodepasterPlugin::shutdown()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodepasterPlugin::postEditor()
|
||||||
|
{
|
||||||
|
const IEditor* editor = EditorManager::instance()->currentEditor();
|
||||||
|
const BaseTextEditorEditable *textEditor = qobject_cast<const BaseTextEditorEditable *>(editor);
|
||||||
|
if (!textEditor)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QString data = textEditor->selectedText();
|
||||||
|
if (data.isEmpty())
|
||||||
|
data = textEditor->contents();
|
||||||
|
if (!data.isEmpty())
|
||||||
|
post(data, textEditor->editor()->mimeType());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodepasterPlugin::postClipboard()
|
||||||
|
{
|
||||||
|
QString subtype = QLatin1String("plain");
|
||||||
|
const QString text = qApp->clipboard()->text(subtype, QClipboard::Clipboard);
|
||||||
|
if (!text.isEmpty())
|
||||||
|
post(text, QString());
|
||||||
|
}
|
||||||
|
|
||||||
static inline void fixSpecialCharacters(QString &data)
|
static inline void fixSpecialCharacters(QString &data)
|
||||||
{
|
{
|
||||||
QChar *uc = data.data();
|
QChar *uc = data.data();
|
||||||
@@ -167,18 +197,8 @@ static inline void fixSpecialCharacters(QString &data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodepasterPlugin::post()
|
void CodepasterPlugin::post(QString data, const QString &mimeType)
|
||||||
{
|
{
|
||||||
const IEditor* editor = EditorManager::instance()->currentEditor();
|
|
||||||
const BaseTextEditorEditable *textEditor = qobject_cast<const BaseTextEditorEditable *>(editor);
|
|
||||||
if (!textEditor)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QString data = textEditor->selectedText();
|
|
||||||
if (data.isEmpty())
|
|
||||||
data = textEditor->contents();
|
|
||||||
if (data.isEmpty())
|
|
||||||
return;
|
|
||||||
fixSpecialCharacters(data);
|
fixSpecialCharacters(data);
|
||||||
FileDataList lst = splitDiffToFiles(data.toLatin1());
|
FileDataList lst = splitDiffToFiles(data.toLatin1());
|
||||||
QString username = m_settings->username;
|
QString username = m_settings->username;
|
||||||
@@ -199,7 +219,7 @@ void CodepasterPlugin::post()
|
|||||||
protocolName = view.protocol();
|
protocolName = view.protocol();
|
||||||
foreach(Protocol *protocol, m_protocols) {
|
foreach(Protocol *protocol, m_protocols) {
|
||||||
if (protocol->name() == protocolName) {
|
if (protocol->name() == protocolName) {
|
||||||
const Protocol::ContentType ct = Protocol::contentType(textEditor->editor()->mimeType());
|
const Protocol::ContentType ct = Protocol::contentType(mimeType);
|
||||||
protocol->paste(data, ct, username, comment, description);
|
protocol->paste(data, ct, username, comment, description);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ public:
|
|||||||
virtual void shutdown();
|
virtual void shutdown();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void post();
|
void postEditor();
|
||||||
|
void postClipboard();
|
||||||
void fetch();
|
void fetch();
|
||||||
void finishPost(const QString &link);
|
void finishPost(const QString &link);
|
||||||
void finishFetch(const QString &titleDescription,
|
void finishFetch(const QString &titleDescription,
|
||||||
@@ -66,8 +67,11 @@ public slots:
|
|||||||
bool error);
|
bool error);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void post(QString data, const QString &mimeType);
|
||||||
|
|
||||||
const QSharedPointer<Settings> m_settings;
|
const QSharedPointer<Settings> m_settings;
|
||||||
QAction *m_postAction;
|
QAction *m_postEditorAction;
|
||||||
|
QAction *m_postClipboardAction;
|
||||||
QAction *m_fetchAction;
|
QAction *m_fetchAction;
|
||||||
QList<Protocol*> m_protocols;
|
QList<Protocol*> m_protocols;
|
||||||
QStringList m_fetchedSnippets;
|
QStringList m_fetchedSnippets;
|
||||||
|
|||||||
@@ -32,11 +32,13 @@
|
|||||||
|
|
||||||
#include <QtNetwork/QNetworkReply>
|
#include <QtNetwork/QNetworkReply>
|
||||||
|
|
||||||
using namespace Core;
|
|
||||||
namespace CodePaster {
|
namespace CodePaster {
|
||||||
PasteBinDotCaProtocol::PasteBinDotCaProtocol()
|
PasteBinDotCaProtocol::PasteBinDotCaProtocol(const NetworkAccessManagerProxyPtr &nw) :
|
||||||
|
NetworkProtocol(nw),
|
||||||
|
m_fetchReply(0),
|
||||||
|
m_postId(-1)
|
||||||
{
|
{
|
||||||
connect(&http, SIGNAL(requestFinished(int,bool)),
|
connect(&m_http, SIGNAL(requestFinished(int,bool)),
|
||||||
this, SLOT(postRequestFinished(int,bool)));
|
this, SLOT(postRequestFinished(int,bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,12 +46,9 @@ void PasteBinDotCaProtocol::fetch(const QString &id)
|
|||||||
{
|
{
|
||||||
QString link = QLatin1String("http://pastebin.ca/raw/");
|
QString link = QLatin1String("http://pastebin.ca/raw/");
|
||||||
link.append(id);
|
link.append(id);
|
||||||
QUrl url(link);
|
m_fetchReply = httpGet(link);
|
||||||
QNetworkRequest r(url);
|
connect(m_fetchReply, SIGNAL(finished()), this, SLOT(fetchFinished()));
|
||||||
|
m_fetchId = id;
|
||||||
reply = manager.get(r);
|
|
||||||
connect(reply, SIGNAL(finished()), this, SLOT(fetchFinished()));
|
|
||||||
fetchId = id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasteBinDotCaProtocol::paste(const QString &text,
|
void PasteBinDotCaProtocol::paste(const QString &text,
|
||||||
@@ -69,20 +68,20 @@ void PasteBinDotCaProtocol::paste(const QString &text,
|
|||||||
QHttpRequestHeader header("POST", "/quiet-paste.php");
|
QHttpRequestHeader header("POST", "/quiet-paste.php");
|
||||||
header.setValue("host", "pastebin.ca" );
|
header.setValue("host", "pastebin.ca" );
|
||||||
header.setContentType("application/x-www-form-urlencoded");
|
header.setContentType("application/x-www-form-urlencoded");
|
||||||
http.setHost("pastebin.ca", QHttp::ConnectionModeHttp);
|
m_http.setHost("pastebin.ca", QHttp::ConnectionModeHttp);
|
||||||
header.setValue("User-Agent", "CreatorPastebin");
|
header.setValue("User-Agent", "CreatorPastebin");
|
||||||
postId = http.request(header, data.toAscii());
|
m_postId = m_http.request(header, data.toAscii());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasteBinDotCaProtocol::postRequestFinished(int id, bool error)
|
void PasteBinDotCaProtocol::postRequestFinished(int id, bool error)
|
||||||
{
|
{
|
||||||
QString link;
|
QString link;
|
||||||
if (id == postId) {
|
if (id == m_postId) {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
QByteArray data = http.readAll();
|
QByteArray data = m_http.readAll();
|
||||||
link = QString::fromLatin1("http://pastebin.ca/") + QString(data).remove("SUCCESS:");
|
link = QString::fromLatin1("http://pastebin.ca/") + QString(data).remove("SUCCESS:");
|
||||||
} else
|
} else
|
||||||
link = http.errorString();
|
link = m_http.errorString();
|
||||||
emit pasteDone(link);
|
emit pasteDone(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,15 +90,15 @@ void PasteBinDotCaProtocol::fetchFinished()
|
|||||||
{
|
{
|
||||||
QString title;
|
QString title;
|
||||||
QString content;
|
QString content;
|
||||||
bool error = reply->error();
|
bool error = m_fetchReply->error();
|
||||||
if (error) {
|
if (error) {
|
||||||
content = reply->errorString();
|
content = m_fetchReply->errorString();
|
||||||
} else {
|
} else {
|
||||||
title = QString::fromLatin1("Pastebin.ca: %1").arg(fetchId);
|
title = QString::fromLatin1("Pastebin.ca: %1").arg(m_fetchId);
|
||||||
content = reply->readAll();
|
content = m_fetchReply->readAll();
|
||||||
}
|
}
|
||||||
reply->deleteLater();
|
m_fetchReply->deleteLater();
|
||||||
reply = 0;
|
m_fetchReply = 0;
|
||||||
emit fetchDone(title, content, error);
|
emit fetchDone(title, content, error);
|
||||||
}
|
}
|
||||||
} // namespace CodePaster
|
} // namespace CodePaster
|
||||||
|
|||||||
@@ -32,15 +32,14 @@
|
|||||||
|
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
#include <QtNetwork/QNetworkAccessManager>
|
|
||||||
#include <QtNetwork/QHttp>
|
#include <QtNetwork/QHttp>
|
||||||
|
|
||||||
namespace CodePaster {
|
namespace CodePaster {
|
||||||
class PasteBinDotCaProtocol : public Protocol
|
class PasteBinDotCaProtocol : public NetworkProtocol
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PasteBinDotCaProtocol();
|
explicit PasteBinDotCaProtocol(const NetworkAccessManagerProxyPtr &nw);
|
||||||
QString name() const { return QLatin1String("Pastebin.Ca"); }
|
QString name() const { return QLatin1String("Pastebin.Ca"); }
|
||||||
|
|
||||||
bool hasSettings() const { return false; }
|
bool hasSettings() const { return false; }
|
||||||
@@ -58,12 +57,11 @@ public slots:
|
|||||||
void postRequestFinished(int id, bool error);
|
void postRequestFinished(int id, bool error);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QNetworkAccessManager manager;
|
QNetworkReply *m_fetchReply;
|
||||||
QNetworkReply *reply;
|
QString m_fetchId;
|
||||||
QString fetchId;
|
|
||||||
|
|
||||||
QHttp http;
|
QHttp m_http;
|
||||||
int postId;
|
int m_postId;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CodePaster
|
} // namespace CodePaster
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
#include <QtCore/QTextStream>
|
#include <QtCore/QTextStream>
|
||||||
#include <QtCore/QXmlStreamReader>
|
#include <QtCore/QXmlStreamReader>
|
||||||
#include <QtCore/QXmlStreamAttributes>
|
#include <QtCore/QXmlStreamAttributes>
|
||||||
|
#include <QtCore/QByteArray>
|
||||||
|
|
||||||
#include <QtNetwork/QNetworkReply>
|
#include <QtNetwork/QNetworkReply>
|
||||||
|
|
||||||
@@ -47,7 +48,8 @@ static const char pastePhpScriptpC[] = "api_public.php";
|
|||||||
static const char fetchPhpScriptpC[] = "raw.php";
|
static const char fetchPhpScriptpC[] = "raw.php";
|
||||||
|
|
||||||
namespace CodePaster {
|
namespace CodePaster {
|
||||||
PasteBinDotComProtocol::PasteBinDotComProtocol() :
|
PasteBinDotComProtocol::PasteBinDotComProtocol(const NetworkAccessManagerProxyPtr &nw) :
|
||||||
|
NetworkProtocol(nw),
|
||||||
m_settings(new PasteBinDotComSettings),
|
m_settings(new PasteBinDotComSettings),
|
||||||
m_fetchReply(0),
|
m_fetchReply(0),
|
||||||
m_pasteReply(0),
|
m_pasteReply(0),
|
||||||
@@ -105,31 +107,29 @@ void PasteBinDotComProtocol::paste(const QString &text,
|
|||||||
QTC_ASSERT(!m_pasteReply, return;)
|
QTC_ASSERT(!m_pasteReply, return;)
|
||||||
|
|
||||||
// Format body
|
// Format body
|
||||||
m_pasteData = format(ct);
|
QByteArray pasteData = format(ct);
|
||||||
if (!m_pasteData.isEmpty())
|
if (!pasteData.isEmpty())
|
||||||
m_pasteData.append('&');
|
pasteData.append('&');
|
||||||
m_pasteData += "paste_name=";
|
pasteData += "paste_name=";
|
||||||
m_pasteData += QUrl::toPercentEncoding(username);
|
pasteData += QUrl::toPercentEncoding(username);
|
||||||
|
|
||||||
const QString subDomain = m_settings->hostPrefix();
|
const QString subDomain = m_settings->hostPrefix();
|
||||||
if (!subDomain.isEmpty()) {
|
if (!subDomain.isEmpty()) {
|
||||||
m_pasteData += "&paste_subdomain=";
|
pasteData += "&paste_subdomain=";
|
||||||
m_pasteData += QUrl::toPercentEncoding(subDomain);
|
pasteData += QUrl::toPercentEncoding(subDomain);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pasteData += "&paste_code=";
|
pasteData += "&paste_code=";
|
||||||
m_pasteData += QUrl::toPercentEncoding(fixNewLines(text));
|
pasteData += QUrl::toPercentEncoding(fixNewLines(text));
|
||||||
|
|
||||||
// fire request
|
// fire request
|
||||||
QString link;
|
QString link;
|
||||||
QTextStream(&link) << "http://" << hostName(false) << '/' << pastePhpScriptpC;
|
QTextStream(&link) << "http://" << hostName(false) << '/' << pastePhpScriptpC;
|
||||||
|
|
||||||
QUrl url(link);
|
m_pasteReply = httpPost(link, pasteData);
|
||||||
QNetworkRequest r(url);
|
|
||||||
m_pasteReply = m_manager.post(r, m_pasteData);
|
|
||||||
connect(m_pasteReply, SIGNAL(finished()), this, SLOT(pasteFinished()));
|
connect(m_pasteReply, SIGNAL(finished()), this, SLOT(pasteFinished()));
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "paste: sending " << m_pasteReply << link << m_pasteData;
|
qDebug() << "paste: sending " << m_pasteReply << link << pasteData;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasteBinDotComProtocol::pasteFinished()
|
void PasteBinDotComProtocol::pasteFinished()
|
||||||
@@ -164,10 +164,8 @@ void PasteBinDotComProtocol::fetch(const QString &id)
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "fetch: sending " << link;
|
qDebug() << "fetch: sending " << link;
|
||||||
QUrl url(link);
|
|
||||||
QNetworkRequest r(url);
|
|
||||||
|
|
||||||
m_fetchReply = m_manager.get(r);
|
m_fetchReply = httpGet(link);
|
||||||
connect(m_fetchReply, SIGNAL(finished()), this, SLOT(fetchFinished()));
|
connect(m_fetchReply, SIGNAL(finished()), this, SLOT(fetchFinished()));
|
||||||
m_fetchId = id;
|
m_fetchId = id;
|
||||||
}
|
}
|
||||||
@@ -212,9 +210,7 @@ void PasteBinDotComProtocol::list()
|
|||||||
QTC_ASSERT(!m_listReply, return;)
|
QTC_ASSERT(!m_listReply, return;)
|
||||||
|
|
||||||
// fire request
|
// fire request
|
||||||
QUrl url(QLatin1String("http://") + hostName(true));
|
m_listReply = httpGet(QLatin1String("http://") + hostName(true));
|
||||||
QNetworkRequest r(url);
|
|
||||||
m_listReply = m_manager.get(r);
|
|
||||||
connect(m_listReply, SIGNAL(finished()), this, SLOT(listFinished()));
|
connect(m_listReply, SIGNAL(finished()), this, SLOT(listFinished()));
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "list: sending " << m_listReply;
|
qDebug() << "list: sending " << m_listReply;
|
||||||
|
|||||||
@@ -32,19 +32,14 @@
|
|||||||
|
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
#include <QtNetwork/QNetworkAccessManager>
|
|
||||||
#include <QtNetwork/QHttp>
|
|
||||||
|
|
||||||
#include <QtCore/QByteArray>
|
|
||||||
|
|
||||||
namespace CodePaster {
|
namespace CodePaster {
|
||||||
class PasteBinDotComSettings;
|
class PasteBinDotComSettings;
|
||||||
|
|
||||||
class PasteBinDotComProtocol : public Protocol
|
class PasteBinDotComProtocol : public NetworkProtocol
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
PasteBinDotComProtocol();
|
explicit PasteBinDotComProtocol(const NetworkAccessManagerProxyPtr &nw);
|
||||||
|
|
||||||
QString name() const { return QLatin1String("Pastebin.Com"); }
|
QString name() const { return QLatin1String("Pastebin.Com"); }
|
||||||
|
|
||||||
@@ -69,11 +64,9 @@ private:
|
|||||||
QString hostName(bool withSubDomain) const;
|
QString hostName(bool withSubDomain) const;
|
||||||
|
|
||||||
PasteBinDotComSettings *m_settings;
|
PasteBinDotComSettings *m_settings;
|
||||||
QNetworkAccessManager m_manager;
|
|
||||||
QNetworkReply *m_fetchReply;
|
QNetworkReply *m_fetchReply;
|
||||||
QNetworkReply *m_pasteReply;
|
QNetworkReply *m_pasteReply;
|
||||||
QNetworkReply *m_listReply;
|
QNetworkReply *m_listReply;
|
||||||
QByteArray m_pasteData;
|
|
||||||
|
|
||||||
QString m_fetchId;
|
QString m_fetchId;
|
||||||
int m_postId;
|
int m_postId;
|
||||||
|
|||||||
@@ -31,6 +31,11 @@
|
|||||||
#include <cpptools/cpptoolsconstants.h>
|
#include <cpptools/cpptoolsconstants.h>
|
||||||
#include <qmljseditor/qmljseditorconstants.h>
|
#include <qmljseditor/qmljseditorconstants.h>
|
||||||
|
|
||||||
|
#include <QtNetwork/QNetworkAccessManager>
|
||||||
|
#include <QtNetwork/QNetworkRequest>
|
||||||
|
|
||||||
|
#include <QtCore/QUrl>
|
||||||
|
|
||||||
namespace CodePaster {
|
namespace CodePaster {
|
||||||
|
|
||||||
Protocol::Protocol()
|
Protocol::Protocol()
|
||||||
@@ -108,4 +113,46 @@ QString Protocol::textFromHtml(QString data)
|
|||||||
data.replace(QLatin1String("&"), QString(QLatin1Char('&')));
|
data.replace(QLatin1String("&"), QString(QLatin1Char('&')));
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------ NetworkAccessManagerProxy
|
||||||
|
NetworkAccessManagerProxy::NetworkAccessManagerProxy()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
NetworkAccessManagerProxy::~NetworkAccessManagerProxy()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QNetworkReply *NetworkAccessManagerProxy::httpGet(const QString &link)
|
||||||
|
{
|
||||||
|
QUrl url(link);
|
||||||
|
QNetworkRequest r(url);
|
||||||
|
return networkAccessManager()->get(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
QNetworkReply *NetworkAccessManagerProxy::httpPost(const QString &link, const QByteArray &data)
|
||||||
|
{
|
||||||
|
QUrl url(link);
|
||||||
|
QNetworkRequest r(url);
|
||||||
|
return networkAccessManager()->post(r, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
QNetworkAccessManager *NetworkAccessManagerProxy::networkAccessManager()
|
||||||
|
{
|
||||||
|
if (m_networkAccessManager.isNull())
|
||||||
|
m_networkAccessManager.reset(new QNetworkAccessManager);
|
||||||
|
return m_networkAccessManager.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
// --------- NetworkProtocol
|
||||||
|
|
||||||
|
NetworkProtocol::NetworkProtocol(const NetworkAccessManagerProxyPtr &nw) :
|
||||||
|
m_networkAccessManager(nw)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
NetworkProtocol::~NetworkProtocol()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
} //namespace CodePaster
|
} //namespace CodePaster
|
||||||
|
|||||||
@@ -31,6 +31,13 @@
|
|||||||
#define PROTOCOL_H
|
#define PROTOCOL_H
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QScopedPointer>
|
||||||
|
#include <QtCore/QSharedPointer>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QNetworkAccessManager;
|
||||||
|
class QNetworkReply;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class IOptionsPage;
|
class IOptionsPage;
|
||||||
@@ -50,7 +57,7 @@ public:
|
|||||||
PostCommentCapability = 0x2,
|
PostCommentCapability = 0x2,
|
||||||
PostDescriptionCapability = 0x4
|
PostDescriptionCapability = 0x4
|
||||||
};
|
};
|
||||||
Protocol();
|
|
||||||
virtual ~Protocol();
|
virtual ~Protocol();
|
||||||
|
|
||||||
virtual QString name() const = 0;
|
virtual QString name() const = 0;
|
||||||
@@ -82,9 +89,54 @@ signals:
|
|||||||
void listDone(const QString &name, const QStringList &result);
|
void listDone(const QString &name, const QStringList &result);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Protocol();
|
||||||
static QString textFromHtml(QString data);
|
static QString textFromHtml(QString data);
|
||||||
static QString fixNewLines(QString in);
|
static QString fixNewLines(QString in);
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Proxy for NetworkAccessManager that can be shared with
|
||||||
|
* delayed initialization and conveniences
|
||||||
|
* for HTTP-requests. */
|
||||||
|
|
||||||
|
class NetworkAccessManagerProxy {
|
||||||
|
Q_DISABLE_COPY(NetworkAccessManagerProxy)
|
||||||
|
public:
|
||||||
|
NetworkAccessManagerProxy();
|
||||||
|
~NetworkAccessManagerProxy();
|
||||||
|
|
||||||
|
QNetworkReply *httpGet(const QString &url);
|
||||||
|
QNetworkReply *httpPost(const QString &link, const QByteArray &data);
|
||||||
|
QNetworkAccessManager *networkAccessManager();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QScopedPointer<QNetworkAccessManager> m_networkAccessManager;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Network-based protocol: Provides access with delayed
|
||||||
|
* initialization to a QNetworkAccessManager and conveniences
|
||||||
|
* for HTTP-requests. */
|
||||||
|
|
||||||
|
class NetworkProtocol : public Protocol {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
virtual ~NetworkProtocol();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
typedef QSharedPointer<NetworkAccessManagerProxy> NetworkAccessManagerProxyPtr;
|
||||||
|
|
||||||
|
explicit NetworkProtocol(const NetworkAccessManagerProxyPtr &nw);
|
||||||
|
|
||||||
|
inline QNetworkReply *httpGet(const QString &url)
|
||||||
|
{ return m_networkAccessManager->httpGet(url); }
|
||||||
|
|
||||||
|
inline QNetworkReply *httpPost(const QString &link, const QByteArray &data)
|
||||||
|
{ return m_networkAccessManager->httpPost(link, data); }
|
||||||
|
|
||||||
|
inline QNetworkAccessManager *networkAccessManager()
|
||||||
|
{ return m_networkAccessManager->networkAccessManager(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
const NetworkAccessManagerProxyPtr m_networkAccessManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
} //namespace CodePaster
|
} //namespace CodePaster
|
||||||
|
|||||||
@@ -615,8 +615,11 @@ void GdbEngine::handleResponse(const QByteArray &buff)
|
|||||||
void GdbEngine::readGdbStandardError()
|
void GdbEngine::readGdbStandardError()
|
||||||
{
|
{
|
||||||
QByteArray err = m_gdbProc.readAllStandardError();
|
QByteArray err = m_gdbProc.readAllStandardError();
|
||||||
|
debugMessage(_("UNEXPECTED GDB STDERR: " + err));
|
||||||
if (err == "Undefined command: \"bb\". Try \"help\".\n")
|
if (err == "Undefined command: \"bb\". Try \"help\".\n")
|
||||||
return;
|
return;
|
||||||
|
if (err.startsWith("BFD: reopening"))
|
||||||
|
return;
|
||||||
qWarning() << "Unexpected gdb stderr:" << err;
|
qWarning() << "Unexpected gdb stderr:" << err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1650,12 +1653,21 @@ void GdbEngine::handleInferiorShutdown(const GdbResponse &response)
|
|||||||
if (response.resultClass == GdbResultDone) {
|
if (response.resultClass == GdbResultDone) {
|
||||||
debugMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
|
debugMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
|
||||||
setState(InferiorShutDown);
|
setState(InferiorShutDown);
|
||||||
|
} else {
|
||||||
|
QByteArray ba = response.data.findChild("msg").data();
|
||||||
|
if (ba.contains(": No such file or directory.")) {
|
||||||
|
// This happens when someone removed the binary behind our back.
|
||||||
|
// It is not really an error from a user's point of view.
|
||||||
|
debugMessage(_("INFERIOR SUCCESSFULLY SHUT DOWN"));
|
||||||
|
debugMessage(_("NOTE: " + ba));
|
||||||
|
setState(InferiorShutDown);
|
||||||
} else {
|
} else {
|
||||||
debugMessage(_("INFERIOR SHUTDOWN FAILED"));
|
debugMessage(_("INFERIOR SHUTDOWN FAILED"));
|
||||||
setState(InferiorShutdownFailed);
|
setState(InferiorShutdownFailed);
|
||||||
QString msg = m_gdbAdapter->msgInferiorStopFailed(
|
showMessageBox(QMessageBox::Critical,
|
||||||
QString::fromLocal8Bit(response.data.findChild("msg").data()));
|
tr("Failed to shut down application"),
|
||||||
showMessageBox(QMessageBox::Critical, tr("Failed to shut down application"), msg);
|
m_gdbAdapter->msgInferiorStopFailed(QString::fromLocal8Bit(ba)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
shutdown(); // re-iterate...
|
shutdown(); // re-iterate...
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
#include "outputparser_test.h"
|
#include "outputparser_test.h"
|
||||||
|
|
||||||
|
#if defined(WITH_TESTS)
|
||||||
|
|
||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -132,7 +134,6 @@ void OutputParserTester::stdError(const QString &line)
|
|||||||
void OutputParserTester::appendOutputParser(IOutputParser *parser)
|
void OutputParserTester::appendOutputParser(IOutputParser *parser)
|
||||||
{
|
{
|
||||||
Q_ASSERT(!childParser());
|
Q_ASSERT(!childParser());
|
||||||
Q_ASSERT(!parser->childParser());
|
|
||||||
|
|
||||||
IOutputParser::appendOutputParser(parser);
|
IOutputParser::appendOutputParser(parser);
|
||||||
parser->appendOutputParser(this);
|
parser->appendOutputParser(this);
|
||||||
@@ -157,3 +158,5 @@ void OutputParserTester::reset()
|
|||||||
m_receivedTasks.clear();
|
m_receivedTasks.clear();
|
||||||
m_receivedOutput = QString();
|
m_receivedOutput = QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -30,7 +30,10 @@
|
|||||||
#ifndef OUTPUTPARSER_TESTER_H
|
#ifndef OUTPUTPARSER_TESTER_H
|
||||||
#define OUTPUTPARSER_TESTER_H
|
#define OUTPUTPARSER_TESTER_H
|
||||||
|
|
||||||
|
#if defined(WITH_TESTS)
|
||||||
|
|
||||||
#include "projectexplorer_export.h"
|
#include "projectexplorer_export.h"
|
||||||
|
#include "metatypedeclarations.h"
|
||||||
#include "ioutputparser.h"
|
#include "ioutputparser.h"
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
@@ -86,4 +89,6 @@ private:
|
|||||||
|
|
||||||
Q_DECLARE_METATYPE(ProjectExplorer::OutputParserTester::Channel)
|
Q_DECLARE_METATYPE(ProjectExplorer::OutputParserTester::Channel)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // OUTPUTPARSER_TESTER_H
|
#endif // OUTPUTPARSER_TESTER_H
|
||||||
|
|||||||
@@ -114,6 +114,9 @@ void TargetSettingsPanelWidget::setupUi()
|
|||||||
connect(m_selector, SIGNAL(currentChanged(int,int)),
|
connect(m_selector, SIGNAL(currentChanged(int,int)),
|
||||||
this, SLOT(currentTargetChanged(int,int)));
|
this, SLOT(currentTargetChanged(int,int)));
|
||||||
|
|
||||||
|
// Save active target now as it will change when targets are added:
|
||||||
|
Target *activeTarget = m_project->activeTarget();
|
||||||
|
|
||||||
foreach (Target *t, m_project->targets())
|
foreach (Target *t, m_project->targets())
|
||||||
targetAdded(t);
|
targetAdded(t);
|
||||||
|
|
||||||
@@ -122,11 +125,10 @@ void TargetSettingsPanelWidget::setupUi()
|
|||||||
connect(m_selector, SIGNAL(removeButtonClicked()),
|
connect(m_selector, SIGNAL(removeButtonClicked()),
|
||||||
this, SLOT(removeTarget()));
|
this, SLOT(removeTarget()));
|
||||||
|
|
||||||
if (m_project->activeTarget()) {
|
|
||||||
m_selector->setCurrentIndex(m_targets.indexOf(m_project->activeTarget()));
|
|
||||||
}
|
|
||||||
|
|
||||||
updateTargetAddAndRemoveButtons();
|
updateTargetAddAndRemoveButtons();
|
||||||
|
|
||||||
|
// Restore target originally set:
|
||||||
|
m_project->setActiveTarget(activeTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subIndex)
|
void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subIndex)
|
||||||
@@ -136,6 +138,16 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
|
|||||||
if (subIndex < -1 || subIndex >= 2)
|
if (subIndex < -1 || subIndex >= 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (targetIndex == -1 || subIndex == -1) { // no more targets!
|
||||||
|
delete m_panelWidgets[0];
|
||||||
|
m_panelWidgets[0] = 0;
|
||||||
|
delete m_panelWidgets[1];
|
||||||
|
m_panelWidgets[1] = 0;
|
||||||
|
|
||||||
|
m_centralWidget->setCurrentWidget(m_noTargetLabel);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Target *target = m_targets.at(targetIndex);
|
Target *target = m_targets.at(targetIndex);
|
||||||
|
|
||||||
// Target was not actually changed:
|
// Target was not actually changed:
|
||||||
@@ -147,13 +159,8 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_currentTarget = target;
|
|
||||||
|
|
||||||
// Target has changed:
|
// Target has changed:
|
||||||
if (targetIndex == -1) { // no more targets!
|
m_currentTarget = target;
|
||||||
m_centralWidget->setCurrentWidget(m_noTargetLabel);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PanelsWidget *buildPanel = new PanelsWidget(m_centralWidget);
|
PanelsWidget *buildPanel = new PanelsWidget(m_centralWidget);
|
||||||
PanelsWidget *runPanel = new PanelsWidget(m_centralWidget);
|
PanelsWidget *runPanel = new PanelsWidget(m_centralWidget);
|
||||||
|
|||||||
@@ -63,10 +63,13 @@ QVariant read(const QString &typeStr, const QString &str, const MetaInfo &metaIn
|
|||||||
QVariant read(const QString &typeStr, const QString &str)
|
QVariant read(const QString &typeStr, const QString &str)
|
||||||
{
|
{
|
||||||
int type = QMetaType::type(typeStr.toAscii().constData());
|
int type = QMetaType::type(typeStr.toAscii().constData());
|
||||||
if (type == 0)
|
if (type == 0) {
|
||||||
qWarning() << "Type " << typeStr
|
qWarning() << "Type " << typeStr
|
||||||
<< " is unknown to QMetaType system. Cannot create properly typed QVariant for value "
|
<< " is unknown to QMetaType system. Cannot create properly typed QVariant for value "
|
||||||
<< str;
|
<< str;
|
||||||
|
// Fall back to a QVariant of type String
|
||||||
|
return QVariant(str);
|
||||||
|
}
|
||||||
return read(type, str);
|
return read(type, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,9 +111,9 @@ QVariant read(int variantType, const QString &str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!conversionOk) {
|
if (!conversionOk) {
|
||||||
value = QVariant();
|
|
||||||
qWarning() << "Could not convert" << str
|
qWarning() << "Could not convert" << str
|
||||||
<< "to" << QMetaType::typeName(variantType);
|
<< "to" << QMetaType::typeName(variantType);
|
||||||
|
value = QVariant(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -538,7 +538,7 @@ void RewriterView::qmlTextChanged()
|
|||||||
default: {
|
default: {
|
||||||
emitCustomNotification(StartRewriterAmend);
|
emitCustomNotification(StartRewriterAmend);
|
||||||
ModelAmender differenceHandler(m_textToModelMerger.data());
|
ModelAmender differenceHandler(m_textToModelMerger.data());
|
||||||
if (m_textToModelMerger->load(newQmlText.toUtf8(), differenceHandler)) {
|
if (m_textToModelMerger->load(newQmlText, differenceHandler)) {
|
||||||
lastCorrectQmlSource = newQmlText;
|
lastCorrectQmlSource = newQmlText;
|
||||||
}
|
}
|
||||||
emitCustomNotification(EndRewriterAmend);
|
emitCustomNotification(EndRewriterAmend);
|
||||||
|
|||||||
@@ -255,8 +255,10 @@ void TextToModelMerger::setupImports(const Document::Ptr &doc,
|
|||||||
differenceHandler.importAbsentInQMl(import);
|
differenceHandler.importAbsentInQMl(import);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TextToModelMerger::load(const QByteArray &data, DifferenceHandler &differenceHandler)
|
bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceHandler)
|
||||||
{
|
{
|
||||||
|
// qDebug() << "TextToModelMerger::load with data:" << data;
|
||||||
|
|
||||||
const QUrl url = m_rewriterView->model()->fileUrl();
|
const QUrl url = m_rewriterView->model()->fileUrl();
|
||||||
const QStringList importPaths = m_rewriterView->textModifier()->importPaths();
|
const QStringList importPaths = m_rewriterView->textModifier()->importPaths();
|
||||||
setActive(true);
|
setActive(true);
|
||||||
@@ -266,7 +268,7 @@ bool TextToModelMerger::load(const QByteArray &data, DifferenceHandler &differen
|
|||||||
foreach (const QString &importPath, importPaths)
|
foreach (const QString &importPath, importPaths)
|
||||||
engine.addImportPath(importPath);
|
engine.addImportPath(importPath);
|
||||||
QDeclarativeComponent comp(&engine);
|
QDeclarativeComponent comp(&engine);
|
||||||
comp.setData(data, url);
|
comp.setData(data.toUtf8(), url);
|
||||||
if (comp.status() == QDeclarativeComponent::Error) {
|
if (comp.status() == QDeclarativeComponent::Error) {
|
||||||
QList<RewriterView::Error> errors;
|
QList<RewriterView::Error> errors;
|
||||||
foreach (const QDeclarativeError &error, comp.errors())
|
foreach (const QDeclarativeError &error, comp.errors())
|
||||||
@@ -288,7 +290,7 @@ bool TextToModelMerger::load(const QByteArray &data, DifferenceHandler &differen
|
|||||||
Snapshot snapshot = m_rewriterView->textModifier()->getSnapshot();
|
Snapshot snapshot = m_rewriterView->textModifier()->getSnapshot();
|
||||||
const QString fileName = url.toLocalFile();
|
const QString fileName = url.toLocalFile();
|
||||||
Document::Ptr doc = Document::create(fileName.isEmpty() ? QLatin1String("<internal>") : fileName);
|
Document::Ptr doc = Document::create(fileName.isEmpty() ? QLatin1String("<internal>") : fileName);
|
||||||
doc->setSource(QString::fromUtf8(data.constData()));
|
doc->setSource(data);
|
||||||
doc->parseQml();
|
doc->parseQml();
|
||||||
snapshot.insert(doc);
|
snapshot.insert(doc);
|
||||||
ReadingContext ctxt(snapshot, doc, importPaths);
|
ReadingContext ctxt(snapshot, doc, importPaths);
|
||||||
@@ -671,7 +673,14 @@ QVariant TextToModelMerger::convertToVariant(const ModelNode &node,
|
|||||||
const PropertyMetaInfo propertyMetaInfo = nodeMetaInfo.property(astName, true);
|
const PropertyMetaInfo propertyMetaInfo = nodeMetaInfo.property(astName, true);
|
||||||
|
|
||||||
if (propertyMetaInfo.isValid()) {
|
if (propertyMetaInfo.isValid()) {
|
||||||
return Internal::PropertyParser::read(propertyMetaInfo.variantTypeId(), cleanedValue);
|
QVariant::Type type = propertyMetaInfo.variantTypeId();
|
||||||
|
if (type == QVariant::Invalid) {
|
||||||
|
const QString propType = propertyMetaInfo.type();
|
||||||
|
// qDebug() << "converting" << cleanedValue << "to" << propType;
|
||||||
|
return Internal::PropertyParser::read(propType, cleanedValue, node.metaInfo().metaInfo());
|
||||||
|
} else {
|
||||||
|
return Internal::PropertyParser::read(type, cleanedValue);
|
||||||
|
}
|
||||||
} else if (node.type() == QLatin1String("Qt/PropertyChanges")) {
|
} else if (node.type() == QLatin1String("Qt/PropertyChanges")) {
|
||||||
// In the future, we should do the type resolving in a second pass, or delay setting properties until the full file has been parsed.
|
// In the future, we should do the type resolving in a second pass, or delay setting properties until the full file has been parsed.
|
||||||
return QVariant(cleanedValue);
|
return QVariant(cleanedValue);
|
||||||
@@ -827,6 +836,10 @@ void ModelAmender::shouldBeNodeListProperty(AbstractProperty &modelProperty,
|
|||||||
|
|
||||||
void ModelAmender::variantValuesDiffer(VariantProperty &modelProperty, const QVariant &qmlVariantValue, const QString &dynamicType)
|
void ModelAmender::variantValuesDiffer(VariantProperty &modelProperty, const QVariant &qmlVariantValue, const QString &dynamicType)
|
||||||
{
|
{
|
||||||
|
// qDebug()<< "ModelAmender::variantValuesDiffer for property"<<modelProperty.name()
|
||||||
|
// << "in node" << modelProperty.parentModelNode().id()
|
||||||
|
// << ", old value:" << modelProperty.value()
|
||||||
|
// << "new value:" << qmlVariantValue;
|
||||||
if (dynamicType.isEmpty())
|
if (dynamicType.isEmpty())
|
||||||
modelProperty.setValue(qmlVariantValue);
|
modelProperty.setValue(qmlVariantValue);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
bool isActive() const;
|
bool isActive() const;
|
||||||
|
|
||||||
void setupImports(const QmlJS::Document::Ptr &doc, DifferenceHandler &differenceHandler);
|
void setupImports(const QmlJS::Document::Ptr &doc, DifferenceHandler &differenceHandler);
|
||||||
bool load(const QByteArray &data, DifferenceHandler &differenceHandler);
|
bool load(const QString &data, DifferenceHandler &differenceHandler);
|
||||||
|
|
||||||
RewriterView *view() const
|
RewriterView *view() const
|
||||||
{ return m_rewriterView; }
|
{ return m_rewriterView; }
|
||||||
|
|||||||
@@ -36,8 +36,10 @@
|
|||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QMap>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
class QTimer;
|
class QTimer;
|
||||||
class QFileSystemWatcher;
|
class QFileSystemWatcher;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace QmlProjectManager {
|
namespace QmlProjectManager {
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ CustomWidgetWizardDialog::CustomWidgetWizardDialog(const QString &templateName,
|
|||||||
setIntroDescription(tr("This wizard generates a Qt4 Designer Custom Widget "
|
setIntroDescription(tr("This wizard generates a Qt4 Designer Custom Widget "
|
||||||
"or a Qt4 Designer Custom Widget Collection project."));
|
"or a Qt4 Designer Custom Widget Collection project."));
|
||||||
|
|
||||||
addTargetsPage(BaseQt4ProjectWizardDialog::desktopTarget());
|
addTargetSetupPage(BaseQt4ProjectWizardDialog::desktopTarget());
|
||||||
m_widgetPageId = addPage(m_widgetsPage);
|
m_widgetPageId = addPage(m_widgetsPage);
|
||||||
m_pluginPageId = addPage(m_pluginPage);
|
m_pluginPageId = addPage(m_pluginPage);
|
||||||
|
|
||||||
|
|||||||
@@ -174,3 +174,53 @@ void AbldParser::stdError(const QString &line)
|
|||||||
}
|
}
|
||||||
IOutputParser::stdError(line);
|
IOutputParser::stdError(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unit tests:
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
# include <QTest>
|
||||||
|
|
||||||
|
# include "qt4projectmanagerplugin.h"
|
||||||
|
|
||||||
|
# include "projectexplorer/outputparser_test.h"
|
||||||
|
|
||||||
|
using namespace Qt4ProjectManager::Internal;
|
||||||
|
|
||||||
|
void Qt4ProjectManagerPlugin::testAbldOutputParsers_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<QString>("input");
|
||||||
|
QTest::addColumn<OutputParserTester::Channel>("inputChannel");
|
||||||
|
QTest::addColumn<QString>("childStdOutLines");
|
||||||
|
QTest::addColumn<QString>("childStdErrLines");
|
||||||
|
QTest::addColumn<QList<ProjectExplorer::Task> >("tasks");
|
||||||
|
QTest::addColumn<QString>("outputLines");
|
||||||
|
|
||||||
|
|
||||||
|
QTest::newRow("pass-through stdout")
|
||||||
|
<< QString::fromLatin1("Sometext") << OutputParserTester::STDOUT
|
||||||
|
<< QString::fromLatin1("Sometext") << QString()
|
||||||
|
<< QList<ProjectExplorer::Task>()
|
||||||
|
<< QString();
|
||||||
|
QTest::newRow("pass-through stderr")
|
||||||
|
<< QString::fromLatin1("Sometext") << OutputParserTester::STDERR
|
||||||
|
<< QString() << QString::fromLatin1("Sometext")
|
||||||
|
<< QList<ProjectExplorer::Task>()
|
||||||
|
<< QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Qt4ProjectManagerPlugin::testAbldOutputParsers()
|
||||||
|
{
|
||||||
|
OutputParserTester testbench;
|
||||||
|
testbench.appendOutputParser(new AbldParser);
|
||||||
|
QFETCH(QString, input);
|
||||||
|
QFETCH(OutputParserTester::Channel, inputChannel);
|
||||||
|
QFETCH(QList<Task>, tasks);
|
||||||
|
QFETCH(QString, childStdOutLines);
|
||||||
|
QFETCH(QString, childStdErrLines);
|
||||||
|
QFETCH(QString, outputLines);
|
||||||
|
|
||||||
|
testbench.testParsing(input, inputChannel,
|
||||||
|
tasks, childStdOutLines, childStdErrLines,
|
||||||
|
outputLines);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ HEADERS += qt4projectmanagerplugin.h \
|
|||||||
wizards/modulespage.h \
|
wizards/modulespage.h \
|
||||||
wizards/filespage.h \
|
wizards/filespage.h \
|
||||||
wizards/qtwizard.h \
|
wizards/qtwizard.h \
|
||||||
wizards/targetspage.h \
|
|
||||||
wizards/targetsetuppage.h \
|
wizards/targetsetuppage.h \
|
||||||
qt4projectmanagerconstants.h \
|
qt4projectmanagerconstants.h \
|
||||||
makestep.h \
|
makestep.h \
|
||||||
@@ -69,7 +68,6 @@ SOURCES += qt4projectmanagerplugin.cpp \
|
|||||||
wizards/modulespage.cpp \
|
wizards/modulespage.cpp \
|
||||||
wizards/filespage.cpp \
|
wizards/filespage.cpp \
|
||||||
wizards/qtwizard.cpp \
|
wizards/qtwizard.cpp \
|
||||||
wizards/targetspage.cpp \
|
|
||||||
wizards/targetsetuppage.cpp \
|
wizards/targetsetuppage.cpp \
|
||||||
makestep.cpp \
|
makestep.cpp \
|
||||||
qmakestep.cpp \
|
qmakestep.cpp \
|
||||||
|
|||||||
@@ -266,11 +266,6 @@ void Qt4ProjectManagerPlugin::testBasicProjectLoading()
|
|||||||
QVERIFY(qt4project->rootProjectNode()->projectType() == ApplicationTemplate);
|
QVERIFY(qt4project->rootProjectNode()->projectType() == ApplicationTemplate);
|
||||||
QVERIFY(m_projectExplorer->currentProject() != 0);
|
QVERIFY(m_projectExplorer->currentProject() != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Qt4ProjectManagerPlugin::testNotYetImplemented()
|
|
||||||
{
|
|
||||||
QCOMPARE(1+1, 2);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN(Qt4ProjectManagerPlugin)
|
Q_EXPORT_PLUGIN(Qt4ProjectManagerPlugin)
|
||||||
|
|||||||
@@ -76,7 +76,9 @@ private slots:
|
|||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
void testBasicProjectLoading();
|
void testBasicProjectLoading();
|
||||||
void testNotYetImplemented();
|
|
||||||
|
void testAbldOutputParsers_data();
|
||||||
|
void testAbldOutputParsers();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ ConsoleAppWizardDialog::ConsoleAppWizardDialog(const QString &templateName,
|
|||||||
"provide a GUI."));
|
"provide a GUI."));
|
||||||
|
|
||||||
addModulesPage();
|
addModulesPage();
|
||||||
addTargetsPage();
|
addTargetSetupPage();
|
||||||
|
|
||||||
foreach (QWizardPage *p, extensionPages)
|
foreach (QWizardPage *p, extensionPages)
|
||||||
addPage(p);
|
addPage(p);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ EmptyProjectWizardDialog::EmptyProjectWizardDialog(const QString &templateName,
|
|||||||
setIntroDescription(tr("This wizard generates an empty Qt4 project. "
|
setIntroDescription(tr("This wizard generates an empty Qt4 project. "
|
||||||
"Add files to it later on by using the other wizards."));
|
"Add files to it later on by using the other wizards."));
|
||||||
|
|
||||||
addTargetsPage();
|
addTargetSetupPage();
|
||||||
|
|
||||||
foreach (QWizardPage *p, extensionPages)
|
foreach (QWizardPage *p, extensionPages)
|
||||||
addPage(p);
|
addPage(p);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ GuiAppWizardDialog::GuiAppWizardDialog(const QString &templateName,
|
|||||||
"and includes an empty widget."));
|
"and includes an empty widget."));
|
||||||
|
|
||||||
addModulesPage();
|
addModulesPage();
|
||||||
addTargetsPage();
|
addTargetSetupPage();
|
||||||
|
|
||||||
m_filesPage->setFormInputCheckable(true);
|
m_filesPage->setFormInputCheckable(true);
|
||||||
m_filesPage->setClassTypeComboVisible(false);
|
m_filesPage->setClassTypeComboVisible(false);
|
||||||
@@ -110,12 +110,11 @@ GuiAppParameters GuiAppWizardDialog::parameters() const
|
|||||||
rc.formFileName = m_filesPage->formFileName();
|
rc.formFileName = m_filesPage->formFileName();
|
||||||
rc.designerForm = m_filesPage->formInputChecked();
|
rc.designerForm = m_filesPage->formInputChecked();
|
||||||
rc.isMobileApplication = true;
|
rc.isMobileApplication = true;
|
||||||
QSet<QString> targets = selectedTargets();
|
if (isTargetSelected(QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))) {
|
||||||
if (targets.contains(QLatin1String(Constants::MAEMO_DEVICE_TARGET_ID))) {
|
|
||||||
rc.widgetWidth = 800;
|
rc.widgetWidth = 800;
|
||||||
rc.widgetHeight = 480;
|
rc.widgetHeight = 480;
|
||||||
} else if (targets.contains(QLatin1String(Constants::S60_DEVICE_TARGET_ID)) ||
|
} else if (isTargetSelected(QLatin1String(Constants::S60_DEVICE_TARGET_ID)) ||
|
||||||
targets.contains(QLatin1String(Constants::S60_EMULATOR_TARGET_ID))) {
|
isTargetSelected(QLatin1String(Constants::S60_EMULATOR_TARGET_ID))) {
|
||||||
rc.widgetWidth = 360;
|
rc.widgetWidth = 360;
|
||||||
rc.widgetHeight = 640;
|
rc.widgetHeight = 640;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ LibraryWizardDialog::LibraryWizardDialog(const QString &templateName,
|
|||||||
// Use the intro page instead, set up initially
|
// Use the intro page instead, set up initially
|
||||||
setIntroDescription(tr("This wizard generates a C++ library project."));
|
setIntroDescription(tr("This wizard generates a C++ library project."));
|
||||||
|
|
||||||
m_targetPageId = addTargetsPage();
|
m_targetPageId = addTargetSetupPage();
|
||||||
m_modulesPageId = addModulesPage();
|
m_modulesPageId = addModulesPage();
|
||||||
|
|
||||||
m_filesPage->setNamespacesEnabled(true);
|
m_filesPage->setNamespacesEnabled(true);
|
||||||
|
|||||||
@@ -30,10 +30,11 @@
|
|||||||
#include "qtwizard.h"
|
#include "qtwizard.h"
|
||||||
|
|
||||||
#include "qt4project.h"
|
#include "qt4project.h"
|
||||||
|
#include "qt4projectmanager.h"
|
||||||
#include "qt4projectmanagerconstants.h"
|
#include "qt4projectmanagerconstants.h"
|
||||||
#include "qt4target.h"
|
#include "qt4target.h"
|
||||||
#include "modulespage.h"
|
#include "modulespage.h"
|
||||||
#include "targetspage.h"
|
#include "targetsetuppage.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <cpptools/cpptoolsconstants.h>
|
#include <cpptools/cpptoolsconstants.h>
|
||||||
@@ -164,7 +165,7 @@ QWizard *CustomQt4ProjectWizard::createWizardDialog(QWidget *parent,
|
|||||||
initProjectWizardDialog(wizard, defaultPath, extensionPages);
|
initProjectWizardDialog(wizard, defaultPath, extensionPages);
|
||||||
if (wizard->pageIds().contains(targetPageId))
|
if (wizard->pageIds().contains(targetPageId))
|
||||||
qWarning("CustomQt4ProjectWizard: Unable to insert target page at %d", int(targetPageId));
|
qWarning("CustomQt4ProjectWizard: Unable to insert target page at %d", int(targetPageId));
|
||||||
wizard->addTargetsPage(QSet<QString>(), targetPageId);
|
wizard->addTargetSetupPage(QSet<QString>(), targetPageId);
|
||||||
return wizard;
|
return wizard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +183,7 @@ void CustomQt4ProjectWizard::registerSelf()
|
|||||||
BaseQt4ProjectWizardDialog::BaseQt4ProjectWizardDialog(bool showModulesPage, QWidget *parent) :
|
BaseQt4ProjectWizardDialog::BaseQt4ProjectWizardDialog(bool showModulesPage, QWidget *parent) :
|
||||||
ProjectExplorer::BaseProjectWizardDialog(parent),
|
ProjectExplorer::BaseProjectWizardDialog(parent),
|
||||||
m_modulesPage(0),
|
m_modulesPage(0),
|
||||||
m_targetsPage(0)
|
m_targetSetupPage(0)
|
||||||
{
|
{
|
||||||
init(showModulesPage);
|
init(showModulesPage);
|
||||||
}
|
}
|
||||||
@@ -192,15 +193,15 @@ BaseQt4ProjectWizardDialog::BaseQt4ProjectWizardDialog(bool showModulesPage,
|
|||||||
int introId, QWidget *parent) :
|
int introId, QWidget *parent) :
|
||||||
ProjectExplorer::BaseProjectWizardDialog(introPage, introId, parent),
|
ProjectExplorer::BaseProjectWizardDialog(introPage, introId, parent),
|
||||||
m_modulesPage(0),
|
m_modulesPage(0),
|
||||||
m_targetsPage(0)
|
m_targetSetupPage(0)
|
||||||
{
|
{
|
||||||
init(showModulesPage);
|
init(showModulesPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseQt4ProjectWizardDialog::~BaseQt4ProjectWizardDialog()
|
BaseQt4ProjectWizardDialog::~BaseQt4ProjectWizardDialog()
|
||||||
{
|
{
|
||||||
if (m_targetsPage && !m_targetsPage->parent())
|
if (m_targetSetupPage && !m_targetSetupPage->parent())
|
||||||
delete m_targetsPage;
|
delete m_targetSetupPage;
|
||||||
if (m_modulesPage && !m_modulesPage->parent())
|
if (m_modulesPage && !m_modulesPage->parent())
|
||||||
delete m_modulesPage;
|
delete m_modulesPage;
|
||||||
}
|
}
|
||||||
@@ -209,7 +210,6 @@ void BaseQt4ProjectWizardDialog::init(bool showModulesPage)
|
|||||||
{
|
{
|
||||||
if (showModulesPage)
|
if (showModulesPage)
|
||||||
m_modulesPage = new ModulesPage;
|
m_modulesPage = new ModulesPage;
|
||||||
m_targetsPage = new TargetsPage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int BaseQt4ProjectWizardDialog::addModulesPage(int id)
|
int BaseQt4ProjectWizardDialog::addModulesPage(int id)
|
||||||
@@ -223,18 +223,26 @@ int BaseQt4ProjectWizardDialog::addModulesPage(int id)
|
|||||||
return addPage(m_modulesPage);
|
return addPage(m_modulesPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BaseQt4ProjectWizardDialog::addTargetsPage(QSet<QString> targets, int id)
|
int BaseQt4ProjectWizardDialog::addTargetSetupPage(QSet<QString> targets, int id)
|
||||||
{
|
{
|
||||||
m_targetsPage->setValidTargets(targets);
|
m_targetSetupPage = new TargetSetupPage;
|
||||||
|
QList<TargetSetupPage::ImportInfo> infos = TargetSetupPage::importInfosForKnownQtVersions(0);
|
||||||
|
if (!targets.isEmpty())
|
||||||
|
infos = TargetSetupPage::filterImportInfos(targets, infos);
|
||||||
|
m_targetSetupPage->setImportDirectoryBrowsingEnabled(false);
|
||||||
|
m_targetSetupPage->setShowLocationInformation(false);
|
||||||
|
|
||||||
if (!m_targetsPage->needToDisplayPage())
|
if (infos.count() <= 1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (id >= 0) {
|
m_targetSetupPage->setImportInfos(infos);
|
||||||
setPage(id, m_targetsPage);
|
|
||||||
|
if (id >= 0)
|
||||||
|
setPage(id, m_targetSetupPage);
|
||||||
|
else
|
||||||
|
id = addPage(m_targetSetupPage);
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
|
||||||
return addPage(m_targetsPage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseQt4ProjectWizardDialog::selectedModules() const
|
QString BaseQt4ProjectWizardDialog::selectedModules() const
|
||||||
@@ -269,18 +277,30 @@ void BaseQt4ProjectWizardDialog::setDeselectedModules(const QString &modules)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseQt4ProjectWizardDialog::writeUserFile(const QString &proFileName) const
|
bool BaseQt4ProjectWizardDialog::writeUserFile(const QString &proFileName) const
|
||||||
{
|
{
|
||||||
if (m_targetsPage)
|
if (!m_targetSetupPage)
|
||||||
m_targetsPage->writeUserFile(proFileName);
|
return false;
|
||||||
|
|
||||||
|
Qt4Manager *manager = ExtensionSystem::PluginManager::instance()->getObject<Qt4Manager>();
|
||||||
|
Q_ASSERT(manager);
|
||||||
|
|
||||||
|
Qt4Project *pro = new Qt4Project(manager, proFileName);
|
||||||
|
bool success = m_targetSetupPage->setupProject(pro);
|
||||||
|
if (success)
|
||||||
|
pro->saveSettings();
|
||||||
|
delete pro;
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<QString> BaseQt4ProjectWizardDialog::selectedTargets() const
|
bool BaseQt4ProjectWizardDialog::setupProject(Qt4Project *project) const
|
||||||
{
|
{
|
||||||
QSet<QString> targets;
|
return m_targetSetupPage->setupProject(project);
|
||||||
if (m_targetsPage)
|
}
|
||||||
targets = m_targetsPage->selectedTargets();
|
|
||||||
return targets;
|
bool BaseQt4ProjectWizardDialog::isTargetSelected(const QString &targetid) const
|
||||||
|
{
|
||||||
|
return m_targetSetupPage->isTargetSelected(targetid);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<QString> BaseQt4ProjectWizardDialog::desktopTarget()
|
QSet<QString> BaseQt4ProjectWizardDialog::desktopTarget()
|
||||||
|
|||||||
@@ -39,10 +39,13 @@
|
|||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
|
|
||||||
|
class Qt4Project;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ModulesPage;
|
class ModulesPage;
|
||||||
class TargetsPage;
|
class TargetSetupPage;
|
||||||
|
|
||||||
/* Base class for wizard creating Qt projects using QtProjectParameters.
|
/* Base class for wizard creating Qt projects using QtProjectParameters.
|
||||||
* To implement a project wizard, overwrite:
|
* To implement a project wizard, overwrite:
|
||||||
@@ -125,7 +128,7 @@ public:
|
|||||||
virtual ~BaseQt4ProjectWizardDialog();
|
virtual ~BaseQt4ProjectWizardDialog();
|
||||||
|
|
||||||
int addModulesPage(int id = -1);
|
int addModulesPage(int id = -1);
|
||||||
int addTargetsPage(QSet<QString> targets = QSet<QString>(), int id = -1);
|
int addTargetSetupPage(QSet<QString> targets = QSet<QString>(), int id = -1);
|
||||||
|
|
||||||
static QSet<QString> desktopTarget();
|
static QSet<QString> desktopTarget();
|
||||||
|
|
||||||
@@ -135,14 +138,15 @@ public:
|
|||||||
QString deselectedModules() const;
|
QString deselectedModules() const;
|
||||||
void setDeselectedModules(const QString &);
|
void setDeselectedModules(const QString &);
|
||||||
|
|
||||||
void writeUserFile(const QString &proFileName) const;
|
bool writeUserFile(const QString &proFileName) const;
|
||||||
QSet<QString> selectedTargets() const;
|
bool setupProject(Qt4Project *project) const;
|
||||||
|
bool isTargetSelected(const QString &targetid) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline void init(bool showModulesPage);
|
inline void init(bool showModulesPage);
|
||||||
|
|
||||||
ModulesPage *m_modulesPage;
|
ModulesPage *m_modulesPage;
|
||||||
TargetsPage *m_targetsPage;
|
TargetSetupPage *m_targetSetupPage;
|
||||||
QString m_selectedModules;
|
QString m_selectedModules;
|
||||||
QString m_deselectedModules;
|
QString m_deselectedModules;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,213 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator
|
|
||||||
**
|
|
||||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
**
|
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
** Commercial Usage
|
|
||||||
**
|
|
||||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
||||||
** accordance with the Qt Commercial License Agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
**
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** If you are unsure which license is appropriate for your use, please
|
|
||||||
** contact the sales department at http://qt.nokia.com/contact.
|
|
||||||
**
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#include "targetspage.h"
|
|
||||||
|
|
||||||
#include "qt4projectmanager/qt4project.h"
|
|
||||||
#include "qt4projectmanager/qt4projectmanager.h"
|
|
||||||
#include "qt4projectmanager/qt4target.h"
|
|
||||||
#include "qt4projectmanager/qtversionmanager.h"
|
|
||||||
#include "qt4projectmanager/qt4projectmanagerconstants.h"
|
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
|
||||||
|
|
||||||
#include <QtCore/QSet>
|
|
||||||
#include <QtCore/QString>
|
|
||||||
|
|
||||||
#include <QtGui/QTreeWidget>
|
|
||||||
#include <QtGui/QLabel>
|
|
||||||
#include <QtGui/QLayout>
|
|
||||||
|
|
||||||
using namespace Qt4ProjectManager::Internal;
|
|
||||||
|
|
||||||
TargetsPage::TargetsPage(QWidget *parent)
|
|
||||||
: QWizardPage(parent)
|
|
||||||
{
|
|
||||||
setTitle(tr("Choose Qt versions"));
|
|
||||||
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
|
||||||
|
|
||||||
setTitle(tr("Select required Qt versions"));
|
|
||||||
QLabel *label = new QLabel(tr("Select the Qt versions to use in your project."), this);
|
|
||||||
label->setWordWrap(true);
|
|
||||||
vbox->addWidget(label);
|
|
||||||
|
|
||||||
m_treeWidget = new QTreeWidget(this);
|
|
||||||
m_treeWidget->setHeaderHidden(true);
|
|
||||||
vbox->addWidget(m_treeWidget);
|
|
||||||
|
|
||||||
QtVersionManager *vm = QtVersionManager::instance();
|
|
||||||
QStringList targets = vm->supportedTargetIds().toList();
|
|
||||||
qSort(targets.begin(), targets.end());
|
|
||||||
|
|
||||||
Qt4TargetFactory factory;
|
|
||||||
|
|
||||||
foreach (const QString &t, targets) {
|
|
||||||
QTreeWidgetItem *targetItem = new QTreeWidgetItem(m_treeWidget);
|
|
||||||
targetItem->setText(0, factory.displayNameForId(t));
|
|
||||||
targetItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
||||||
targetItem->setData(0, Qt::UserRole, t);
|
|
||||||
targetItem->setExpanded(true);
|
|
||||||
|
|
||||||
foreach (QtVersion *v, vm->versionsForTargetId(t)) {
|
|
||||||
QTreeWidgetItem *versionItem = new QTreeWidgetItem(targetItem);
|
|
||||||
versionItem->setText(0, v->displayName());
|
|
||||||
versionItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
|
||||||
versionItem->setData(0, Qt::UserRole, v->uniqueId());
|
|
||||||
versionItem->setCheckState(0, Qt::Unchecked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(m_treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
|
|
||||||
this, SLOT(itemWasChanged()));
|
|
||||||
|
|
||||||
emit completeChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetsPage::setValidTargets(const QSet<QString> &targets)
|
|
||||||
{
|
|
||||||
if (targets.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (int i = 0; i < m_treeWidget->topLevelItemCount(); ++i) {
|
|
||||||
QTreeWidgetItem *currentTargetItem = m_treeWidget->topLevelItem(i);
|
|
||||||
QString currentTarget = currentTargetItem->data(0, Qt::UserRole).toString();
|
|
||||||
if (targets.contains(currentTarget))
|
|
||||||
currentTargetItem->setHidden(false);
|
|
||||||
else
|
|
||||||
currentTargetItem->setHidden(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure we have something checked!
|
|
||||||
if (selectedTargets().isEmpty()) {
|
|
||||||
for (int i = 0; i < m_treeWidget->topLevelItemCount(); ++i) {
|
|
||||||
QTreeWidgetItem *currentTargetItem = m_treeWidget->topLevelItem(i);
|
|
||||||
QString currentTarget = currentTargetItem->data(0, Qt::UserRole).toString();
|
|
||||||
if (targets.contains(currentTarget) && currentTargetItem->childCount() >= 1) {
|
|
||||||
currentTargetItem->child(0)->setCheckState(0, Qt::Checked);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
emit completeChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QSet<QString> TargetsPage::selectedTargets() const
|
|
||||||
{
|
|
||||||
QSet<QString> result;
|
|
||||||
for (int i = 0; i < m_treeWidget->topLevelItemCount(); ++i) {
|
|
||||||
QTreeWidgetItem * targetItem = m_treeWidget->topLevelItem(i);
|
|
||||||
QString target = targetItem->data(0, Qt::UserRole).toString();
|
|
||||||
|
|
||||||
QList<int> versions = selectedQtVersionIdsForTarget(target);
|
|
||||||
if (!versions.isEmpty())
|
|
||||||
result.insert(target);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<int> TargetsPage::selectedQtVersionIdsForTarget(const QString &t) const
|
|
||||||
{
|
|
||||||
QList<int> result;
|
|
||||||
for (int i = 0; i < m_treeWidget->topLevelItemCount(); ++i) {
|
|
||||||
QTreeWidgetItem * current = m_treeWidget->topLevelItem(i);
|
|
||||||
QString target = current->data(0, Qt::UserRole).toString();
|
|
||||||
if (t != target || current->isHidden())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (int j = 0; j < current->childCount(); ++j) {
|
|
||||||
QTreeWidgetItem * child = current->child(j);
|
|
||||||
if (child->checkState(0) != Qt::Checked)
|
|
||||||
continue;
|
|
||||||
result.append(child->data(0, Qt::UserRole).toInt());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetsPage::itemWasChanged()
|
|
||||||
{
|
|
||||||
emit completeChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TargetsPage::isComplete() const
|
|
||||||
{
|
|
||||||
return !selectedTargets().isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TargetsPage::needToDisplayPage() const
|
|
||||||
{
|
|
||||||
int targetCount = 0;
|
|
||||||
for (int i = 0; i < m_treeWidget->topLevelItemCount(); ++i) {
|
|
||||||
QTreeWidgetItem * current = m_treeWidget->topLevelItem(i);
|
|
||||||
if (current->isHidden())
|
|
||||||
continue;
|
|
||||||
++targetCount;
|
|
||||||
if (targetCount > 1)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (current->childCount() > 1)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TargetsPage::writeUserFile(const QString &proFileName) const
|
|
||||||
{
|
|
||||||
Qt4Manager *manager = ExtensionSystem::PluginManager::instance()->getObject<Qt4Manager>();
|
|
||||||
Q_ASSERT(manager);
|
|
||||||
|
|
||||||
Qt4Project *pro = new Qt4Project(manager, proFileName);
|
|
||||||
if (setupProject(pro))
|
|
||||||
pro->saveSettings();
|
|
||||||
delete pro;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TargetsPage::setupProject(Qt4ProjectManager::Qt4Project *project) const
|
|
||||||
{
|
|
||||||
if (!project)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Generate user settings:
|
|
||||||
QSet<QString> targets = selectedTargets();
|
|
||||||
if (targets.isEmpty())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QtVersionManager *vm = QtVersionManager::instance();
|
|
||||||
|
|
||||||
foreach (const QString &targetId, targets) {
|
|
||||||
QList<int> versionIds = selectedQtVersionIdsForTarget(targetId);
|
|
||||||
QList<QtVersion *> versions;
|
|
||||||
foreach (int id, versionIds)
|
|
||||||
versions.append(vm->version(id));
|
|
||||||
Qt4Target * target = project->targetFactory()->create(project, targetId, versions);
|
|
||||||
project->addTarget(target);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
/**************************************************************************
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator
|
|
||||||
**
|
|
||||||
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
||||||
**
|
|
||||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
||||||
**
|
|
||||||
** Commercial Usage
|
|
||||||
**
|
|
||||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
||||||
** accordance with the Qt Commercial License Agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and Nokia.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
**
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 2.1 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
||||||
**
|
|
||||||
** If you are unsure which license is appropriate for your use, please
|
|
||||||
** contact the sales department at http://qt.nokia.com/contact.
|
|
||||||
**
|
|
||||||
**************************************************************************/
|
|
||||||
|
|
||||||
#ifndef TARGETSPAGE_H
|
|
||||||
#define TARGETSPAGE_H
|
|
||||||
|
|
||||||
#include <QtCore/QList>
|
|
||||||
#include <QtCore/QSet>
|
|
||||||
#include <QtCore/QString>
|
|
||||||
|
|
||||||
#include <QtGui/QWizard>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QTreeWidget;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
|
||||||
class Qt4Project;
|
|
||||||
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class TargetsPage : public QWizardPage
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit TargetsPage(QWidget* parent = 0);
|
|
||||||
|
|
||||||
void setValidTargets(const QSet<QString> &targets);
|
|
||||||
|
|
||||||
QSet<QString> selectedTargets() const;
|
|
||||||
QList<int> selectedQtVersionIdsForTarget(const QString &) const;
|
|
||||||
|
|
||||||
bool isComplete() const;
|
|
||||||
|
|
||||||
bool needToDisplayPage() const;
|
|
||||||
|
|
||||||
void writeUserFile(const QString &proFileName) const;
|
|
||||||
bool setupProject(Qt4Project *project) const;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void itemWasChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QSet<QString> m_validTargets;
|
|
||||||
QTreeWidget * m_treeWidget;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
|
||||||
} // namespace Qt4ProjectManager
|
|
||||||
|
|
||||||
#endif // TARGETSPAGE_H
|
|
||||||
@@ -60,7 +60,7 @@ TestWizardDialog::TestWizardDialog(const QString &templateName,
|
|||||||
setWindowIcon(icon);
|
setWindowIcon(icon);
|
||||||
setWindowTitle(templateName);
|
setWindowTitle(templateName);
|
||||||
setSelectedModules(QLatin1String("core testlib"), true);
|
setSelectedModules(QLatin1String("core testlib"), true);
|
||||||
addTargetsPage();
|
addTargetSetupPage();
|
||||||
m_testPageId = addPage(m_testPage);
|
m_testPageId = addPage(m_testPage);
|
||||||
m_modulesPageId = addModulesPage();
|
m_modulesPageId = addModulesPage();
|
||||||
foreach (QWizardPage *p, extensionPages)
|
foreach (QWizardPage *p, extensionPages)
|
||||||
|
|||||||
@@ -854,12 +854,19 @@ bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_pool != _translationUnit->memoryPool()) {
|
||||||
|
MemoryPool *pool = _translationUnit->memoryPool();
|
||||||
|
TemplateArgumentListAST *template_argument_list = node;
|
||||||
|
for (TemplateArgumentListAST *iter = template_argument_list, **ast_iter = &node;
|
||||||
|
iter; iter = iter->next, ast_iter = &(*ast_iter)->next)
|
||||||
|
*ast_iter = new (pool) TemplateArgumentListAST((iter->value) ? iter->value->clone(pool) : 0);
|
||||||
|
}
|
||||||
|
|
||||||
_templateArgumentList.insert(std::make_pair(start, TemplateArgumentListEntry(start, cursor(), node)));
|
_templateArgumentList.insert(std::make_pair(start, TemplateArgumentListEntry(start, cursor(), node)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_templateArgumentList.insert(std::make_pair(start, TemplateArgumentListEntry(start, cursor(), 0)));
|
_templateArgumentList.insert(std::make_pair(start, TemplateArgumentListEntry(start, cursor(), 0)));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3192,6 +3192,30 @@ void TestCore::testMetaInfo()
|
|||||||
// QVERIFY(graphicsWidgetInfo.hasProperty("enabled")); // from QGraphicsItem
|
// QVERIFY(graphicsWidgetInfo.hasProperty("enabled")); // from QGraphicsItem
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestCore::testMetaInfoEnums()
|
||||||
|
{
|
||||||
|
QScopedPointer<Model> model(Model::create("Qt/Text"));
|
||||||
|
QVERIFY(model.data());
|
||||||
|
|
||||||
|
QScopedPointer<TestView> view(new TestView);
|
||||||
|
QVERIFY(view.data());
|
||||||
|
model->attachView(view.data());
|
||||||
|
|
||||||
|
QCOMPARE(view->rootModelNode().metaInfo().typeName(), QString("Qt/Text"));
|
||||||
|
|
||||||
|
QVERIFY(view->rootModelNode().metaInfo().hasProperty("transformOrigin"));
|
||||||
|
|
||||||
|
QVERIFY(view->rootModelNode().metaInfo().property("transformOrigin").isEnumType());
|
||||||
|
QCOMPARE(view->rootModelNode().metaInfo().property("transformOrigin").type(), QLatin1String("TransformOrigin"));
|
||||||
|
QVERIFY(view->rootModelNode().metaInfo().property("transformOrigin").enumerator().elementNames().contains(QLatin1String("Bottom")));
|
||||||
|
QVERIFY(view->rootModelNode().metaInfo().property("transformOrigin").enumerator().elementNames().contains(QLatin1String("Top")));
|
||||||
|
|
||||||
|
QVERIFY(view->rootModelNode().metaInfo().property("horizontalAlignment").isEnumType());
|
||||||
|
QCOMPARE(view->rootModelNode().metaInfo().property("horizontalAlignment").type(), QLatin1String("HAlignment"));
|
||||||
|
QVERIFY(view->rootModelNode().metaInfo().property("horizontalAlignment").enumerator().elementNames().contains(QLatin1String("AlignLeft")));
|
||||||
|
QVERIFY(view->rootModelNode().metaInfo().property("horizontalAlignment").enumerator().elementNames().contains(QLatin1String("AlignRight")));
|
||||||
|
}
|
||||||
|
|
||||||
void TestCore::testMetaInfoDotProperties()
|
void TestCore::testMetaInfoDotProperties()
|
||||||
{
|
{
|
||||||
QScopedPointer<Model> model(Model::create("Qt/Text"));
|
QScopedPointer<Model> model(Model::create("Qt/Text"));
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ private slots:
|
|||||||
// unit tests MetaInfo, NodeMetaInfo, PropertyMetaInfo
|
// unit tests MetaInfo, NodeMetaInfo, PropertyMetaInfo
|
||||||
//
|
//
|
||||||
void testMetaInfo();
|
void testMetaInfo();
|
||||||
|
void testMetaInfoEnums();
|
||||||
void testMetaInfoDotProperties();
|
void testMetaInfoDotProperties();
|
||||||
void testMetaInfoListProperties();
|
void testMetaInfoListProperties();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user