Debugger: Re-organize passing of display formats

The current setup (dumper->gui: list of descriptions,
gui->dumper: index in list) is fragile and not easily
i18n'able. Go with an enum based approach now.

Change-Id: Ie78c596065a8b2ba87ad725274da29d4be3a6da4
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
hjk
2015-03-20 16:03:59 +01:00
parent b727c15a53
commit 48ac7c186b
11 changed files with 221 additions and 276 deletions

View File

@@ -807,7 +807,7 @@ public:
}
void addTypeFormats(const QString &type,
const QStringList &typeFormats, int current)
const DisplayFormats &typeFormats, int current)
{
const int row = m_layout->rowCount();
int column = 0;
@@ -815,7 +815,8 @@ public:
m_layout->addWidget(new QLabel(type), row, column++);
for (int i = -1; i != typeFormats.size(); ++i) {
QRadioButton *choice = new QRadioButton(this);
choice->setText(i == -1 ? TypeFormatsDialog::tr("Reset") : typeFormats.at(i));
choice->setText(i == -1 ? TypeFormatsDialog::tr("Reset")
: WatchHandler::nameForFormat(typeFormats.at(i)));
m_layout->addWidget(choice, row, column++);
if (i == current)
choice->setChecked(true);
@@ -868,7 +869,6 @@ private:
//
///////////////////////////////////////////////////////////////////////
TypeFormatsDialog::TypeFormatsDialog(QWidget *parent)
: QDialog(parent), m_ui(new TypeFormatsDialogUi(this))
{
@@ -888,7 +888,7 @@ TypeFormatsDialog::~TypeFormatsDialog()
}
void TypeFormatsDialog::addTypeFormats(const QString &type0,
const QStringList &typeFormats, int current)
const DisplayFormats &typeFormats, int current)
{
QString type = type0;
type.replace(QLatin1String("__"), QLatin1String("::"));
@@ -900,10 +900,5 @@ void TypeFormatsDialog::addTypeFormats(const QString &type0,
m_ui->pages[pos]->addTypeFormats(type, typeFormats, current);
}
DumperTypeFormats TypeFormatsDialog::typeFormats() const
{
return DumperTypeFormats();
}
} // namespace Internal
} // namespace Debugger