This will make it easier for all of us, and especially users, to find the right option.
Patch attached. Thoughts? Richard
>From aae53745c6131fc46533bf4141387d9e4f6c0376 Mon Sep 17 00:00:00 2001 From: Richard Heck <rgh...@lyx.org> Date: Fri, 28 Mar 2014 12:51:55 -0400 Subject: [PATCH] Sort debug options in the progress pane by string. --- src/frontends/qt4/GuiProgressView.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/frontends/qt4/GuiProgressView.cpp b/src/frontends/qt4/GuiProgressView.cpp index a22ea60..b5ee7dd 100644 --- a/src/frontends/qt4/GuiProgressView.cpp +++ b/src/frontends/qt4/GuiProgressView.cpp @@ -48,6 +48,17 @@ GuiProgressView::~GuiProgressView() } +namespace{ +typedef pair<int, QString> DebugMap; +typedef vector<DebugMap> DebugVector; + +bool DebugSorter(DebugMap const & a, DebugMap const & b) +{ + return a.second < b.second; +} +} + + GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags) : DockView(parent, "progress", qt_("Progress/Debug Messages"), area, flags) @@ -78,15 +89,25 @@ GuiProgressView::GuiProgressView(GuiView & parent, Qt::DockWidgetArea area, // ignore Debug::NONE and Debug::ANY int const level_count = Debug::levelCount() - 1; + DebugVector dmap; + for (int i = 1 ; i < level_count; i++) { + Debug::Type const level = Debug::value(i); + QString const desc = qt_(Debug::description(level)); + dmap.push_back(DebugMap(level, desc)); + } + sort(dmap.begin(), dmap.end(), DebugSorter); + QTreeWidgetItem * item = 0; widget_->debugMessagesTW->setColumnCount(2); widget_->debugMessagesTW->headerItem()->setText(0, qt_("Debug Level")); widget_->debugMessagesTW->headerItem()->setText(1, qt_("Set")); - for (int i = 1 ; i < level_count; i++) { + + DebugVector::const_iterator dit = dmap.begin(); + DebugVector::const_iterator const den = dmap.end(); + for (; dit != den; ++dit) { item = new QTreeWidgetItem(widget_->debugMessagesTW); - Debug::Type const level = Debug::value(i); - item->setText(0, qt_(Debug::description(level))); - item->setData(0, Qt::UserRole, int(level)); + item->setText(0, dit->second); + item->setData(0, Qt::UserRole, int(dit->first)); item->setText(1, qt_("No")); } widget_->debugMessagesTW->resizeColumnToContents(0); -- 1.7.11.7