Commit 9bfb54f5 authored by goro's avatar goro
Browse files

Migrate Perforce plugin to PathChooser

parent 8f757bd4
......@@ -39,18 +39,20 @@
#include <QtGui/QFileDialog>
using namespace Perforce::Internal;
using namespace Core::Utils;
SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
QWidget(parent)
{
m_ui.setupUi(this);
connect(m_ui.browseButton, SIGNAL(clicked()), this, SLOT(browseForCommand()));
m_ui.pathChooser->setPromptDialogTitle(tr("Perforce Command"));
m_ui.pathChooser->setExpectedKind(PathChooser::Command);
}
PerforceSettings SettingsPageWidget::settings() const
{
PerforceSettings rc;
rc.p4Command = m_ui.p4CmdLineEdit->text();
rc.p4Command = m_ui.pathChooser->path();
rc.defaultEnv = m_ui.defaultCheckBox->isChecked();
rc.p4Port = m_ui.portLineEdit->text();
rc.p4Client = m_ui.clientLineEdit->text();
......@@ -60,21 +62,13 @@ PerforceSettings SettingsPageWidget::settings() const
void SettingsPageWidget::setSettings(const PerforceSettings &s)
{
m_ui.p4CmdLineEdit->setText(s.p4Command);
m_ui.pathChooser->setPath(s.p4Command);
m_ui.defaultCheckBox->setChecked(s.defaultEnv);
m_ui.portLineEdit->setText(s.p4Port);
m_ui.clientLineEdit->setText(s.p4Client);
m_ui.userLineEdit->setText(s.p4User);
}
void SettingsPageWidget::browseForCommand()
{
const QString cmd = QFileDialog::getOpenFileName(window(), tr("Perforce Command"));
if (!cmd.isEmpty())
m_ui.p4CmdLineEdit->setText(cmd);
}
SettingsPage::SettingsPage()
{
}
......
......@@ -54,9 +54,6 @@ public:
PerforceSettings settings() const;
void setSettings(const PerforceSettings &);
private slots:;
void browseForCommand();
private:
Ui::SettingsPage m_ui;
};
......
......@@ -36,14 +36,7 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="p4CmdLineEdit"/>
</item>
<item>
<widget class="QToolButton" name="browseButton">
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="Core::Utils::PathChooser" name="pathChooser" native="true"/>
</item>
</layout>
</item>
......@@ -120,11 +113,18 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Core::Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>portLineEdit</tabstop>
<tabstop>clientLineEdit</tabstop>
<tabstop>userLineEdit</tabstop>
<tabstop>p4CmdLineEdit</tabstop>
</tabstops>
<resources/>
<connections>
......
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