summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2013-04-30 20:52:46 +0300
committerOrgad Shaneh <orgads@gmail.com>2013-05-02 16:47:19 +0200
commitcb055c1d0f9410553d2cc484e4e5257079867447 (patch)
tree4139ae8477a7d450f7698987880137cf68bf293a /src/plugins
parent633c11d184df22724e2a401a311b805827eabbd5 (diff)
downloadqt-creator-cb055c1d0f9410553d2cc484e4e5257079867447.tar.gz
Git: Simplify editor code a bit
* Introduce a const submitEditorWidget() and use it * Directly use layout from ui Change-Id: Ib566bab464d4f1c08a3f2af0edb5e1fa989c3160 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/git/gitsubmiteditor.cpp9
-rw-r--r--src/plugins/git/gitsubmiteditor.h1
-rw-r--r--src/plugins/vcsbase/submiteditorwidget.cpp4
-rw-r--r--src/plugins/vcsbase/submiteditorwidget.ui2
4 files changed, 10 insertions, 6 deletions
diff --git a/src/plugins/git/gitsubmiteditor.cpp b/src/plugins/git/gitsubmiteditor.cpp
index d8128a3622..bb7a93a887 100644
--- a/src/plugins/git/gitsubmiteditor.cpp
+++ b/src/plugins/git/gitsubmiteditor.cpp
@@ -96,6 +96,11 @@ GitSubmitEditorWidget *GitSubmitEditor::submitEditorWidget()
return static_cast<GitSubmitEditorWidget *>(widget());
}
+const GitSubmitEditorWidget *GitSubmitEditor::submitEditorWidget() const
+{
+ return static_cast<GitSubmitEditorWidget *>(widget());
+}
+
void GitSubmitEditor::setCommitData(const CommitData &d)
{
GitSubmitEditorWidget *w = submitEditorWidget();
@@ -174,12 +179,12 @@ void GitSubmitEditor::updateFileModel()
GitSubmitEditorPanelData GitSubmitEditor::panelData() const
{
- return const_cast<GitSubmitEditor*>(this)->submitEditorWidget()->panelData();
+ return submitEditorWidget()->panelData();
}
QByteArray GitSubmitEditor::fileContents() const
{
- const QString& text = const_cast<GitSubmitEditor*>(this)->submitEditorWidget()->descriptionText();
+ const QString &text = submitEditorWidget()->descriptionText();
if (!m_commitEncoding.isEmpty()) {
// Do the encoding convert, When use user-defined encoding
diff --git a/src/plugins/git/gitsubmiteditor.h b/src/plugins/git/gitsubmiteditor.h
index df809cc917..ca6e0cf7f1 100644
--- a/src/plugins/git/gitsubmiteditor.h
+++ b/src/plugins/git/gitsubmiteditor.h
@@ -71,6 +71,7 @@ private slots:
private:
inline GitSubmitEditorWidget *submitEditorWidget();
+ inline const GitSubmitEditorWidget *submitEditorWidget() const;
VcsBase::SubmitFileModel *m_model;
QString m_commitEncoding;
diff --git a/src/plugins/vcsbase/submiteditorwidget.cpp b/src/plugins/vcsbase/submiteditorwidget.cpp
index 3fe2a078ba..816a4ae5cb 100644
--- a/src/plugins/vcsbase/submiteditorwidget.cpp
+++ b/src/plugins/vcsbase/submiteditorwidget.cpp
@@ -568,9 +568,7 @@ void SubmitEditorWidget::addSubmitFieldWidget(SubmitFieldWidget *f)
QHBoxLayout *outerLayout = new QHBoxLayout;
outerLayout->addLayout(d->m_fieldLayout);
outerLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
- QBoxLayout *descrLayout = qobject_cast<QBoxLayout*>(d->m_ui.descriptionBox->layout());
- Q_ASSERT(descrLayout);
- descrLayout->addLayout(outerLayout);
+ d->m_ui.descriptionLayout->addLayout(outerLayout);
}
d->m_fieldLayout->addWidget(f);
d->m_fieldWidgets.push_back(f);
diff --git a/src/plugins/vcsbase/submiteditorwidget.ui b/src/plugins/vcsbase/submiteditorwidget.ui
index ab37981bb2..0111080e1a 100644
--- a/src/plugins/vcsbase/submiteditorwidget.ui
+++ b/src/plugins/vcsbase/submiteditorwidget.ui
@@ -29,7 +29,7 @@
<property name="flat">
<bool>true</bool>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
+ <layout class="QVBoxLayout" name="descriptionLayout">
<item>
<widget class="Utils::CompletingTextEdit" name="description">
<property name="acceptRichText">