forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.8' into HEAD
Conflicts: qbs/pluginspec/pluginspec.qbs Change-Id: Ic8e992623b9eda8913ee473c779a8df27643ccc9
This commit is contained in:
@@ -186,8 +186,13 @@ bool AndroidSettingsWidget::checkSDK(const Utils::FileName &location)
|
||||
|| (!androidExe.appendPath(QLatin1String("/tools/android" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()
|
||||
&& !androidBat.appendPath(QLatin1String("/tools/android" ANDROID_BAT_SUFFIX)).toFileInfo().exists())
|
||||
|| !emulator.appendPath(QLatin1String("/tools/emulator" QTC_HOST_EXE_SUFFIX)).toFileInfo().exists()) {
|
||||
QMessageBox::critical(this, tr("Android SDK Folder"), tr("\"%1\" does not seem to be an Android SDK top folder.").arg(location.toUserOutput()));
|
||||
m_ui->sdkWarningIconLabel->setVisible(true);
|
||||
m_ui->sdkWarningLabel->setVisible(true);
|
||||
m_ui->sdkWarningLabel->setText(tr("\"%1\" does not seem to be an Android SDK top folder.").arg(location.toUserOutput()));
|
||||
return false;
|
||||
} else {
|
||||
m_ui->sdkWarningIconLabel->setVisible(false);
|
||||
m_ui->sdkWarningLabel->setVisible(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="SDKLocationLineEdit"/>
|
||||
<widget class="QLineEdit" name="SDKLocationLineEdit">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="SDKLocationPushButton">
|
||||
@@ -48,7 +52,43 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="sdkWarningIconLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="sdkWarningLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="NDKLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
@@ -64,17 +104,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="NDKLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="NDKLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
@@ -110,7 +150,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="CreateKitCheckBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
@@ -126,59 +166,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="AntLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ant location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="AntLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QPushButton" name="AntLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="OpenJDKLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>JDK location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="OpenJDKLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QPushButton" name="OpenJDKLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
@@ -217,6 +205,58 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="AntLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ant location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="AntLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QPushButton" name="AntLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="OpenJDKLocationLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>JDK location:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLineEdit" name="OpenJDKLocationLineEdit"/>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QPushButton" name="OpenJDKLocationPushButton">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@@ -44,7 +44,8 @@ using namespace Core::Internal;
|
||||
#define CANCELBUTTON_SIZE 15
|
||||
|
||||
ProgressBar::ProgressBar(QWidget *parent)
|
||||
: QWidget(parent), m_titleVisible(true), m_separatorVisible(true), m_progressHeight(0),
|
||||
: QWidget(parent), m_titleVisible(true), m_separatorVisible(true), m_cancelEnabled(true),
|
||||
m_progressHeight(0),
|
||||
m_minimum(1), m_maximum(100), m_value(1), m_cancelButtonFader(0), m_finished(false),
|
||||
m_error(false)
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <QAction>
|
||||
#include <QEvent>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QStyle>
|
||||
@@ -379,6 +380,19 @@ bool ProgressManagerPrivate::eventFilter(QObject *obj, QEvent *event)
|
||||
m_hovered = false;
|
||||
// give the progress view the chance to get the mouse enter event
|
||||
updateVisibilityWithDelay();
|
||||
} else if (obj == m_statusBarWidget && event->type() == QEvent::MouseButtonPress
|
||||
&& !m_taskList.isEmpty()) {
|
||||
QMouseEvent *me = static_cast<QMouseEvent *>(event);
|
||||
if (me->button() == Qt::LeftButton && !me->modifiers()) {
|
||||
FutureProgress *progress = m_currentStatusDetailsProgress;
|
||||
if (!progress)
|
||||
progress = m_taskList.last();
|
||||
// don't send signal directly from an event filter, event filters should
|
||||
// do as little a possible
|
||||
QTimer::singleShot(0, progress, SIGNAL(clicked()));
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -643,8 +657,10 @@ void ProgressManagerPrivate::updateStatusDetailsWidget()
|
||||
while (i != m_taskList.begin()) {
|
||||
--i;
|
||||
candidateWidget = (*i)->statusBarWidget();
|
||||
if (candidateWidget)
|
||||
if (candidateWidget) {
|
||||
m_currentStatusDetailsProgress = *i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (candidateWidget == m_currentStatusDetailsWidget)
|
||||
|
||||
@@ -108,6 +108,7 @@ private:
|
||||
QWidget *m_summaryProgressWidget;
|
||||
QHBoxLayout *m_summaryProgressLayout;
|
||||
QWidget *m_currentStatusDetailsWidget;
|
||||
QPointer<FutureProgress> m_currentStatusDetailsProgress;
|
||||
ProgressBar *m_summaryProgressBar;
|
||||
QGraphicsOpacityEffect *m_opacityEffect;
|
||||
QPointer<QPropertyAnimation> m_opacityAnimation;
|
||||
|
||||
@@ -355,8 +355,16 @@ QString WatchData::toToolTip() const
|
||||
formatToolTipRow(str, tr("Name"), name);
|
||||
formatToolTipRow(str, tr("Expression"), QLatin1String(exp));
|
||||
formatToolTipRow(str, tr("Internal Type"), QLatin1String(type));
|
||||
formatToolTipRow(str, tr("Displayed Type"), displayedType);
|
||||
QString val = valuetooltip.isEmpty() ? valuetooltip : value;
|
||||
if (!displayedType.isEmpty())
|
||||
formatToolTipRow(str, tr("Displayed Type"), displayedType);
|
||||
QString val = valuetooltip.isEmpty() ? value : valuetooltip;
|
||||
// Automatically display hex value for unsigned integers.
|
||||
if (!val.isEmpty() && val.at(0).isDigit() && isIntType(type)) {
|
||||
bool ok;
|
||||
const quint64 intValue = val.toULongLong(&ok);
|
||||
if (ok && intValue)
|
||||
val += QLatin1String(" (hex) ") + QString::number(intValue, 16);
|
||||
}
|
||||
if (val.size() > 1000) {
|
||||
val.truncate(1000);
|
||||
val += tr(" ... <cut off>");
|
||||
|
||||
@@ -139,7 +139,6 @@ public:
|
||||
QMap<int, int> skippedLines() const { return m_skippedLines; }
|
||||
QMap<int, DiffEditorWidget::DiffFileInfo> fileInfo() const { return m_fileInfo; }
|
||||
|
||||
void setWorkingDirectory(const QString &workingDirectory) { m_workingDirectory = workingDirectory; }
|
||||
void setLineNumber(int blockNumber, int lineNumber);
|
||||
void setFileInfo(int blockNumber, const DiffEditorWidget::DiffFileInfo &fileInfo) { m_fileInfo[blockNumber] = fileInfo; setSeparator(blockNumber, true); }
|
||||
void setSkippedLines(int blockNumber, int skippedLines) { m_skippedLines[blockNumber] = skippedLines; setSeparator(blockNumber, true); }
|
||||
@@ -157,6 +156,11 @@ public slots:
|
||||
void setDisplaySettings(const DisplaySettings &ds);
|
||||
void setFontSettings(const TextEditor::FontSettings &fs);
|
||||
|
||||
signals:
|
||||
void jumpToOriginalFileRequested(int diffFileIndex,
|
||||
int lineNumber,
|
||||
int columnNumber);
|
||||
|
||||
protected:
|
||||
virtual int extraAreaWidth(int *markWidthPtr = 0) const { return BaseTextEditorWidget::extraAreaWidth(markWidthPtr); }
|
||||
BaseTextEditor *createEditor() { return new DiffViewEditorEditable(this); }
|
||||
@@ -180,7 +184,6 @@ private:
|
||||
const QTextBlock &block, int top);
|
||||
void jumpToOriginalFile(const QTextCursor &cursor);
|
||||
|
||||
QString m_workingDirectory;
|
||||
QMap<int, int> m_lineNumbers;
|
||||
int m_lineNumberDigits;
|
||||
// block number, fileInfo
|
||||
@@ -430,20 +433,13 @@ void DiffViewEditorWidget::jumpToOriginalFile(const QTextCursor &cursor)
|
||||
return;
|
||||
|
||||
const int blockNumber = cursor.blockNumber();
|
||||
const int position = cursor.positionInBlock();
|
||||
const int columnNumber = cursor.positionInBlock();
|
||||
if (!m_lineNumbers.contains(blockNumber))
|
||||
return;
|
||||
|
||||
const int lineNr = m_lineNumbers.value(blockNumber);
|
||||
QMap<int, DiffEditorWidget::DiffFileInfo>::const_iterator it = m_fileInfo.upperBound(blockNumber);
|
||||
if (it != m_fileInfo.constBegin())
|
||||
--it;
|
||||
const QDir dir(m_workingDirectory);
|
||||
const QString fileName = dir.absoluteFilePath(it.value().fileName);
|
||||
const int lineNumber = m_lineNumbers.value(blockNumber);
|
||||
|
||||
Core::IEditor *ed = Core::EditorManager::openEditor(fileName);
|
||||
if (TextEditor::ITextEditor *editor = qobject_cast<TextEditor::ITextEditor *>(ed))
|
||||
editor->gotoLine(lineNr, position);
|
||||
emit jumpToOriginalFileRequested(fileIndexForBlockNumber(blockNumber), lineNumber, columnNumber);
|
||||
}
|
||||
|
||||
void DiffViewEditorWidget::paintEvent(QPaintEvent *e)
|
||||
@@ -609,6 +605,8 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent)
|
||||
m_leftEditor, SLOT(setDisplaySettings(TextEditor::DisplaySettings)));
|
||||
m_leftEditor->setDisplaySettings(settings->displaySettings());
|
||||
m_leftEditor->setCodeStyle(settings->codeStyle());
|
||||
connect(m_leftEditor, SIGNAL(jumpToOriginalFileRequested(int,int,int)),
|
||||
this, SLOT(slotLeftJumpToOriginalFileRequested(int,int,int)));
|
||||
|
||||
m_rightEditor = new DiffViewEditorWidget(this);
|
||||
m_rightEditor->setReadOnly(true);
|
||||
@@ -616,6 +614,8 @@ DiffEditorWidget::DiffEditorWidget(QWidget *parent)
|
||||
m_rightEditor, SLOT(setDisplaySettings(TextEditor::DisplaySettings)));
|
||||
m_rightEditor->setDisplaySettings(settings->displaySettings());
|
||||
m_rightEditor->setCodeStyle(settings->codeStyle());
|
||||
connect(m_rightEditor, SIGNAL(jumpToOriginalFileRequested(int,int,int)),
|
||||
this, SLOT(slotRightJumpToOriginalFileRequested(int,int,int)));
|
||||
|
||||
connect(settings, SIGNAL(fontSettingsChanged(TextEditor::FontSettings)),
|
||||
this, SLOT(setFontSettings(TextEditor::FontSettings)));
|
||||
@@ -680,8 +680,7 @@ void DiffEditorWidget::clear(const QString &message)
|
||||
|
||||
void DiffEditorWidget::setDiff(const QList<DiffFilesContents> &diffFileList, const QString &workingDirectory)
|
||||
{
|
||||
m_leftEditor->setWorkingDirectory(workingDirectory);
|
||||
m_rightEditor->setWorkingDirectory(workingDirectory);
|
||||
m_workingDirectory = workingDirectory;
|
||||
Differ differ;
|
||||
QList<DiffList> diffList;
|
||||
for (int i = 0; i < diffFileList.count(); i++) {
|
||||
@@ -1440,6 +1439,63 @@ void DiffEditorWidget::setFontSettings(const TextEditor::FontSettings &fontSetti
|
||||
colorDiff(m_contextFileData);
|
||||
}
|
||||
|
||||
void DiffEditorWidget::slotLeftJumpToOriginalFileRequested(int diffFileIndex,
|
||||
int lineNumber,
|
||||
int columnNumber)
|
||||
{
|
||||
if (diffFileIndex < 0 || diffFileIndex >= m_contextFileData.count())
|
||||
return;
|
||||
|
||||
const FileData fileData = m_contextFileData.at(diffFileIndex);
|
||||
const QString leftFileName = fileData.leftFileInfo.fileName;
|
||||
const QString rightFileName = fileData.rightFileInfo.fileName;
|
||||
if (leftFileName == rightFileName) {
|
||||
// The same file (e.g. in git diff), jump to the line number taken from the right editor.
|
||||
// Warning: git show SHA^ vs SHA or git diff HEAD vs Index
|
||||
// (when Working tree has changed in meantime) will not work properly.
|
||||
int leftLineNumber = 0;
|
||||
int rightLineNumber = 0;
|
||||
|
||||
for (int i = 0; i < fileData.chunks.count(); i++) {
|
||||
const ChunkData chunkData = fileData.chunks.at(i);
|
||||
for (int j = 0; j < chunkData.rows.count(); j++) {
|
||||
const RowData rowData = chunkData.rows.at(j);
|
||||
if (rowData.leftLine.textLineType == TextLineData::TextLine)
|
||||
leftLineNumber++;
|
||||
if (rowData.rightLine.textLineType == TextLineData::TextLine)
|
||||
rightLineNumber++;
|
||||
if (leftLineNumber == lineNumber) {
|
||||
int colNr = rowData.equal ? columnNumber : 0;
|
||||
jumpToOriginalFile(leftFileName, rightLineNumber, colNr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// different file (e.g. in Tools | Diff...)
|
||||
jumpToOriginalFile(leftFileName, lineNumber, columnNumber);
|
||||
}
|
||||
}
|
||||
|
||||
void DiffEditorWidget::slotRightJumpToOriginalFileRequested(int diffFileIndex,
|
||||
int lineNumber, int columnNumber)
|
||||
{
|
||||
if (diffFileIndex < 0 || diffFileIndex >= m_contextFileData.count())
|
||||
return;
|
||||
|
||||
const FileData fileData = m_contextFileData.at(diffFileIndex);
|
||||
const QString fileName = fileData.rightFileInfo.fileName;
|
||||
jumpToOriginalFile(fileName, lineNumber, columnNumber);
|
||||
}
|
||||
|
||||
void DiffEditorWidget::jumpToOriginalFile(const QString &fileName,
|
||||
int lineNumber, int columnNumber)
|
||||
{
|
||||
const QDir dir(m_workingDirectory);
|
||||
const QString absoluteFileName = dir.absoluteFilePath(fileName);
|
||||
Core::EditorManager::openEditorAt(absoluteFileName, lineNumber, columnNumber);
|
||||
}
|
||||
|
||||
void DiffEditorWidget::leftVSliderChanged()
|
||||
{
|
||||
m_rightEditor->verticalScrollBar()->setValue(m_leftEditor->verticalScrollBar()->value());
|
||||
|
||||
@@ -103,6 +103,8 @@ protected:
|
||||
|
||||
private slots:
|
||||
void setFontSettings(const TextEditor::FontSettings &fontSettings);
|
||||
void slotLeftJumpToOriginalFileRequested(int diffFileIndex, int lineNumber, int columnNumber);
|
||||
void slotRightJumpToOriginalFileRequested(int diffFileIndex, int lineNumber, int columnNumber);
|
||||
void leftVSliderChanged();
|
||||
void rightVSliderChanged();
|
||||
void leftHSliderChanged();
|
||||
@@ -135,6 +137,7 @@ private:
|
||||
FileData calculateContextData(const ChunkData &originalData) const;
|
||||
void showDiff();
|
||||
void synchronizeFoldings(DiffViewEditorWidget *source, DiffViewEditorWidget *destination);
|
||||
void jumpToOriginalFile(const QString &fileName, int lineNumber, int columnNumber);
|
||||
|
||||
DiffViewEditorWidget *m_leftEditor;
|
||||
DiffViewEditorWidget *m_rightEditor;
|
||||
@@ -143,6 +146,7 @@ private:
|
||||
QList<DiffList> m_diffList; // list of original outputs from differ
|
||||
QList<ChunkData> m_originalChunkData; // one big chunk for every file, ignoreWhitespaces taken into account
|
||||
QList<FileData> m_contextFileData; // ultimate data to be shown, contextLinesNumber taken into account
|
||||
QString m_workingDirectory;
|
||||
int m_contextLinesNumber;
|
||||
bool m_ignoreWhitespaces;
|
||||
bool m_syncScrollBars;
|
||||
|
||||
@@ -97,6 +97,12 @@ void BranchDialog::refresh(const QString &repository, bool force)
|
||||
m_ui->branchView->expandAll();
|
||||
}
|
||||
|
||||
void BranchDialog::refreshIfSame(const QString &repository)
|
||||
{
|
||||
if (m_repository == repository)
|
||||
refresh();
|
||||
}
|
||||
|
||||
void BranchDialog::enableButtons()
|
||||
{
|
||||
QModelIndex idx = selectedIndex();
|
||||
@@ -306,8 +312,7 @@ void BranchDialog::log()
|
||||
void BranchDialog::merge()
|
||||
{
|
||||
QModelIndex idx = selectedIndex();
|
||||
QTC_CHECK(m_model->isLocal(m_model->currentBranch())); // otherwise the button would not be enabled!
|
||||
QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled!
|
||||
QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled!
|
||||
|
||||
const QString branch = m_model->fullName(idx, true);
|
||||
GitClient *client = GitPlugin::instance()->gitClient();
|
||||
@@ -318,8 +323,7 @@ void BranchDialog::merge()
|
||||
void BranchDialog::rebase()
|
||||
{
|
||||
QModelIndex idx = selectedIndex();
|
||||
QTC_CHECK(m_model->isLocal(m_model->currentBranch())); // otherwise the button would not be enabled!
|
||||
QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled!
|
||||
QTC_CHECK(idx != m_model->currentBranch()); // otherwise the button would not be enabled!
|
||||
|
||||
const QString baseBranch = m_model->fullName(idx, true);
|
||||
GitClient *client = GitPlugin::instance()->gitClient();
|
||||
|
||||
@@ -61,6 +61,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void refresh(const QString &repository, bool force);
|
||||
void refreshIfSame(const QString &repository);
|
||||
|
||||
private slots:
|
||||
void enableButtons();
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
|
||||
bool isLeaf() const
|
||||
{
|
||||
return children.isEmpty();
|
||||
return children.isEmpty() && parent && parent->parent;
|
||||
}
|
||||
|
||||
bool childOf(BranchNode *node) const
|
||||
@@ -339,8 +339,12 @@ void BranchModel::clear()
|
||||
|
||||
bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage)
|
||||
{
|
||||
if (workingDirectory.isEmpty())
|
||||
beginResetModel();
|
||||
clear();
|
||||
if (workingDirectory.isEmpty()) {
|
||||
endResetModel();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_currentSha = m_client->synchronousTopRevision(workingDirectory);
|
||||
QStringList args;
|
||||
@@ -349,9 +353,6 @@ bool BranchModel::refresh(const QString &workingDirectory, QString *errorMessage
|
||||
if (!m_client->synchronousForEachRefCmd(workingDirectory, args, &output, errorMessage))
|
||||
VcsBase::VcsBaseOutputWindow::instance()->appendError(*errorMessage);
|
||||
|
||||
beginResetModel();
|
||||
clear();
|
||||
|
||||
m_workingDirectory = workingDirectory;
|
||||
const QStringList lines = output.split(QLatin1Char('\n'));
|
||||
foreach (const QString &l, lines)
|
||||
|
||||
@@ -2362,6 +2362,11 @@ void GitClient::finishSubmoduleUpdate()
|
||||
m_updatedSubmodules.clear();
|
||||
}
|
||||
|
||||
void GitClient::fetchFinished(const QVariant &cookie)
|
||||
{
|
||||
GitPlugin::instance()->updateBranches(cookie.toString());
|
||||
}
|
||||
|
||||
// Trim a git status file spec: "modified: foo .cpp" -> "modified: foo .cpp"
|
||||
static inline QString trimFileSpecification(QString fileSpec)
|
||||
{
|
||||
@@ -2974,7 +2979,9 @@ void GitClient::fetch(const QString &workingDirectory, const QString &remote)
|
||||
{
|
||||
QStringList arguments(QLatin1String("fetch"));
|
||||
arguments << (remote.isEmpty() ? QLatin1String("--all") : remote);
|
||||
executeGit(workingDirectory, arguments, 0, true);
|
||||
VcsBase::Command *command = executeGit(workingDirectory, arguments, 0, true);
|
||||
command->setCookie(workingDirectory);
|
||||
connect(command, SIGNAL(success(QVariant)), this, SLOT(fetchFinished(QVariant)));
|
||||
}
|
||||
|
||||
bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
|
||||
|
||||
@@ -327,6 +327,7 @@ private slots:
|
||||
void appendOutputData(const QByteArray &data) const;
|
||||
void appendOutputDataSilently(const QByteArray &data) const;
|
||||
void finishSubmoduleUpdate();
|
||||
void fetchFinished(const QVariant &cookie);
|
||||
|
||||
private:
|
||||
QTextCodec *getSourceCodec(const QString &file) const;
|
||||
|
||||
@@ -695,6 +695,8 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
||||
|
||||
connect(Core::ICore::vcsManager(), SIGNAL(repositoryChanged(QString)),
|
||||
this, SLOT(updateContinueAndAbortCommands()));
|
||||
connect(Core::ICore::vcsManager(), SIGNAL(repositoryChanged(QString)),
|
||||
this, SLOT(updateBranches(QString)), Qt::QueuedConnection);
|
||||
|
||||
if (!Core::ICore::mimeDatabase()->addMimeTypes(QLatin1String(RC_GIT_MIME_XML), errorMessage))
|
||||
return false;
|
||||
@@ -1435,6 +1437,12 @@ void GitPlugin::updateContinueAndAbortCommands()
|
||||
}
|
||||
}
|
||||
|
||||
void GitPlugin::updateBranches(const QString &repository)
|
||||
{
|
||||
if (m_branchDialog && m_branchDialog->isVisible())
|
||||
m_branchDialog->refreshIfSame(repository);
|
||||
}
|
||||
|
||||
void GitPlugin::updateRepositoryBrowserAction()
|
||||
{
|
||||
const bool repositoryEnabled = currentState().hasTopLevel();
|
||||
|
||||
@@ -102,6 +102,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void startCommit();
|
||||
void updateBranches(const QString &repository);
|
||||
|
||||
private slots:
|
||||
void diffCurrentFile();
|
||||
|
||||
@@ -76,8 +76,6 @@ bool LogChangeWidget::init(const QString &repository, const QString &commit, boo
|
||||
GitPlugin::instance()->gitClient()->msgNoCommits(includeRemote));
|
||||
return false;
|
||||
}
|
||||
selectionModel()->select(m_model->index(0, 0),
|
||||
QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -117,6 +115,8 @@ void LogChangeWidget::emitDoubleClicked(const QModelIndex &index)
|
||||
|
||||
bool LogChangeWidget::populateLog(const QString &repository, const QString &commit, bool includeRemote)
|
||||
{
|
||||
const QString currentCommit = this->commit();
|
||||
int selected = currentCommit.isEmpty() ? 0 : -1;
|
||||
if (const int rowCount = m_model->rowCount())
|
||||
m_model->removeRows(0, rowCount);
|
||||
|
||||
@@ -144,12 +144,15 @@ bool LogChangeWidget::populateLog(const QString &repository, const QString &comm
|
||||
}
|
||||
row.push_back(item);
|
||||
}
|
||||
row[Sha1Column]->setText(line.left(colonPos));
|
||||
const QString sha1 = line.left(colonPos);
|
||||
row[Sha1Column]->setText(sha1);
|
||||
row[SubjectColumn]->setText(line.right(line.size() - colonPos - 1));
|
||||
m_model->appendRow(row);
|
||||
if (selected == -1 && currentCommit == sha1)
|
||||
selected = m_model->rowCount() - 1;
|
||||
}
|
||||
}
|
||||
setCurrentIndex(m_model->index(0, 0));
|
||||
setCurrentIndex(m_model->index(selected, 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -174,8 +177,8 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) :
|
||||
if (isReset) {
|
||||
popUpLayout->addWidget(new QLabel(tr("Reset type:"), this));
|
||||
m_resetTypeComboBox = new QComboBox(this);
|
||||
m_resetTypeComboBox->addItem(tr("Mixed"), QLatin1String("--mixed"));
|
||||
m_resetTypeComboBox->addItem(tr("Hard"), QLatin1String("--hard"));
|
||||
m_resetTypeComboBox->addItem(tr("Mixed"), QLatin1String("--mixed"));
|
||||
m_resetTypeComboBox->addItem(tr("Soft"), QLatin1String("--soft"));
|
||||
popUpLayout->addWidget(m_resetTypeComboBox);
|
||||
popUpLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
|
||||
|
||||
@@ -97,6 +97,8 @@ EnvironmentAspectWidget::EnvironmentAspectWidget(EnvironmentAspect *aspect, QWid
|
||||
connect(m_aspect, SIGNAL(baseEnvironmentChanged()), this, SLOT(changeBaseEnvironment()));
|
||||
connect(m_aspect, SIGNAL(userEnvironmentChangesChanged(QList<Utils::EnvironmentItem>)),
|
||||
this, SLOT(changeUserChanges(QList<Utils::EnvironmentItem>)));
|
||||
connect(m_aspect, SIGNAL(environmentChanged()),
|
||||
this, SLOT(environmentChanged()));
|
||||
}
|
||||
|
||||
QString EnvironmentAspectWidget::displayName() const
|
||||
@@ -118,6 +120,7 @@ void EnvironmentAspectWidget::baseEnvironmentSelected(int idx)
|
||||
{
|
||||
m_ignoreChange = true;
|
||||
m_aspect->setBaseEnvironmentBase(m_baseEnvironmentComboBox->itemData(idx).toInt());
|
||||
m_environmentWidget->setBaseEnvironment(m_aspect->baseEnvironment());
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
@@ -132,6 +135,7 @@ void EnvironmentAspectWidget::changeBaseEnvironment()
|
||||
m_baseEnvironmentComboBox->setCurrentIndex(i);
|
||||
}
|
||||
m_environmentWidget->setBaseEnvironmentText(m_aspect->baseEnvironmentDisplayName(base));
|
||||
m_environmentWidget->setBaseEnvironment(m_aspect->baseEnvironment());
|
||||
}
|
||||
|
||||
void EnvironmentAspectWidget::userChangesEdited()
|
||||
@@ -148,4 +152,11 @@ void EnvironmentAspectWidget::changeUserChanges(QList<Utils::EnvironmentItem> ch
|
||||
m_environmentWidget->setUserChanges(changes);
|
||||
}
|
||||
|
||||
void EnvironmentAspectWidget::environmentChanged()
|
||||
{
|
||||
if (m_ignoreChange)
|
||||
return;
|
||||
m_environmentWidget->setBaseEnvironment(m_aspect->baseEnvironment());
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
@@ -67,6 +67,7 @@ private slots:
|
||||
void changeBaseEnvironment();
|
||||
void userChangesEdited();
|
||||
void changeUserChanges(QList<Utils::EnvironmentItem> changes);
|
||||
void environmentChanged();
|
||||
|
||||
private:
|
||||
EnvironmentAspect *m_aspect;
|
||||
|
||||
@@ -84,10 +84,8 @@ Utils::Environment LocalEnvironmentAspect::baseEnvironment() const
|
||||
|
||||
void LocalEnvironmentAspect::buildEnvironmentHasChanged()
|
||||
{
|
||||
if (baseEnvironmentBase() == static_cast<int>(BuildEnvironmentBase)) {
|
||||
emit baseEnvironmentChanged();
|
||||
if (baseEnvironmentBase() == static_cast<int>(BuildEnvironmentBase))
|
||||
emit environmentChanged();
|
||||
}
|
||||
}
|
||||
|
||||
LocalEnvironmentAspect::LocalEnvironmentAspect(RunConfiguration *rc) :
|
||||
|
||||
@@ -87,11 +87,8 @@ void RemoteLinuxEnvironmentAspect::setRemoteEnvironment(const Utils::Environment
|
||||
{
|
||||
if (env != m_remoteEnvironment) {
|
||||
m_remoteEnvironment = env;
|
||||
emit remoteEnvironmentChanged();
|
||||
if (baseEnvironmentBase() == static_cast<int>(RemoteBaseEnvironment)) {
|
||||
emit baseEnvironmentChanged();
|
||||
if (baseEnvironmentBase() == static_cast<int>(RemoteBaseEnvironment))
|
||||
emit environmentChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,9 +60,6 @@ public:
|
||||
|
||||
QString userEnvironmentChangesAsString() const;
|
||||
|
||||
signals:
|
||||
void remoteEnvironmentChanged();
|
||||
|
||||
private:
|
||||
enum BaseEnvironmentBase {
|
||||
CleanBaseEnvironment = 0,
|
||||
|
||||
@@ -64,7 +64,7 @@ QList<FilterEntry> LineNumberFilter::matchesFor(QFutureInterface<Locator::Filter
|
||||
int sectionCount = lineAndColumn.size();
|
||||
int line = 0;
|
||||
int column = 0;
|
||||
bool ok;
|
||||
bool ok = false;
|
||||
if (sectionCount > 0)
|
||||
line = lineAndColumn.at(0).toInt(&ok);
|
||||
if (ok && sectionCount > 1)
|
||||
|
||||
@@ -1037,7 +1037,12 @@ bool VcsBasePlugin::runFullySynchronous(const QString &workingDirectory,
|
||||
// if (flags & ExpectRepoChanges)
|
||||
// Core::DocumentManager::unexpectDirectoryChange(workingDirectory);
|
||||
|
||||
return process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0;
|
||||
if (process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0) {
|
||||
if (flags & ExpectRepoChanges)
|
||||
Core::ICore::vcsManager()->emitRepositoryChanged(workingDirectory);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VcsBasePlugin::runPatch(const QByteArray &input, const QString &workingDirectory,
|
||||
|
||||
Reference in New Issue
Block a user