forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.2'
Change-Id: I259a402bc896fc2e359cc96b7510453ac9a9a552
This commit is contained in:
@@ -250,17 +250,16 @@ DiffEditor::DiffEditor()
|
||||
this, &DiffEditor::setCurrentDiffFileIndex);
|
||||
m_toolBar->addWidget(m_entriesComboBox);
|
||||
|
||||
m_contextLabel = new QLabel(m_toolBar);
|
||||
|
||||
m_contextLabel->setText(tr("Context lines:"));
|
||||
m_contextLabel->setContentsMargins(6, 0, 6, 0);
|
||||
m_toolBar->addWidget(m_contextLabel);
|
||||
QLabel *contextLabel = new QLabel(m_toolBar);
|
||||
contextLabel->setText(tr("Context lines:"));
|
||||
contextLabel->setContentsMargins(6, 0, 6, 0);
|
||||
m_contextLabelAction = m_toolBar->addWidget(contextLabel);
|
||||
|
||||
m_contextSpinBox = new QSpinBox(m_toolBar);
|
||||
m_contextSpinBox->setRange(1, 100);
|
||||
m_contextSpinBox->setFrame(false);
|
||||
m_contextSpinBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); // Mac Qt5
|
||||
m_toolBar->addWidget(m_contextSpinBox);
|
||||
m_contextSpinBoxAction = m_toolBar->addWidget(m_contextSpinBox);
|
||||
|
||||
m_whitespaceButtonAction = m_toolBar->addAction(tr("Ignore Whitespace"));
|
||||
m_whitespaceButtonAction->setCheckable(true);
|
||||
@@ -544,8 +543,8 @@ void DiffEditor::documentStateChanged()
|
||||
const bool contextVisible = !m_document->isContextLineCountForced();
|
||||
|
||||
m_whitespaceButtonAction->setVisible(canReload);
|
||||
m_contextLabel->setVisible(canReload && contextVisible);
|
||||
m_contextSpinBox->setVisible(canReload && contextVisible);
|
||||
m_contextLabelAction->setVisible(canReload && contextVisible);
|
||||
m_contextSpinBoxAction->setVisible(canReload && contextVisible);
|
||||
m_reloadAction->setVisible(canReload);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QSpinBox;
|
||||
class QToolBar;
|
||||
class QToolButton;
|
||||
@@ -95,11 +94,12 @@ private:
|
||||
QToolBar *m_toolBar;
|
||||
QComboBox *m_entriesComboBox;
|
||||
QSpinBox *m_contextSpinBox;
|
||||
QAction *m_contextSpinBoxAction = nullptr;
|
||||
QAction *m_toggleSyncAction;
|
||||
QAction *m_whitespaceButtonAction;
|
||||
QAction *m_toggleDescriptionAction;
|
||||
QAction *m_reloadAction;
|
||||
QLabel *m_contextLabel;
|
||||
QAction *m_contextLabelAction = nullptr;
|
||||
QAction *m_viewSwitcherAction;
|
||||
QPair<QString, QString> m_currentFileChunk;
|
||||
int m_currentViewIndex;
|
||||
|
||||
@@ -215,6 +215,7 @@ bool DiffEditorDocument::save(QString *errorString, const QString &fileName, boo
|
||||
|
||||
setController(0);
|
||||
setDescription(QString());
|
||||
Core::EditorManager::clearUniqueId(this);
|
||||
|
||||
const QFileInfo fi(fileName);
|
||||
setTemporary(false);
|
||||
|
||||
@@ -555,13 +555,16 @@ void DiffEditorPlugin::diffExternalFiles()
|
||||
QString());
|
||||
if (fileName1.isNull())
|
||||
return;
|
||||
if (EditorManager::skipOpeningBigTextFile(fileName1))
|
||||
return;
|
||||
|
||||
const QString fileName2 = QFileDialog::getOpenFileName(ICore::dialogParent(),
|
||||
tr("Select Second File for Diff"),
|
||||
QString());
|
||||
if (fileName2.isNull())
|
||||
return;
|
||||
|
||||
if (EditorManager::skipOpeningBigTextFile(fileName2))
|
||||
return;
|
||||
|
||||
const QString documentId = QLatin1String("Diff ") + fileName1 + QLatin1String(", ") + fileName2;
|
||||
const QString title = tr("Diff \"%1\", \"%2\"").arg(fileName1, fileName2);
|
||||
|
||||
@@ -353,6 +353,9 @@ QString DiffUtils::makePatchLine(const QChar &startLineCharacter,
|
||||
QString DiffUtils::makePatch(const ChunkData &chunkData,
|
||||
bool lastChunk)
|
||||
{
|
||||
if (chunkData.contextChunk)
|
||||
return QString();
|
||||
|
||||
QString diffText;
|
||||
int leftLineCount = 0;
|
||||
int rightLineCount = 0;
|
||||
|
||||
@@ -148,7 +148,7 @@ void UnifiedView::setSync(bool sync)
|
||||
SideBySideView::SideBySideView() : m_widget(0)
|
||||
{
|
||||
setId(SIDE_BY_SIDE_VIEW_ID);
|
||||
setIcon(Icons::UNIFIED_DIFF.icon());
|
||||
setIcon(Icons::SIDEBYSIDE_DIFF.icon());
|
||||
setToolTip(QCoreApplication::translate("DiffEditor::SideBySideView",
|
||||
"Switch to Side By Side Diff Editor"));
|
||||
setSupportsSync(true);
|
||||
|
||||
Reference in New Issue
Block a user