forked from qt-creator/qt-creator
Make the maemo settings widget searchable.
Reviewed-by: ck
This commit is contained in:
@@ -87,9 +87,16 @@ QIcon MaemoSettingsPage::categoryIcon() const
|
|||||||
return QIcon(QLatin1String(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON));
|
return QIcon(QLatin1String(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY_ICON));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MaemoSettingsPage::matches(const QString &searchKeyWord) const
|
||||||
|
{
|
||||||
|
return m_keywords.contains(searchKeyWord, Qt::CaseInsensitive);
|
||||||
|
}
|
||||||
|
|
||||||
QWidget *MaemoSettingsPage::createPage(QWidget *parent)
|
QWidget *MaemoSettingsPage::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
m_widget = new MaemoSettingsWidget(parent);
|
m_widget = new MaemoSettingsWidget(parent);
|
||||||
|
if (m_keywords.isEmpty())
|
||||||
|
m_keywords = m_widget->searchKeywords();
|
||||||
return m_widget;
|
return m_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,11 +61,13 @@ public:
|
|||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString displayCategory() const;
|
virtual QString displayCategory() const;
|
||||||
virtual QIcon categoryIcon() const;
|
virtual QIcon categoryIcon() const;
|
||||||
|
virtual bool matches(const QString &searchKeyWord) const;
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QString m_keywords;
|
||||||
MaemoSettingsWidget *m_widget;
|
MaemoSettingsWidget *m_widget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,8 @@
|
|||||||
#include "maemosshthread.h"
|
#include "maemosshthread.h"
|
||||||
|
|
||||||
#include <QtCore/QRegExp>
|
#include <QtCore/QRegExp>
|
||||||
|
#include <QtCore/QTextStream>
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
#include <QtGui/QMessageBox>
|
#include <QtGui/QMessageBox>
|
||||||
@@ -125,6 +127,33 @@ MaemoSettingsWidget::~MaemoSettingsWidget()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString MaemoSettingsWidget::searchKeywords() const
|
||||||
|
{
|
||||||
|
QString rc;
|
||||||
|
QTextStream(&rc) << m_ui->configurationLabel->text()
|
||||||
|
<< ' ' << m_ui->gdbServerLabel->text()
|
||||||
|
<< ' ' << m_ui->sshPortLabel->text()
|
||||||
|
<< ' ' << m_ui->keyButton->text()
|
||||||
|
<< ' ' << m_ui->passwordButton->text()
|
||||||
|
<< ' ' << m_ui->authTypeLabel->text()
|
||||||
|
<< ' ' << m_ui->connectionTimeoutLabel->text()
|
||||||
|
<< ' ' << m_ui->deviceButton->text()
|
||||||
|
<< ' ' << m_ui->simulatorButton->text()
|
||||||
|
<< ' ' << m_ui->deviceTypeLabel->text()
|
||||||
|
<< ' ' << m_ui->deviceNameLabel->text()
|
||||||
|
<< ' ' << m_ui->hostNameLabel->text()
|
||||||
|
<< ' ' << m_ui->keyLabel->text()
|
||||||
|
<< ' ' << m_ui->nameLineEdit->text()
|
||||||
|
<< ' ' << m_ui->passwordLabel->text()
|
||||||
|
<< ' ' << m_ui->portsLabel->text()
|
||||||
|
<< ' ' << m_ui->pwdLineEdit->text()
|
||||||
|
<< ' ' << m_ui->timeoutLineEdit->text()
|
||||||
|
<< ' ' << m_ui->userLineEdit->text()
|
||||||
|
<< ' ' << m_ui->userNameLabel->text();
|
||||||
|
rc.remove(QLatin1Char('&'));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
void MaemoSettingsWidget::initGui()
|
void MaemoSettingsWidget::initGui()
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
@@ -133,13 +162,15 @@ void MaemoSettingsWidget::initGui()
|
|||||||
m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File);
|
m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File);
|
||||||
foreach (const MaemoDeviceConfig &devConf, m_devConfs)
|
foreach (const MaemoDeviceConfig &devConf, m_devConfs)
|
||||||
m_ui->configurationComboBox->addItem(devConf.name);
|
m_ui->configurationComboBox->addItem(devConf.name);
|
||||||
connect(m_ui->configurationComboBox, SIGNAL(currentIndexChanged(int)), SLOT(currentConfigChanged(int)));
|
connect(m_ui->configurationComboBox, SIGNAL(currentIndexChanged(int)),
|
||||||
|
SLOT(currentConfigChanged(int)));
|
||||||
currentConfigChanged(m_ui->configurationComboBox->currentIndex());
|
currentConfigChanged(m_ui->configurationComboBox->currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoSettingsWidget::addConfig()
|
void MaemoSettingsWidget::addConfig()
|
||||||
{
|
{
|
||||||
const QString prefix = tr("New Device Configuration %1", "Standard Configuration name with number");
|
const QString prefix = tr("New Device Configuration %1", "Standard "
|
||||||
|
"Configuration name with number");
|
||||||
int suffix = 1;
|
int suffix = 1;
|
||||||
QString newName;
|
QString newName;
|
||||||
bool isUnique = false;
|
bool isUnique = false;
|
||||||
@@ -331,12 +362,9 @@ void MaemoSettingsWidget::deployKey()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_ui->deployKeyButton->disconnect();
|
m_ui->deployKeyButton->disconnect();
|
||||||
SshDeploySpec deploySpec(keyFile,
|
SshDeploySpec deploySpec(keyFile, homeDirOnDevice(currentConfig().uname)
|
||||||
homeDirOnDevice(currentConfig().uname)
|
+ QLatin1String("/.ssh/authorized_keys"), true);
|
||||||
+ QLatin1String("/.ssh/authorized_keys"),
|
m_keyDeployer = new MaemoSshDeployer(currentConfig(), QList<SshDeploySpec>() << deploySpec);
|
||||||
true);
|
|
||||||
m_keyDeployer = new MaemoSshDeployer(currentConfig(),
|
|
||||||
QList<SshDeploySpec>() << deploySpec);
|
|
||||||
connect(m_keyDeployer, SIGNAL(finished()),
|
connect(m_keyDeployer, SIGNAL(finished()),
|
||||||
this, SLOT(handleDeployThreadFinished()));
|
this, SLOT(handleDeployThreadFinished()));
|
||||||
m_ui->deployKeyButton->setText(tr("Stop deploying"));
|
m_ui->deployKeyButton->setText(tr("Stop deploying"));
|
||||||
@@ -350,11 +378,13 @@ void MaemoSettingsWidget::handleDeployThreadFinished()
|
|||||||
if (!m_keyDeployer)
|
if (!m_keyDeployer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_keyDeployer->hasError())
|
if (m_keyDeployer->hasError()) {
|
||||||
QMessageBox::critical(this, tr("Deployment Failed"), tr("Key deployment failed: %1").arg(m_keyDeployer->error()));
|
QMessageBox::critical(this, tr("Deployment Failed"),
|
||||||
else
|
tr("Key deployment failed: %1").arg(m_keyDeployer->error()));
|
||||||
QMessageBox::information(this, tr("Deployment Succeeded"), tr("Key was successfully deployed."));
|
} else {
|
||||||
|
QMessageBox::information(this, tr("Deployment Succeeded"),
|
||||||
|
tr("Key was successfully deployed."));
|
||||||
|
}
|
||||||
stopDeploying();
|
stopDeploying();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,8 +398,7 @@ void MaemoSettingsWidget::stopDeploying()
|
|||||||
delete m_keyDeployer;
|
delete m_keyDeployer;
|
||||||
m_keyDeployer = 0;
|
m_keyDeployer = 0;
|
||||||
m_ui->deployKeyButton->setText(tr("Deploy Key ..."));
|
m_ui->deployKeyButton->setText(tr("Deploy Key ..."));
|
||||||
connect(m_ui->deployKeyButton, SIGNAL(clicked()),
|
connect(m_ui->deployKeyButton, SIGNAL(clicked()), this, SLOT(deployKey()));
|
||||||
this, SLOT(deployKey()));
|
|
||||||
m_ui->deployKeyButton->setEnabled(buttonWasEnabled);
|
m_ui->deployKeyButton->setEnabled(buttonWasEnabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,10 @@ class MaemoSettingsWidget : public QWidget
|
|||||||
public:
|
public:
|
||||||
MaemoSettingsWidget(QWidget *parent);
|
MaemoSettingsWidget(QWidget *parent);
|
||||||
~MaemoSettingsWidget();
|
~MaemoSettingsWidget();
|
||||||
|
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
QString searchKeywords() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void currentConfigChanged(int index);
|
void currentConfigChanged(int index);
|
||||||
void addConfig();
|
void addConfig();
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>534</width>
|
<width>448</width>
|
||||||
<height>340</height>
|
<height>307</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="configurationLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Configuration:</string>
|
<string>Configuration:</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
<layout class="QFormLayout" name="formLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="deviceTypeLabel_2">
|
<widget class="QLabel" name="deviceNameLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Name</string>
|
<string>Name</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="hostNameLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Host Name:</string>
|
<string>Host Name:</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="portsLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Ports:</string>
|
<string>Ports:</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -207,7 +207,7 @@
|
|||||||
<item row="4" column="1">
|
<item row="4" column="1">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="sshPortLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>SSH:</string>
|
<string>SSH:</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -227,7 +227,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="gdbServerLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Gdb server:</string>
|
<string>Gdb server:</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -246,7 +246,7 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="connectionTimeoutLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Connection Timeout:</string>
|
<string>Connection Timeout:</string>
|
||||||
</property>
|
</property>
|
||||||
@@ -260,7 +260,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="userNameLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>User Name:</string>
|
<string>User Name:</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user