Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
5d316a49
Commit
5d316a49
authored
Dec 02, 2008
by
Friedemann Kleint
Browse files
Fixes: Move icons into VCSBase, use buttons for submit
parent
5f01890a
Changes
21
Hide whitespace changes
Inline
Side-by-side
src/libs/utils/submiteditorwidget.cpp
View file @
5d316a49
...
...
@@ -37,11 +37,39 @@
#include <QtCore/QDebug>
#include <QtCore/QPointer>
#include <QtGui/QPushButton>
enum
{
debug
=
0
};
namespace
Core
{
namespace
Utils
{
// QActionPushButton: A push button tied to an action
// (similar to a QToolButton)
class
QActionPushButton
:
public
QPushButton
{
Q_OBJECT
public:
explicit
QActionPushButton
(
QAction
*
a
);
private
slots
:
void
actionChanged
();
};
QActionPushButton
::
QActionPushButton
(
QAction
*
a
)
:
QPushButton
(
a
->
icon
(),
a
->
text
())
{
connect
(
a
,
SIGNAL
(
changed
()),
this
,
SLOT
(
actionChanged
()));
connect
(
this
,
SIGNAL
(
clicked
()),
a
,
SLOT
(
trigger
()));
setEnabled
(
a
->
isEnabled
());
}
void
QActionPushButton
::
actionChanged
()
{
if
(
const
QAction
*
a
=
qobject_cast
<
QAction
*>
(
sender
()))
setEnabled
(
a
->
isEnabled
());
}
// ----------- SubmitEditorWidgetPrivate
struct
SubmitEditorWidgetPrivate
{
SubmitEditorWidgetPrivate
();
...
...
@@ -99,13 +127,15 @@ void SubmitEditorWidget::registerActions(QAction *editorUndoAction, QAction *ed
qDebug
()
<<
submitAction
<<
m_d
->
m_ui
.
fileList
->
count
()
<<
"items"
<<
m_d
->
m_filesChecked
;
submitAction
->
setEnabled
(
m_d
->
m_filesChecked
);
connect
(
this
,
SIGNAL
(
fileCheckStateChanged
(
bool
)),
submitAction
,
SLOT
(
setEnabled
(
bool
)));
m_d
->
m_ui
.
buttonLayout
->
addWidget
(
new
QActionPushButton
(
submitAction
));
}
if
(
diffAction
)
{
if
(
debug
)
qDebug
()
<<
diffAction
<<
m_d
->
m_filesSelected
;
diffAction
->
setEnabled
(
m_d
->
m_filesSelected
);
connect
(
this
,
SIGNAL
(
fileSelectionChanged
(
bool
)),
diffAction
,
SLOT
(
setEnabled
(
bool
)));
connect
(
diffAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
triggerDiffSelected
()));
diffAction
->
setEnabled
(
m_d
->
m_filesSelected
);
connect
(
this
,
SIGNAL
(
fileSelectionChanged
(
bool
)),
diffAction
,
SLOT
(
setEnabled
(
bool
)));
connect
(
diffAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
triggerDiffSelected
()));
m_d
->
m_ui
.
buttonLayout
->
addWidget
(
new
QActionPushButton
(
diffAction
));
}
}
...
...
@@ -305,3 +335,5 @@ void SubmitEditorWidget::insertTopWidget(QWidget *w)
}
// namespace Utils
}
// namespace Core
#include "submiteditorwidget.moc"
src/libs/utils/submiteditorwidget.ui
View file @
5d316a49
...
...
@@ -51,6 +51,23 @@
</layout>
</widget>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"buttonLayout"
>
<item>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
40
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
...
...
src/plugins/git/gitclient.cpp
View file @
5d316a49
...
...
@@ -625,7 +625,7 @@ QString GitClient::readConfig(const QString &workingDirectory, const QStringList
QByteArray
outputText
;
if
(
synchronousGit
(
workingDirectory
,
arguments
,
&
outputText
))
return
outputText
;
return
QString
::
fromLocal8Bit
(
outputText
)
;
return
QString
();
}
...
...
src/plugins/git/gitconstants.h
View file @
5d316a49
...
...
@@ -48,10 +48,6 @@ const char * const SUBMIT_CURRENT = "Nokia.Git.SubmitCurrentLog";
const
char
*
const
DIFF_SELECTED
=
"Nokia.Git.DiffSelectedFilesInLog"
;
const
char
*
const
SUBMIT_MIMETYPE
=
"application/vnd.nokia.text.git.submit"
;
// TODO: For the moment, trust p4 is loaded...
const
char
*
const
ICON_SUBMIT
=
":/trolltech.perforce/images/submit.png"
;
const
char
*
const
ICON_DIFF
=
":/trolltech.perforce/images/diff.png"
;
const
char
*
const
DIFF_FILE_INDICATOR
=
"--- "
;
enum
{
debug
=
0
};
...
...
src/plugins/git/gitplugin.cpp
View file @
5d316a49
...
...
@@ -354,12 +354,12 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
// Submit editor
QList
<
int
>
submitContext
;
submitContext
.
push_back
(
m_core
->
uniqueIDManager
()
->
uniqueIdentifier
(
QLatin1String
(
Constants
::
C_GITSUBMITEDITOR
)));
m_submitCurrentAction
=
new
QAction
(
QIcon
(
Constants
::
ICON_SUBMIT
),
tr
(
"Commit"
),
this
);
m_submitCurrentAction
=
new
QAction
(
VCSBase
::
VCSBaseSubmitEditor
::
submitIcon
(
),
tr
(
"Commit"
),
this
);
command
=
actionManager
->
registerAction
(
m_submitCurrentAction
,
Constants
::
SUBMIT_CURRENT
,
submitContext
);
// TODO
connect
(
m_submitCurrentAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
submitCurrentLog
()));
m_diffSelectedFilesAction
=
new
QAction
(
QIcon
(
Constants
::
ICON_DIFF
),
tr
(
"Diff Selected Files"
),
this
);
m_diffSelectedFilesAction
=
new
QAction
(
VCSBase
::
VCSBaseSubmitEditor
::
diffIcon
(
),
tr
(
"Diff Selected Files"
),
this
);
command
=
actionManager
->
registerAction
(
m_diffSelectedFilesAction
,
Constants
::
DIFF_SELECTED
,
submitContext
);
m_undoAction
=
new
QAction
(
tr
(
"&Undo"
),
this
);
...
...
src/plugins/git/gitsubmiteditorwidget.cpp
View file @
5d316a49
...
...
@@ -48,7 +48,6 @@ GitSubmitEditorWidget::GitSubmitEditorWidget(QWidget *parent) :
void
GitSubmitEditorWidget
::
setPanelInfo
(
const
GitSubmitEditorPanelInfo
&
info
)
{
m_gitSubmitPanelUi
.
repositoryLabel
->
setText
(
info
.
repository
);
m_gitSubmitPanelUi
.
descriptionLabel
->
setText
(
info
.
description
);
m_gitSubmitPanelUi
.
branchLabel
->
setText
(
info
.
branch
);
}
...
...
src/plugins/git/gitsubmitpanel.ui
View file @
5d316a49
...
...
@@ -7,7 +7,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
201
</width>
<height>
210
</height>
<height>
189
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
...
...
@@ -17,6 +17,9 @@
<string>
General Information
</string>
</property>
<layout
class=
"QFormLayout"
name=
"infoFormLayout"
>
<property
name=
"fieldGrowthPolicy"
>
<enum>
QFormLayout::ExpandingFieldsGrow
</enum>
</property>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"repositoryLabelLabel"
>
<property
name=
"text"
>
...
...
@@ -32,30 +35,13 @@
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"descriptionLabelLabel"
>
<property
name=
"text"
>
<string>
Description:
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QLabel"
name=
"descriptionLabel"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"text"
>
<string>
description
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QLabel"
name=
"branchLabelLabel"
>
<property
name=
"text"
>
<string>
Branch:
</string>
</property>
</widget>
</item>
<item
row=
"
2
"
column=
"1"
>
<item
row=
"
1
"
column=
"1"
>
<widget
class=
"QLabel"
name=
"branchLabel"
>
<property
name=
"text"
>
<string>
branch
</string>
...
...
src/plugins/perforce/perforce.qrc
View file @
5d316a49
<RCC>
<qresource prefix="/trolltech.perforce" >
<file>images/diff.png</file>
<file>images/submit.png</file>
<file>Perforce.mimetypes.xml</file>
</qresource>
</RCC>
src/plugins/perforce/perforceconstants.h
View file @
5d316a49
...
...
@@ -42,14 +42,10 @@ const char * const C_PERFORCEEDITOR = "Perforce Editor";
const
char
*
const
PERFORCEEDITOR_KIND
=
"Perforce Editor"
;
const
char
*
const
C_PERFORCESUBMITEDITOR
=
"Perforce Submit Editor"
;
const
char
*
const
PERFORCESUBMITEDITOR_KIND
=
"Perforce Submit Editor"
;
const
char
*
const
ICON_SUBMIT
=
":/trolltech.perforce/images/submit.png"
;
const
char
*
const
ICON_DIFF
=
":/trolltech.perforce/images/diff.png"
;
const
char
*
const
SUBMIT_CURRENT
=
"Nokia.Perforce.SubmitCurrentLog"
;
const
char
*
const
DIFF_SELECTED
=
"Nokia.Perforce.DiffSelectedFilesInLog"
;
const
char
*
const
SUBMIT_MIMETYPE
=
"application/vnd.nokia.text.p4.submit"
;
enum
{
debug
=
0
};
}
// Internal
}
// Perforce
...
...
src/plugins/perforce/perforceplugin.cpp
View file @
5d316a49
...
...
@@ -366,11 +366,11 @@ bool PerforcePlugin::initialize(const QStringList & /*arguments*/, QString *erro
connect
(
m_filelogAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
filelog
()));
mperforce
->
addAction
(
command
);
m_submitCurrentLogAction
=
new
QAction
(
QIcon
(
Constants
::
ICON_SUBMIT
),
tr
(
"Submit"
),
this
);
m_submitCurrentLogAction
=
new
QAction
(
VCSBase
::
VCSBaseSubmitEditor
::
submitIcon
(
),
tr
(
"Submit"
),
this
);
command
=
am
->
registerAction
(
m_submitCurrentLogAction
,
Constants
::
SUBMIT_CURRENT
,
perforcesubmitcontext
);
connect
(
m_submitCurrentLogAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
submitCurrentLog
()));
m_diffSelectedFiles
=
new
QAction
(
QIcon
(
Constants
::
ICON_DIFF
),
tr
(
"Diff Selected Files"
),
this
);
m_diffSelectedFiles
=
new
QAction
(
VCSBase
::
VCSBaseSubmitEditor
::
diffIcon
(
),
tr
(
"Diff Selected Files"
),
this
);
command
=
am
->
registerAction
(
m_diffSelectedFiles
,
Constants
::
DIFF_SELECTED
,
perforcesubmitcontext
);
m_undoAction
=
new
QAction
(
tr
(
"&Undo"
),
this
);
...
...
src/plugins/subversion/images/diff.png
deleted
100644 → 0
View file @
5f01890a
204 Bytes
src/plugins/subversion/images/submit.png
deleted
100644 → 0
View file @
5f01890a
309 Bytes
src/plugins/subversion/subversion.qrc
View file @
5d316a49
<RCC>
<qresource prefix="/trolltech.subversion" >
<file>images/diff.png</file>
<file>images/submit.png</file>
<file>Subversion.mimetypes.xml</file>
</qresource>
</RCC>
src/plugins/subversion/subversionconstants.h
View file @
5d316a49
...
...
@@ -42,8 +42,6 @@ const char * const SUBVERSIONEDITOR = "Subversion Editor";
const
char
*
const
SUBVERSIONEDITOR_KIND
=
"Subversion Editor"
;
const
char
*
const
SUBVERSIONCOMMITEDITOR
=
"Subversion Commit Editor"
;
const
char
*
const
SUBVERSIONCOMMITEDITOR_KIND
=
"Subversion Commit Editor"
;
const
char
*
const
ICON_SUBMIT
=
":/trolltech.subversion/images/submit.png"
;
const
char
*
const
ICON_DIFF
=
":/trolltech.subversion/images/diff.png"
;
const
char
*
const
SUBMIT_CURRENT
=
"Nokia.Subversion.SubmitCurrentLog"
;
const
char
*
const
DIFF_SELECTED
=
"Nokia.Subversion.DiffSelectedFilesInLog"
;
enum
{
debug
=
0
};
...
...
src/plugins/subversion/subversionplugin.cpp
View file @
5d316a49
...
...
@@ -382,11 +382,11 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments*/, QString *er
QList
<
int
>
svncommitcontext
;
svncommitcontext
<<
m_coreInstance
->
uniqueIDManager
()
->
uniqueIdentifier
(
Constants
::
SUBVERSIONCOMMITEDITOR
);
m_submitCurrentLogAction
=
new
QAction
(
QIcon
(
Constants
::
ICON_SUBMIT
),
tr
(
"Commit"
),
this
);
m_submitCurrentLogAction
=
new
QAction
(
VCSBase
::
VCSBaseSubmitEditor
::
submitIcon
(
),
tr
(
"Commit"
),
this
);
command
=
ami
->
registerAction
(
m_submitCurrentLogAction
,
Constants
::
SUBMIT_CURRENT
,
svncommitcontext
);
connect
(
m_submitCurrentLogAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
submitCurrentLog
()));
m_submitDiffAction
=
new
QAction
(
QIcon
(
Constants
::
ICON_DIFF
),
tr
(
"Diff Selected Files"
),
this
);
m_submitDiffAction
=
new
QAction
(
VCSBase
::
VCSBaseSubmitEditor
::
diffIcon
(
),
tr
(
"Diff Selected Files"
),
this
);
command
=
ami
->
registerAction
(
m_submitDiffAction
,
Constants
::
DIFF_SELECTED
,
svncommitcontext
);
m_submitUndoAction
=
new
QAction
(
tr
(
"&Undo"
),
this
);
...
...
src/plugins/
perforc
e/images/diff.png
→
src/plugins/
vcsbas
e/images/diff.png
View file @
5d316a49
File moved
src/plugins/
perforc
e/images/submit.png
→
src/plugins/
vcsbas
e/images/submit.png
View file @
5d316a49
File moved
src/plugins/vcsbase/vcsbase.qrc
View file @
5d316a49
<RCC>
<qresource prefix="/
trolltech.
vcsbase" >
<qresource prefix="/vcsbase" >
<file>VCSBase.mimetypes.xml</file>
<file>images/diff.png</file>
<file>images/submit.png</file>
</qresource>
</RCC>
src/plugins/vcsbase/vcsbaseplugin.cpp
View file @
5d316a49
...
...
@@ -61,7 +61,7 @@ bool VCSBasePlugin::initialize(const QStringList & /*arguments*/, QString *error
{
Core
::
ICore
*
core
=
ExtensionSystem
::
PluginManager
::
instance
()
->
getObject
<
Core
::
ICore
>
();
if
(
!
core
->
mimeDatabase
()
->
addMimeTypes
(
QLatin1String
(
":/
trolltech.
vcsbase/VCSBase.mimetypes.xml"
),
errorMessage
))
if
(
!
core
->
mimeDatabase
()
->
addMimeTypes
(
QLatin1String
(
":/vcsbase/VCSBase.mimetypes.xml"
),
errorMessage
))
return
false
;
return
true
;
...
...
@@ -70,7 +70,7 @@ bool VCSBasePlugin::initialize(const QStringList & /*arguments*/, QString *error
void
VCSBasePlugin
::
extensionsInitialized
()
{
}
VCSBasePlugin
*
VCSBasePlugin
::
instance
()
{
return
m_instance
;
...
...
src/plugins/vcsbase/vcsbasesubmiteditor.cpp
View file @
5d316a49
...
...
@@ -51,6 +51,7 @@
#include <QtCore/QDebug>
enum
{
debug
=
0
};
enum
{
wantToolBar
=
0
};
static
inline
QAction
*
actionFromId
(
const
Core
::
ICore
*
core
,
const
char
*
id
)
{
...
...
@@ -187,8 +188,27 @@ const char *VCSBaseSubmitEditor::kind() const
return
m_d
->
m_parameters
->
kind
;
}
static
QToolBar
*
createToolBar
(
const
QWidget
*
someWidget
,
QAction
*
submitAction
,
QAction
*
diffAction
)
{
// Create
QToolBar
*
toolBar
=
new
QToolBar
;
toolBar
->
setToolButtonStyle
(
Qt
::
ToolButtonTextBesideIcon
);
const
int
size
=
someWidget
->
style
()
->
pixelMetric
(
QStyle
::
PM_SmallIconSize
);
toolBar
->
setIconSize
(
QSize
(
size
,
size
));
toolBar
->
addSeparator
();
if
(
submitAction
)
toolBar
->
addAction
(
submitAction
);
if
(
diffAction
)
toolBar
->
addAction
(
diffAction
);
return
toolBar
;
}
QToolBar
*
VCSBaseSubmitEditor
::
toolBar
()
{
if
(
!
wantToolBar
)
return
0
;
if
(
m_d
->
m_toolWidget
)
return
m_d
->
m_toolWidget
;
...
...
@@ -196,18 +216,8 @@ QToolBar *VCSBaseSubmitEditor::toolBar()
return
0
;
// Create
QToolBar
*
toolBar
=
new
QToolBar
;
toolBar
->
setToolButtonStyle
(
Qt
::
ToolButtonTextBesideIcon
);
const
int
size
=
m_d
->
m_widget
->
style
()
->
pixelMetric
(
QStyle
::
PM_SmallIconSize
);
toolBar
->
setIconSize
(
QSize
(
size
,
size
));
toolBar
->
addSeparator
();
if
(
m_d
->
m_submitAction
)
toolBar
->
addAction
(
m_d
->
m_submitAction
);
if
(
m_d
->
m_diffAction
)
toolBar
->
addAction
(
m_d
->
m_diffAction
);
m_d
->
m_toolWidget
=
toolBar
;
return
toolBar
;
m_d
->
m_toolWidget
=
createToolBar
(
m_d
->
m_widget
,
m_d
->
m_submitAction
,
m_d
->
m_diffAction
);
return
m_d
->
m_toolWidget
;
}
QList
<
int
>
VCSBaseSubmitEditor
::
context
()
const
...
...
@@ -279,4 +289,14 @@ bool VCSBaseSubmitEditor::setFileContents(const QString &contents)
return
true
;
}
}
// namespace VCSBase
QIcon
VCSBaseSubmitEditor
::
diffIcon
()
{
return
QIcon
(
QLatin1String
(
":/vcsbase/images/diff.png"
));
}
QIcon
VCSBaseSubmitEditor
::
submitIcon
()
{
return
QIcon
(
QLatin1String
(
":/vcsbase/images/submit.png"
));
}
}
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment