forked from qt-creator/qt-creator
Fixes: Move icons into VCSBase, use buttons for submit
This commit is contained in:
@@ -37,11 +37,39 @@
|
|||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
|
|
||||||
|
#include <QtGui/QPushButton>
|
||||||
|
|
||||||
enum { debug = 0 };
|
enum { debug = 0 };
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Utils {
|
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
|
struct SubmitEditorWidgetPrivate
|
||||||
{
|
{
|
||||||
SubmitEditorWidgetPrivate();
|
SubmitEditorWidgetPrivate();
|
||||||
@@ -99,6 +127,7 @@ void SubmitEditorWidget::registerActions(QAction *editorUndoAction, QAction *ed
|
|||||||
qDebug() << submitAction << m_d->m_ui.fileList->count() << "items" << m_d->m_filesChecked;
|
qDebug() << submitAction << m_d->m_ui.fileList->count() << "items" << m_d->m_filesChecked;
|
||||||
submitAction->setEnabled(m_d->m_filesChecked);
|
submitAction->setEnabled(m_d->m_filesChecked);
|
||||||
connect(this, SIGNAL(fileCheckStateChanged(bool)), submitAction, SLOT(setEnabled(bool)));
|
connect(this, SIGNAL(fileCheckStateChanged(bool)), submitAction, SLOT(setEnabled(bool)));
|
||||||
|
m_d->m_ui.buttonLayout->addWidget(new QActionPushButton(submitAction));
|
||||||
}
|
}
|
||||||
if (diffAction) {
|
if (diffAction) {
|
||||||
if (debug)
|
if (debug)
|
||||||
@@ -106,6 +135,7 @@ void SubmitEditorWidget::registerActions(QAction *editorUndoAction, QAction *ed
|
|||||||
diffAction->setEnabled(m_d->m_filesSelected);
|
diffAction->setEnabled(m_d->m_filesSelected);
|
||||||
connect(this, SIGNAL(fileSelectionChanged(bool)), diffAction, SLOT(setEnabled(bool)));
|
connect(this, SIGNAL(fileSelectionChanged(bool)), diffAction, SLOT(setEnabled(bool)));
|
||||||
connect(diffAction, SIGNAL(triggered()), this, SLOT(triggerDiffSelected()));
|
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 Utils
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
||||||
|
#include "submiteditorwidget.moc"
|
||||||
|
@@ -51,6 +51,23 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
@@ -625,7 +625,7 @@ QString GitClient::readConfig(const QString &workingDirectory, const QStringList
|
|||||||
|
|
||||||
QByteArray outputText;
|
QByteArray outputText;
|
||||||
if (synchronousGit(workingDirectory, arguments, &outputText))
|
if (synchronousGit(workingDirectory, arguments, &outputText))
|
||||||
return outputText;
|
return QString::fromLocal8Bit(outputText);
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -48,10 +48,6 @@ const char * const SUBMIT_CURRENT = "Nokia.Git.SubmitCurrentLog";
|
|||||||
const char * const DIFF_SELECTED = "Nokia.Git.DiffSelectedFilesInLog";
|
const char * const DIFF_SELECTED = "Nokia.Git.DiffSelectedFilesInLog";
|
||||||
const char * const SUBMIT_MIMETYPE = "application/vnd.nokia.text.git.submit";
|
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 = "--- ";
|
const char * const DIFF_FILE_INDICATOR = "--- ";
|
||||||
enum { debug = 0 };
|
enum { debug = 0 };
|
||||||
|
|
||||||
|
@@ -354,12 +354,12 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
|
|||||||
// Submit editor
|
// Submit editor
|
||||||
QList<int> submitContext;
|
QList<int> submitContext;
|
||||||
submitContext.push_back(m_core->uniqueIDManager()->uniqueIdentifier(QLatin1String(Constants::C_GITSUBMITEDITOR)));
|
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);
|
command = actionManager->registerAction(m_submitCurrentAction, Constants::SUBMIT_CURRENT, submitContext);
|
||||||
// TODO
|
// TODO
|
||||||
connect(m_submitCurrentAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));
|
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);
|
command = actionManager->registerAction(m_diffSelectedFilesAction, Constants::DIFF_SELECTED, submitContext);
|
||||||
|
|
||||||
m_undoAction = new QAction(tr("&Undo"), this);
|
m_undoAction = new QAction(tr("&Undo"), this);
|
||||||
|
@@ -48,7 +48,6 @@ GitSubmitEditorWidget::GitSubmitEditorWidget(QWidget *parent) :
|
|||||||
void GitSubmitEditorWidget::setPanelInfo(const GitSubmitEditorPanelInfo &info)
|
void GitSubmitEditorWidget::setPanelInfo(const GitSubmitEditorPanelInfo &info)
|
||||||
{
|
{
|
||||||
m_gitSubmitPanelUi.repositoryLabel->setText(info.repository);
|
m_gitSubmitPanelUi.repositoryLabel->setText(info.repository);
|
||||||
m_gitSubmitPanelUi.descriptionLabel->setText(info.description);
|
|
||||||
m_gitSubmitPanelUi.branchLabel->setText(info.branch);
|
m_gitSubmitPanelUi.branchLabel->setText(info.branch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>201</width>
|
<width>201</width>
|
||||||
<height>210</height>
|
<height>189</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
@@ -17,6 +17,9 @@
|
|||||||
<string>General Information</string>
|
<string>General Information</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="infoFormLayout">
|
<layout class="QFormLayout" name="infoFormLayout">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="repositoryLabelLabel">
|
<widget class="QLabel" name="repositoryLabelLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -32,30 +35,13 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<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">
|
<widget class="QLabel" name="branchLabelLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Branch:</string>
|
<string>Branch:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QLabel" name="branchLabel">
|
<widget class="QLabel" name="branchLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>branch</string>
|
<string>branch</string>
|
||||||
|
@@ -1,7 +1,5 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/trolltech.perforce" >
|
<qresource prefix="/trolltech.perforce" >
|
||||||
<file>images/diff.png</file>
|
|
||||||
<file>images/submit.png</file>
|
|
||||||
<file>Perforce.mimetypes.xml</file>
|
<file>Perforce.mimetypes.xml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -42,14 +42,10 @@ const char * const C_PERFORCEEDITOR = "Perforce Editor";
|
|||||||
const char * const PERFORCEEDITOR_KIND = "Perforce Editor";
|
const char * const PERFORCEEDITOR_KIND = "Perforce Editor";
|
||||||
const char * const C_PERFORCESUBMITEDITOR = "Perforce Submit Editor";
|
const char * const C_PERFORCESUBMITEDITOR = "Perforce Submit Editor";
|
||||||
const char * const PERFORCESUBMITEDITOR_KIND = "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 SUBMIT_CURRENT = "Nokia.Perforce.SubmitCurrentLog";
|
||||||
const char * const DIFF_SELECTED = "Nokia.Perforce.DiffSelectedFilesInLog";
|
const char * const DIFF_SELECTED = "Nokia.Perforce.DiffSelectedFilesInLog";
|
||||||
const char * const SUBMIT_MIMETYPE = "application/vnd.nokia.text.p4.submit";
|
const char * const SUBMIT_MIMETYPE = "application/vnd.nokia.text.p4.submit";
|
||||||
|
|
||||||
enum { debug = 0 };
|
enum { debug = 0 };
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
} // Perforce
|
} // Perforce
|
||||||
|
|
||||||
|
@@ -366,11 +366,11 @@ bool PerforcePlugin::initialize(const QStringList & /*arguments*/, QString *erro
|
|||||||
connect(m_filelogAction, SIGNAL(triggered()), this, SLOT(filelog()));
|
connect(m_filelogAction, SIGNAL(triggered()), this, SLOT(filelog()));
|
||||||
mperforce->addAction(command);
|
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);
|
command = am->registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, perforcesubmitcontext);
|
||||||
connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));
|
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);
|
command = am->registerAction(m_diffSelectedFiles, Constants::DIFF_SELECTED, perforcesubmitcontext);
|
||||||
|
|
||||||
m_undoAction = new QAction(tr("&Undo"), this);
|
m_undoAction = new QAction(tr("&Undo"), this);
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 204 B |
Binary file not shown.
Before Width: | Height: | Size: 309 B |
@@ -1,7 +1,5 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/trolltech.subversion" >
|
<qresource prefix="/trolltech.subversion" >
|
||||||
<file>images/diff.png</file>
|
|
||||||
<file>images/submit.png</file>
|
|
||||||
<file>Subversion.mimetypes.xml</file>
|
<file>Subversion.mimetypes.xml</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -42,8 +42,6 @@ const char * const SUBVERSIONEDITOR = "Subversion Editor";
|
|||||||
const char * const SUBVERSIONEDITOR_KIND = "Subversion Editor";
|
const char * const SUBVERSIONEDITOR_KIND = "Subversion Editor";
|
||||||
const char * const SUBVERSIONCOMMITEDITOR = "Subversion Commit Editor";
|
const char * const SUBVERSIONCOMMITEDITOR = "Subversion Commit Editor";
|
||||||
const char * const SUBVERSIONCOMMITEDITOR_KIND = "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 SUBMIT_CURRENT = "Nokia.Subversion.SubmitCurrentLog";
|
||||||
const char * const DIFF_SELECTED = "Nokia.Subversion.DiffSelectedFilesInLog";
|
const char * const DIFF_SELECTED = "Nokia.Subversion.DiffSelectedFilesInLog";
|
||||||
enum { debug = 0 };
|
enum { debug = 0 };
|
||||||
|
@@ -382,11 +382,11 @@ bool SubversionPlugin::initialize(const QStringList & /*arguments*/, QString *er
|
|||||||
QList<int> svncommitcontext;
|
QList<int> svncommitcontext;
|
||||||
svncommitcontext << m_coreInstance->uniqueIDManager()->uniqueIdentifier(Constants::SUBVERSIONCOMMITEDITOR);
|
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);
|
command = ami->registerAction(m_submitCurrentLogAction, Constants::SUBMIT_CURRENT, svncommitcontext);
|
||||||
connect(m_submitCurrentLogAction, SIGNAL(triggered()), this, SLOT(submitCurrentLog()));
|
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);
|
command = ami->registerAction(m_submitDiffAction , Constants::DIFF_SELECTED, svncommitcontext);
|
||||||
|
|
||||||
m_submitUndoAction = new QAction(tr("&Undo"), this);
|
m_submitUndoAction = new QAction(tr("&Undo"), this);
|
||||||
|
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 309 B |
@@ -1,5 +1,7 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/trolltech.vcsbase" >
|
<qresource prefix="/vcsbase" >
|
||||||
<file>VCSBase.mimetypes.xml</file>
|
<file>VCSBase.mimetypes.xml</file>
|
||||||
|
<file>images/diff.png</file>
|
||||||
|
<file>images/submit.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@@ -61,7 +61,7 @@ bool VCSBasePlugin::initialize(const QStringList & /*arguments*/, QString *error
|
|||||||
{
|
{
|
||||||
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
|
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 false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -51,6 +51,7 @@
|
|||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
enum { debug = 0 };
|
enum { debug = 0 };
|
||||||
|
enum { wantToolBar = 0 };
|
||||||
|
|
||||||
static inline QAction *actionFromId(const Core::ICore *core, const char *id)
|
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;
|
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()
|
QToolBar *VCSBaseSubmitEditor::toolBar()
|
||||||
{
|
{
|
||||||
|
if (!wantToolBar)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (m_d->m_toolWidget)
|
if (m_d->m_toolWidget)
|
||||||
return m_d->m_toolWidget;
|
return m_d->m_toolWidget;
|
||||||
|
|
||||||
@@ -196,18 +216,8 @@ QToolBar *VCSBaseSubmitEditor::toolBar()
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Create
|
// Create
|
||||||
QToolBar *toolBar = new QToolBar;
|
m_d->m_toolWidget = createToolBar(m_d->m_widget, m_d->m_submitAction, m_d->m_diffAction);
|
||||||
toolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
return m_d->m_toolWidget;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> VCSBaseSubmitEditor::context() const
|
QList<int> VCSBaseSubmitEditor::context() const
|
||||||
@@ -279,4 +289,14 @@ bool VCSBaseSubmitEditor::setFileContents(const QString &contents)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace VCSBase
|
QIcon VCSBaseSubmitEditor::diffIcon()
|
||||||
|
{
|
||||||
|
return QIcon(QLatin1String(":/vcsbase/images/diff.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon VCSBaseSubmitEditor::submitIcon()
|
||||||
|
{
|
||||||
|
return QIcon(QLatin1String(":/vcsbase/images/submit.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -40,6 +40,10 @@
|
|||||||
|
|
||||||
#include <QtCore/QList>
|
#include <QtCore/QList>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QIcon;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
class SubmitEditorWidget;
|
class SubmitEditorWidget;
|
||||||
@@ -118,6 +122,10 @@ public:
|
|||||||
void setFileList(const QStringList&);
|
void setFileList(const QStringList&);
|
||||||
void addFiles(const QStringList&, bool checked = true, bool userCheckable = true);
|
void addFiles(const QStringList&, bool checked = true, bool userCheckable = true);
|
||||||
|
|
||||||
|
// Utilities returning some predefined icons for actions
|
||||||
|
static QIcon diffIcon();
|
||||||
|
static QIcon submitIcon();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void diffSelectedFiles(const QStringList &files);
|
void diffSelectedFiles(const QStringList &files);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user