forked from qt-creator/qt-creator
Settingsselector: Simplify code
Remove kindof string, thus making the message handling much easier. Change-Id: I0b447980a765138ad4be14c1ceb0f1f6e58e0c54 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
@@ -143,13 +143,8 @@ void SettingsSelector::removeButtonClicked()
|
|||||||
int pos = currentIndex();
|
int pos = currentIndex();
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
return;
|
return;
|
||||||
const QString title = m_kindOfDisplayName.isEmpty() ? tr("Remove") :
|
const QString title = tr("Remove");
|
||||||
tr("Remove %1").arg(m_kindOfDisplayName);
|
const QString message = tr("Do you really want to delete the configuration <b>%1</b>?")
|
||||||
const QString message = m_kindOfDisplayName.isEmpty() ?
|
|
||||||
tr("Do you really want to delete the configuration <b>%1</b>?")
|
|
||||||
.arg(m_configurationCombo->currentText()) :
|
|
||||||
tr("Do you really want to delete the %1 <b>%2</b>?")
|
|
||||||
.arg(m_kindOfDisplayName)
|
|
||||||
.arg(m_configurationCombo->currentText());
|
.arg(m_configurationCombo->currentText());
|
||||||
QMessageBox msgBox(QMessageBox::Question, title, message, QMessageBox::Yes|QMessageBox::No, this);
|
QMessageBox msgBox(QMessageBox::Question, title, message, QMessageBox::Yes|QMessageBox::No, this);
|
||||||
msgBox.setDefaultButton(QMessageBox::No);
|
msgBox.setDefaultButton(QMessageBox::No);
|
||||||
@@ -172,11 +167,7 @@ void SettingsSelector::renameButtonClicked()
|
|||||||
QString baseName = model->data(idx, Qt::EditRole).toString();
|
QString baseName = model->data(idx, Qt::EditRole).toString();
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
const QString &message = m_kindOfDisplayName.isEmpty() ?
|
const QString message = tr("New name for configuration <b>%1</b>:").arg(baseName);
|
||||||
tr("New name for configuration <b>%1</b>:")
|
|
||||||
.arg(baseName) :
|
|
||||||
tr("New name for %1: <b>%2</b>:")
|
|
||||||
.arg(m_kindOfDisplayName).arg(baseName);
|
|
||||||
|
|
||||||
QString name = QInputDialog::getText(this, tr("Rename..."), message,
|
QString name = QInputDialog::getText(this, tr("Rename..."), message,
|
||||||
QLineEdit::Normal, baseName, &ok);
|
QLineEdit::Normal, baseName, &ok);
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *m_label;
|
QLabel *m_label;
|
||||||
QString m_kindOfDisplayName;
|
|
||||||
QComboBox *m_configurationCombo;
|
QComboBox *m_configurationCombo;
|
||||||
QPushButton *m_addButton;
|
QPushButton *m_addButton;
|
||||||
QPushButton *m_removeButton;
|
QPushButton *m_removeButton;
|
||||||
|
|||||||
Reference in New Issue
Block a user