Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
2cb95148
Commit
2cb95148
authored
Mar 30, 2010
by
dt
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of scm.dev.nokia.troll.no:creator/mainline
parents
6b389129
ce8b7f97
Changes
46
Hide whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
479 additions
and
560 deletions
+479
-560
src/libs/qmljs/parser/gen-parser.sh
src/libs/qmljs/parser/gen-parser.sh
+1
-1
src/libs/qmljs/parser/qmljs.g
src/libs/qmljs/parser/qmljs.g
+42
-18
src/libs/qmljs/parser/qmljsparser.cpp
src/libs/qmljs/parser/qmljsparser.cpp
+6
-5
src/libs/utils/wizard.cpp
src/libs/utils/wizard.cpp
+9
-3
src/libs/utils/wizard.h
src/libs/utils/wizard.h
+5
-4
src/plugins/coreplugin/dialogs/settingsdialog.cpp
src/plugins/coreplugin/dialogs/settingsdialog.cpp
+2
-1
src/plugins/coreplugin/editortoolbar.cpp
src/plugins/coreplugin/editortoolbar.cpp
+2
-6
src/plugins/coreplugin/editortoolbar.h
src/plugins/coreplugin/editortoolbar.h
+0
-2
src/plugins/coreplugin/fancyactionbar.cpp
src/plugins/coreplugin/fancyactionbar.cpp
+0
-52
src/plugins/coreplugin/fancyactionbar.h
src/plugins/coreplugin/fancyactionbar.h
+0
-10
src/plugins/cpaster/codepasterprotocol.cpp
src/plugins/cpaster/codepasterprotocol.cpp
+5
-11
src/plugins/cpaster/codepasterprotocol.h
src/plugins/cpaster/codepasterprotocol.h
+2
-5
src/plugins/cpaster/cpasterplugin.cpp
src/plugins/cpaster/cpasterplugin.cpp
+39
-19
src/plugins/cpaster/cpasterplugin.h
src/plugins/cpaster/cpasterplugin.h
+6
-2
src/plugins/cpaster/pastebindotcaprotocol.cpp
src/plugins/cpaster/pastebindotcaprotocol.cpp
+19
-20
src/plugins/cpaster/pastebindotcaprotocol.h
src/plugins/cpaster/pastebindotcaprotocol.h
+6
-8
src/plugins/cpaster/pastebindotcomprotocol.cpp
src/plugins/cpaster/pastebindotcomprotocol.cpp
+16
-20
src/plugins/cpaster/pastebindotcomprotocol.h
src/plugins/cpaster/pastebindotcomprotocol.h
+2
-9
src/plugins/cpaster/protocol.cpp
src/plugins/cpaster/protocol.cpp
+47
-0
src/plugins/cpaster/protocol.h
src/plugins/cpaster/protocol.h
+53
-1
src/plugins/debugger/gdb/gdbengine.cpp
src/plugins/debugger/gdb/gdbengine.cpp
+17
-5
src/plugins/projectexplorer/outputparser_test.cpp
src/plugins/projectexplorer/outputparser_test.cpp
+4
-1
src/plugins/projectexplorer/outputparser_test.h
src/plugins/projectexplorer/outputparser_test.h
+5
-0
src/plugins/projectexplorer/targetsettingspanel.cpp
src/plugins/projectexplorer/targetsettingspanel.cpp
+17
-10
src/plugins/qmldesigner/core/model/propertyparser.cpp
src/plugins/qmldesigner/core/model/propertyparser.cpp
+5
-2
src/plugins/qmldesigner/core/model/rewriterview.cpp
src/plugins/qmldesigner/core/model/rewriterview.cpp
+1
-1
src/plugins/qmldesigner/core/model/texttomodelmerger.cpp
src/plugins/qmldesigner/core/model/texttomodelmerger.cpp
+17
-4
src/plugins/qmldesigner/core/model/texttomodelmerger.h
src/plugins/qmldesigner/core/model/texttomodelmerger.h
+1
-1
src/plugins/qmlprojectmanager/fileformat/filesystemwatcher.h
src/plugins/qmlprojectmanager/fileformat/filesystemwatcher.h
+2
-0
src/plugins/qt4projectmanager/customwidgetwizard/customwidgetwizarddialog.cpp
...ctmanager/customwidgetwizard/customwidgetwizarddialog.cpp
+1
-1
src/plugins/qt4projectmanager/qt-s60/abldparser.cpp
src/plugins/qt4projectmanager/qt-s60/abldparser.cpp
+50
-0
src/plugins/qt4projectmanager/qt4projectmanager.pro
src/plugins/qt4projectmanager/qt4projectmanager.pro
+0
-2
src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
src/plugins/qt4projectmanager/qt4projectmanagerplugin.cpp
+0
-5
src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
src/plugins/qt4projectmanager/qt4projectmanagerplugin.h
+3
-1
src/plugins/qt4projectmanager/wizards/consoleappwizarddialog.cpp
...gins/qt4projectmanager/wizards/consoleappwizarddialog.cpp
+1
-1
src/plugins/qt4projectmanager/wizards/emptyprojectwizarddialog.cpp
...ns/qt4projectmanager/wizards/emptyprojectwizarddialog.cpp
+1
-1
src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp
src/plugins/qt4projectmanager/wizards/guiappwizarddialog.cpp
+4
-5
src/plugins/qt4projectmanager/wizards/librarywizarddialog.cpp
...plugins/qt4projectmanager/wizards/librarywizarddialog.cpp
+1
-1
src/plugins/qt4projectmanager/wizards/qtwizard.cpp
src/plugins/qt4projectmanager/wizards/qtwizard.cpp
+44
-24
src/plugins/qt4projectmanager/wizards/qtwizard.h
src/plugins/qt4projectmanager/wizards/qtwizard.h
+9
-5
src/plugins/qt4projectmanager/wizards/targetspage.cpp
src/plugins/qt4projectmanager/wizards/targetspage.cpp
+0
-213
src/plugins/qt4projectmanager/wizards/targetspage.h
src/plugins/qt4projectmanager/wizards/targetspage.h
+0
-78
src/plugins/qt4projectmanager/wizards/testwizarddialog.cpp
src/plugins/qt4projectmanager/wizards/testwizarddialog.cpp
+1
-1
src/shared/cplusplus/Parser.cpp
src/shared/cplusplus/Parser.cpp
+8
-1
tests/auto/qml/qmldesigner/coretests/testcore.cpp
tests/auto/qml/qmldesigner/coretests/testcore.cpp
+24
-0
tests/auto/qml/qmldesigner/coretests/testcore.h
tests/auto/qml/qmldesigner/coretests/testcore.h
+1
-0
No files found.
src/libs/qmljs/parser/gen-parser.sh
View file @
2cb95148
...
...
@@ -2,7 +2,7 @@
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/
)
done
...
...
src/libs/qmljs/parser/qmljs.g
View file @
2cb95148
...
...
@@ -65,6 +65,7 @@
%token T_PUBLIC "public"
%token T_IMPORT "import"
%token T_AS "as"
%token T_ON "on"
--- feed tokens
%token T_FEED_UI_PROGRAM
...
...
@@ -653,18 +654,15 @@ case $rule_number: {
node = makeAstNode<AST::UiImport>(driver->nodePool(), importIdLiteral->value);
node->fileNameToken = loc(2);
} 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->fileNameToken = loc(2);
}
sym(1).Node = node;
if (! node) {
if (node) {
node->importToken = loc(1);
} else {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1),
QLatin1String("Expected a qualified name id or a string literal")));
...
...
@@ -773,6 +771,17 @@ case $rule_number: {
} 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 ;
/.case $rule_number:./
...
...
@@ -870,8 +879,8 @@ case $rule_number: {
} 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
T_IDENTIFIER
T_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
JsIdentifier
T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval);
...
...
@@ -885,8 +894,8 @@ case $rule_number: {
} break;
./
UiObjectMember: T_PROPERTY UiPropertyType
T_IDENTIFIER
T_AUTOMATIC_SEMICOLON ;
UiObjectMember: T_PROPERTY UiPropertyType
T_IDENTIFIER
T_SEMICOLON ;
UiObjectMember: T_PROPERTY UiPropertyType
JsIdentifier
T_AUTOMATIC_SEMICOLON ;
UiObjectMember: T_PROPERTY UiPropertyType
JsIdentifier
T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval);
...
...
@@ -898,8 +907,8 @@ case $rule_number: {
} break;
./
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType
T_IDENTIFIER
T_AUTOMATIC_SEMICOLON ;
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType
T_IDENTIFIER
T_SEMICOLON ;
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType
JsIdentifier
T_AUTOMATIC_SEMICOLON ;
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType
JsIdentifier
T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval);
...
...
@@ -913,8 +922,8 @@ case $rule_number: {
} break;
./
UiObjectMember: T_PROPERTY UiPropertyType
T_IDENTIFIER
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_AUTOMATIC_SEMICOLON ;
UiObjectMember: T_PROPERTY UiPropertyType
JsIdentifier
T_COLON Expression T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval,
...
...
@@ -928,8 +937,8 @@ case $rule_number: {
} break;
./
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType
T_IDENTIFIER
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_AUTOMATIC_SEMICOLON ;
UiObjectMember: T_READONLY T_PROPERTY UiPropertyType
JsIdentifier
T_COLON Expression T_SEMICOLON ;
/.
case $rule_number: {
AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval,
...
...
@@ -945,8 +954,8 @@ case $rule_number: {
} break;
./
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType
T_IDENTIFIER
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_AUTOMATIC_SEMICOLON ;
UiObjectMember: T_DEFAULT T_PROPERTY UiPropertyType
JsIdentifier
T_COLON Expression T_SEMICOLON ;
/.
case $rule_number: {
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
--------------------------------------------------------------------------------------------------------
...
...
@@ -1086,6 +1104,9 @@ case $rule_number: {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
return false; // ### remove me
}
loc(1).length = lexer->tokenLength();
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
node->literalToken = loc(1);
sym(1).Node = node;
...
...
@@ -1103,6 +1124,9 @@ case $rule_number: {
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage()));
return false;
}
loc(1).length = lexer->tokenLength();
AST::RegExpLiteral *node = makeAstNode<AST::RegExpLiteral> (driver->nodePool(), lexer->pattern, lexer->flags);
node->literalToken = loc(1);
sym(1).Node = node;
...
...
src/libs/qmljs/parser/qmljsparser.cpp
View file @
2cb95148
...
...
@@ -273,11 +273,6 @@ case 20: {
node
=
makeAstNode
<
AST
::
UiImport
>
(
driver
->
nodePool
(),
importIdLiteral
->
value
);
node
->
fileNameToken
=
loc
(
2
);
}
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
->
fileNameToken
=
loc
(
2
);
}
...
...
@@ -571,6 +566,9 @@ case 76: {
diagnostic_messages
.
append
(
DiagnosticMessage
(
DiagnosticMessage
::
Error
,
location
(
lexer
),
lexer
->
errorMessage
()));
return
false
;
// ### remove me
}
loc
(
1
).
length
=
lexer
->
tokenLength
();
AST
::
RegExpLiteral
*
node
=
makeAstNode
<
AST
::
RegExpLiteral
>
(
driver
->
nodePool
(),
lexer
->
pattern
,
lexer
->
flags
);
node
->
literalToken
=
loc
(
1
);
sym
(
1
).
Node
=
node
;
...
...
@@ -582,6 +580,9 @@ case 77: {
diagnostic_messages
.
append
(
DiagnosticMessage
(
DiagnosticMessage
::
Error
,
location
(
lexer
),
lexer
->
errorMessage
()));
return
false
;
}
loc
(
1
).
length
=
lexer
->
tokenLength
();
AST
::
RegExpLiteral
*
node
=
makeAstNode
<
AST
::
RegExpLiteral
>
(
driver
->
nodePool
(),
lexer
->
pattern
,
lexer
->
flags
);
node
->
literalToken
=
loc
(
1
);
sym
(
1
).
Node
=
node
;
...
...
src/libs/utils/wizard.cpp
View file @
2cb95148
...
...
@@ -290,8 +290,8 @@ public:
WizardProgress
*
m_wizardProgress
;
};
Wizard
::
Wizard
(
QWidget
*
parent
)
:
QWizard
(
parent
),
d_ptr
(
new
WizardPrivate
)
Wizard
::
Wizard
(
QWidget
*
parent
,
Qt
::
WindowFlags
flags
)
:
QWizard
(
parent
,
flags
),
d_ptr
(
new
WizardPrivate
)
{
d_ptr
->
q_ptr
=
this
;
d_ptr
->
m_wizardProgress
=
new
WizardProgress
(
this
);
...
...
@@ -301,6 +301,11 @@ Wizard::Wizard(QWidget *parent) :
setSideWidget
(
new
LinearProgressWidget
(
d_ptr
->
m_wizardProgress
,
this
));
}
Wizard
::~
Wizard
()
{
delete
d_ptr
;
}
bool
Wizard
::
isAutomaticProgressCreationEnabled
()
const
{
Q_D
(
const
Wizard
);
...
...
@@ -563,6 +568,7 @@ WizardProgress::~WizardProgress()
delete
it
.
key
();
++
it
;
}
delete
d_ptr
;
}
WizardProgressItem
*
WizardProgress
::
addItem
(
const
QString
&
title
)
...
...
@@ -764,7 +770,7 @@ WizardProgressItem::WizardProgressItem(WizardProgress *progress, const QString &
WizardProgressItem
::~
WizardProgressItem
()
{
delete
d_ptr
;
}
void
WizardProgressItem
::
addPage
(
int
pageId
)
...
...
src/libs/utils/wizard.h
View file @
2cb95148
...
...
@@ -47,7 +47,8 @@ class QTCREATOR_UTILS_EXPORT Wizard : public QWizard
Q_PROPERTY
(
bool
automaticProgressCreationEnabled
READ
isAutomaticProgressCreationEnabled
WRITE
setAutomaticProgressCreationEnabled
)
public:
explicit
Wizard
(
QWidget
*
parent
=
0
);
explicit
Wizard
(
QWidget
*
parent
=
0
,
Qt
::
WindowFlags
flags
=
0
);
virtual
~
Wizard
();
bool
isAutomaticProgressCreationEnabled
()
const
;
void
setAutomaticProgressCreationEnabled
(
bool
enabled
);
...
...
@@ -66,7 +67,7 @@ private:
Q_DISABLE_COPY
(
Wizard
)
Q_DECLARE_PRIVATE
(
Wizard
)
QScopedPointer
<
WizardPrivate
>
d_ptr
;
class
WizardPrivate
*
d_ptr
;
};
class
WizardProgressItem
;
...
...
@@ -118,7 +119,7 @@ private:
Q_DISABLE_COPY
(
WizardProgress
)
Q_DECLARE_PRIVATE
(
WizardProgress
)
QScopedPointer
<
WizardProgressPrivate
>
d_ptr
;
class
WizardProgressPrivate
*
d_ptr
;
};
class
WizardProgressItemPrivate
;
...
...
@@ -150,7 +151,7 @@ private:
Q_DISABLE_COPY
(
WizardProgressItem
)
Q_DECLARE_PRIVATE
(
WizardProgressItem
)
QScopedPointer
<
WizardProgressItemPrivate
>
d_ptr
;
class
WizardProgressItemPrivate
*
d_ptr
;
};
}
// namespace Utils
...
...
src/plugins/coreplugin/dialogs/settingsdialog.cpp
View file @
2cb95148
...
...
@@ -64,7 +64,8 @@ namespace Internal {
// ----------- Category model
struct
Category
{
class
Category
{
public:
QString
id
;
QString
displayName
;
QIcon
icon
;
...
...
src/plugins/coreplugin/editortoolbar.cpp
View file @
2cb95148
...
...
@@ -75,7 +75,6 @@ namespace Core {
EditorToolBar
::
EditorToolBar
(
QWidget
*
parent
)
:
Utils
::
StyledBar
(
parent
),
m_editorList
(
new
QComboBox
(
this
)),
m_rightToolBar
(
new
QToolBar
(
this
)),
m_closeButton
(
new
QToolButton
),
m_lockButton
(
new
QToolButton
),
...
...
@@ -124,10 +123,6 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
m_forwardButton
=
new
QToolButton
(
this
);
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
);
toplayout
->
setSpacing
(
0
);
toplayout
->
setMargin
(
0
);
...
...
@@ -135,7 +130,8 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
toplayout
->
addWidget
(
m_forwardButton
);
toplayout
->
addWidget
(
m_editorList
);
toplayout
->
addWidget
(
m_toolBarPlaceholder
,
1
);
// Custom toolbar stretches
toplayout
->
addWidget
(
m_rightToolBar
);
toplayout
->
addWidget
(
m_lockButton
);
toplayout
->
addWidget
(
m_closeButton
);
setLayout
(
toplayout
);
...
...
src/plugins/coreplugin/editortoolbar.h
View file @
2cb95148
...
...
@@ -111,8 +111,6 @@ private:
IEditor
*
currentEditor
()
const
;
Core
::
OpenEditorsModel
*
m_editorsListModel
;
QComboBox
*
m_editorList
;
QToolBar
*
m_centerToolBar
;
QToolBar
*
m_rightToolBar
;
QToolButton
*
m_closeButton
;
QToolButton
*
m_lockButton
;
QAction
*
m_goBackAction
;
...
...
src/plugins/coreplugin/fancyactionbar.cpp
View file @
2cb95148
...
...
@@ -264,31 +264,8 @@ FancyActionBar::FancyActionBar(QWidget *parent)
spacerLayout
->
setSpacing
(
0
);
setLayout
(
spacerLayout
);
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
)
{
FancyToolButton
*
toolButton
=
new
FancyToolButton
(
this
);
...
...
@@ -300,40 +277,11 @@ void FancyActionBar::addProjectSelector(QAction *action)
void
FancyActionBar
::
insertAction
(
int
index
,
QAction
*
action
)
{
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
);
connect
(
action
,
SIGNAL
(
changed
()),
toolButton
,
SLOT
(
actionChanged
()));
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
{
return
m_actionsLayout
;
...
...
src/plugins/coreplugin/fancyactionbar.h
View file @
2cb95148
...
...
@@ -75,23 +75,13 @@ class FancyActionBar : public QWidget
public:
FancyActionBar
(
QWidget
*
parent
=
0
);
#ifdef Q_WS_MAC
bool
eventFilter
(
QObject
*
,
QEvent
*
);
#endif
void
paintEvent
(
QPaintEvent
*
event
);
void
insertAction
(
int
index
,
QAction
*
action
);
void
addProjectSelector
(
QAction
*
action
);
QLayout
*
actionsLayout
()
const
;
private
slots
:
void
modeChanged
(
Core
::
IMode
*
mode
);
private:
void
updateRunDebug
();
bool
m_inDebugMode
;
QVBoxLayout
*
m_actionsLayout
;
FancyToolButton
*
m_runButton
;
FancyToolButton
*
m_debugButton
;
};
}
// namespace Internal
...
...
src/plugins/cpaster/codepasterprotocol.cpp
View file @
2cb95148
...
...
@@ -48,7 +48,8 @@ enum { debug = 0 };
namespace
CodePaster
{
CodePasterProtocol
::
CodePasterProtocol
()
:
CodePasterProtocol
::
CodePasterProtocol
(
const
NetworkAccessManagerProxyPtr
&
nw
)
:
NetworkProtocol
(
nw
),
m_page
(
new
CodePaster
::
CodePasterSettingsPage
),
m_pasteReply
(
0
),
m_fetchReply
(
0
),
...
...
@@ -98,10 +99,7 @@ void CodePasterProtocol::fetch(const QString &id)
link
.
append
(
hostName
);
link
.
append
(
"/?format=raw&id="
);
link
.
append
(
id
);
QUrl
url
(
link
);
QNetworkRequest
r
(
url
);
m_fetchReply
=
m_manager
.
get
(
r
);
m_fetchReply
=
httpGet
(
link
);
connect
(
m_fetchReply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
fetchFinished
()));
m_fetchId
=
id
;
}
...
...
@@ -116,9 +114,7 @@ void CodePasterProtocol::list()
QString
link
=
QLatin1String
(
"http://"
);
link
+=
hostName
;
link
+=
QLatin1String
(
"/?command=browse&format=raw"
);
QUrl
url
(
link
);
QNetworkRequest
r
(
url
);
m_listReply
=
m_manager
.
get
(
r
);
m_listReply
=
httpGet
(
link
);
connect
(
m_listReply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
listFinished
()));
}
...
...
@@ -142,9 +138,7 @@ void CodePasterProtocol::paste(const QString &text,
data
+=
"&poster="
;
data
+=
CGI
::
encodeURL
(
username
).
toLatin1
();
QUrl
url
(
QLatin1String
(
"http://"
)
+
hostName
);
QNetworkRequest
r
(
url
);
m_pasteReply
=
m_manager
.
post
(
r
,
data
);
m_pasteReply
=
httpPost
(
QLatin1String
(
"http://"
)
+
hostName
,
data
);
connect
(
m_pasteReply
,
SIGNAL
(
finished
()),
this
,
SLOT
(
pasteFinished
()));
}
...
...
src/plugins/cpaster/codepasterprotocol.h
View file @
2cb95148
...
...
@@ -32,8 +32,6 @@
#include "protocol.h"
#include <QtNetwork/QNetworkAccessManager>
QT_BEGIN_NAMESPACE
class
QNetworkReply
;
QT_END_NAMESPACE
...
...
@@ -42,11 +40,11 @@ namespace CodePaster {
class
CodePasterSettingsPage
;
class
CodePasterProtocol
:
public
Protocol
class
CodePasterProtocol
:
public
Network
Protocol
{
Q_OBJECT
public:
CodePasterProtocol
(
);
explicit
CodePasterProtocol
(
const
NetworkAccessManagerProxyPtr
&
nw
);
~
CodePasterProtocol
();
QString
name
()
const
;
...
...
@@ -70,7 +68,6 @@ public slots:
private:
bool
isValidHostName
(
const
QString
&
hostName
);
CodePasterSettingsPage
*
m_page
;
QNetworkAccessManager
m_manager
;
QNetworkReply
*
m_pasteReply
;
QNetworkReply
*
m_fetchReply
;
QNetworkReply
*
m_listReply
;
...
...
src/plugins/cpaster/cpasterplugin.cpp
View file @
2cb95148
...
...
@@ -65,7 +65,9 @@ using namespace CodePaster;
using
namespace
Core
;
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
);
// Create the protocols and append them to the Settings
Protocol
*
protos
[]
=
{
new
CodePasterProtocol
(),
new
PasteBinDotComProtocol
(),
new
PasteBinDotCaProtocol
(),
const
QSharedPointer
<
NetworkAccessManagerProxy
>
networkAccessMgrProxy
(
new
NetworkAccessManagerProxy
);
Protocol
*
protos
[]
=
{
new
CodePasterProtocol
(
networkAccessMgrProxy
),
new
PasteBinDotComProtocol
(
networkAccessMgrProxy
),
new
PasteBinDotCaProtocol
(
networkAccessMgrProxy
),
0
};
for
(
int
i
=
0
;
protos
[
i
]
!=
0
;
++
i
)
{
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
;
m_postAction
=
new
QAction
(
tr
(
"Paste Snippet..."
),
this
);
command
=
actionManager
->
registerAction
(
m_postAction
,
"CodePaster.Post"
,
globalcontext
);
m_post
Editor
Action
=
new
QAction
(
tr
(
"Paste Snippet..."
),
this
);
command
=
actionManager
->
registerAction
(
m_post
Editor
Action
,
"CodePaster.Post"
,
globalcontext
);
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
);
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
)
{
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
);
FileDataList
lst
=
splitDiffToFiles
(
data
.
toLatin1
());
QString
username
=
m_settings
->
username
;
...
...
@@ -199,7 +219,7 @@ void CodepasterPlugin::post()
protocolName
=
view
.
protocol
();
foreach
(
Protocol
*
protocol
,
m_protocols
)
{
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
);
break
;
}
...
...
src/plugins/cpaster/cpasterplugin.h
View file @
2cb95148
...
...
@@ -58,7 +58,8 @@ public:
virtual
void
shutdown
();
public
slots
:
void
post
();
void
postEditor
();
void
postClipboard
();
void
fetch
();
void
finishPost
(
const
QString
&
link
);
void
finishFetch
(
const
QString
&
titleDescription
,
...
...
@@ -66,8 +67,11 @@ public slots:
bool
error
);
private:
void
post
(
QString
data
,
const
QString
&
mimeType
);
const
QSharedPointer
<
Settings
>
m_settings
;
QAction
*
m_postAction
;
QAction
*
m_postEditorAction
;
QAction
*
m_postClipboardAction
;
QAction
*
m_fetchAction
;
QList
<
Protocol
*>
m_protocols
;
QStringList
m_fetchedSnippets
;
...
...
src/plugins/cpaster/pastebindotcaprotocol.cpp
View file @
2cb95148
...
...
@@ -32,11 +32,13 @@
#include <QtNetwork/QNetworkReply>
using
namespace
Core
;
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
)));
}
...
...
@@ -44,12 +46,9 @@ void PasteBinDotCaProtocol::fetch(const QString &id)
{
QString
link
=
QLatin1String
(
"http://pastebin.ca/raw/"
);
link
.
append
(
id
);
QUrl
url
(
link
);
QNetworkRequest
r
(
url
);
reply
=
manager
.
get
(
r
);