Revert "Git: add completion to ChangeSelectionDialog"

Missing dependency

This reverts commit 724690132cf6d8fb812ea67e1665d7bbf7c5d290

Change-Id: Ib20b7bbd23b0a22e271006f951095d805e4639e1
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Orgad Shaneh
2013-12-22 08:46:52 +01:00
parent 1f4587955d
commit ddfec003ad
3 changed files with 2 additions and 55 deletions

View File

@@ -42,9 +42,6 @@
#include <QPlainTextEdit> #include <QPlainTextEdit>
#include <QDir> #include <QDir>
#include <QFileDialog> #include <QFileDialog>
#include <QCompleter>
#include <QStringListModel>
#include <QTimer>
namespace Git { namespace Git {
namespace Internal { namespace Internal {
@@ -63,9 +60,8 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, Co
m_ui->changeNumberEdit->setFocus(); m_ui->changeNumberEdit->setFocus();
m_ui->changeNumberEdit->selectAll(); m_ui->changeNumberEdit->selectAll();
connect(m_ui->changeNumberEdit, SIGNAL(textChanged(QString)), this, SLOT(changeTextChanged(QString))); connect(m_ui->changeNumberEdit, SIGNAL(textChanged(QString)), this, SLOT(recalculateDetails()));
connect(m_ui->workingDirectoryEdit, SIGNAL(textChanged(QString)), this, SLOT(recalculateDetails())); connect(m_ui->workingDirectoryEdit, SIGNAL(textChanged(QString)), this, SLOT(recalculateDetails()));
connect(m_ui->workingDirectoryEdit, SIGNAL(textChanged(QString)), this, SLOT(recalculateCompletion()));
connect(m_ui->selectDirectoryButton, SIGNAL(clicked()), this, SLOT(chooseWorkingDirectory())); connect(m_ui->selectDirectoryButton, SIGNAL(clicked()), this, SLOT(chooseWorkingDirectory()));
connect(m_ui->selectFromHistoryButton, SIGNAL(clicked()), this, SLOT(selectCommitFromRecentHistory())); connect(m_ui->selectFromHistoryButton, SIGNAL(clicked()), this, SLOT(selectCommitFromRecentHistory()));
connect(m_ui->showButton, SIGNAL(clicked()), this, SLOT(acceptShow())); connect(m_ui->showButton, SIGNAL(clicked()), this, SLOT(acceptShow()));
@@ -81,13 +77,7 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, Co
m_ui->checkoutButton->setDefault(true); m_ui->checkoutButton->setDefault(true);
else else
m_ui->showButton->setDefault(true); m_ui->showButton->setDefault(true);
m_changeModel = new QStringListModel(this);
QCompleter *changeCompleter = new QCompleter(m_changeModel, this);
m_ui->changeNumberEdit->setCompleter(changeCompleter);
changeCompleter->setCaseSensitivity(Qt::CaseInsensitive);
recalculateDetails(); recalculateDetails();
recalculateCompletion();
} }
ChangeSelectionDialog::~ChangeSelectionDialog() ChangeSelectionDialog::~ChangeSelectionDialog()
@@ -198,26 +188,6 @@ void ChangeSelectionDialog::enableButtons(bool b)
m_ui->checkoutButton->setEnabled(b); m_ui->checkoutButton->setEnabled(b);
} }
void ChangeSelectionDialog::recalculateCompletion()
{
const QString workingDir = workingDirectory();
if (workingDir == m_oldWorkingDir)
return;
m_oldWorkingDir = workingDir;
if (!workingDir.isEmpty()) {
GitClient *client = GitPlugin::instance()->gitClient();
QStringList args;
args << QLatin1String("--format=%(refname:short)");
QString output;
if (client->synchronousForEachRefCmd(workingDir, args, &output)) {
m_changeModel->setStringList(output.split(QLatin1Char('\n')));
return;
}
}
m_changeModel->setStringList(QStringList());
}
void ChangeSelectionDialog::recalculateDetails() void ChangeSelectionDialog::recalculateDetails()
{ {
if (m_process) { if (m_process) {
@@ -257,16 +227,5 @@ void ChangeSelectionDialog::recalculateDetails()
m_ui->detailsText->setPlainText(tr("Fetching commit data...")); m_ui->detailsText->setPlainText(tr("Fetching commit data..."));
} }
void ChangeSelectionDialog::changeTextChanged(const QString &text)
{
if (QCompleter *comp = m_ui->changeNumberEdit->completer()) {
if (text.isEmpty() && !comp->popup()->isVisible()) {
comp->setCompletionPrefix(text);
QTimer::singleShot(0, comp, SLOT(complete()));
}
}
recalculateDetails();
}
} // Internal } // Internal
} // Git } // Git

View File

@@ -41,7 +41,6 @@ class QLabel;
class QLineEdit; class QLineEdit;
class QPlainTextEdit; class QPlainTextEdit;
class QProcess; class QProcess;
class QStringListModel;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Git { namespace Git {
@@ -73,9 +72,7 @@ private slots:
void chooseWorkingDirectory(); void chooseWorkingDirectory();
void selectCommitFromRecentHistory(); void selectCommitFromRecentHistory();
void setDetails(int exitCode); void setDetails(int exitCode);
void recalculateCompletion();
void recalculateDetails(); void recalculateDetails();
void changeTextChanged(const QString &text);
void acceptCheckout(); void acceptCheckout();
void acceptCherryPick(); void acceptCherryPick();
void acceptRevert(); void acceptRevert();
@@ -90,8 +87,6 @@ private:
QString m_gitBinaryPath; QString m_gitBinaryPath;
QProcessEnvironment m_gitEnvironment; QProcessEnvironment m_gitEnvironment;
ChangeCommand m_command; ChangeCommand m_command;
QStringListModel *m_changeModel;
QString m_oldWorkingDir;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -39,7 +39,7 @@
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="Utils::CompletingLineEdit" name="changeNumberEdit"> <widget class="QLineEdit" name="changeNumberEdit">
<property name="text"> <property name="text">
<string>HEAD</string> <string>HEAD</string>
</property> </property>
@@ -119,13 +119,6 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>Utils::CompletingLineEdit</class>
<extends>QLineEdit</extends>
<header location="global">utils/completinglineedit.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>