Commit aa0533c9 authored by jkobus's avatar jkobus Committed by Jarek Kobus
Browse files

Move "Sync Horiz Scroll Bars" corner widget to the toolbar



Change-Id: Ie97ae07b02499b4d8d80e006aa77ca3b802f39b3
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 36bec480
......@@ -33,6 +33,8 @@
#include "diffeditorconstants.h"
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <QCoreApplication>
#include <QToolButton>
#include <QSpinBox>
......@@ -153,6 +155,15 @@ QWidget *DiffEditor::toolBar()
m_editorWidget, SLOT(setContextLinesNumber(int)));
m_toolWidget->addWidget(contextSpinBox);
QToolButton *toggleSync = new QToolButton(m_toolWidget);
toggleSync->setIcon(QIcon(QLatin1String(Core::Constants::ICON_LINK)));
toggleSync->setCheckable(true);
toggleSync->setChecked(true);
toggleSync->setToolTip(tr("Synchronize Horizontal Scroll Bars"));
connect(toggleSync, SIGNAL(clicked(bool)),
m_editorWidget, SLOT(setHorizontalScrollBarSynchronization(bool)));
m_toolWidget->addWidget(toggleSync);
return m_toolWidget;
}
......
......@@ -533,15 +533,6 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent)
{
TextEditor::TextEditorSettings *settings = TextEditorSettings::instance();
QToolButton *toggleSync = new QToolButton();
toggleSync = new QToolButton;
toggleSync->setText(QLatin1String("S"));
toggleSync->setCheckable(true);
toggleSync->setChecked(m_syncScrollBars);
toggleSync->setToolTip(tr("Synchronize Horizontal Scroll Bars"));
toggleSync->setAutoRaise(true);
connect(toggleSync, SIGNAL(clicked(bool)), this, SLOT(toggleScrollBarSynchronization(bool)));
m_leftEditor = new DiffViewEditorWidget(this);
m_leftEditor->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
m_leftEditor->setReadOnly(true);
......@@ -554,7 +545,6 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent)
m_leftEditor->setCodeStyle(settings->codeStyle());
m_rightEditor = new DiffViewEditorWidget(this);
m_rightEditor->setCornerWidget(toggleSync);
m_rightEditor->setReadOnly(true);
connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
m_rightEditor, SLOT(setFontSettings(TextEditor::FontSettings)));
......@@ -1423,7 +1413,7 @@ void DiffEditorWidget::rightDocumentSizeChanged()
synchronizeFoldings(m_rightEditor, m_leftEditor);
}
void DiffEditorWidget::toggleScrollBarSynchronization(bool on)
void DiffEditorWidget::setHorizontalScrollBarSynchronization(bool on)
{
m_syncScrollBars = on;
}
......
......@@ -86,6 +86,7 @@ public:
public slots:
void setContextLinesNumber(int lines);
void setIgnoreWhitespaces(bool ignore);
void setHorizontalScrollBarSynchronization(bool on);
void navigateToDiffFile(int diffFileIndex);
signals:
......@@ -104,7 +105,6 @@ private slots:
void rightCursorPositionChanged();
void leftDocumentSizeChanged();
void rightDocumentSizeChanged();
void toggleScrollBarSynchronization(bool on);
private:
struct DiffList {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment