From: Richard Heck Date: Fri, 28 Mar 2014 16:51:55 +0000 (-0400) Subject: Sort debug options in the message pane by string. This makes it X-Git-Tag: 2.1.3~109 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=bd2c17f9fb599c434d0f1353c8d7dfce28dce42c;p=features.git Sort debug options in the message pane by string. This makes it much easier to find what you need, especially when we're trying to help users. Previously, they were sorted by their enum values. (cherry picked from commit de3daf040b09dfa719f7465b0eb29d276c75edcc) --- diff --git a/src/frontends/qt4/GuiProgressView.cpp b/src/frontends/qt4/GuiProgressView.cpp index a22ea60d01..b5ee7dd117 100644 --- a/src/frontends/qt4/GuiProgressView.cpp +++ b/src/frontends/qt4/GuiProgressView.cpp @@ -48,6 +48,17 @@ GuiProgressView::~GuiProgressView() } +namespace{ +typedef pair DebugMap; +typedef vector 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); diff --git a/status.21x b/status.21x index 1765c44d0c..44b6aecdf2 100644 --- a/status.21x +++ b/status.21x @@ -42,6 +42,7 @@ What's new * USER INTERFACE +- Debug options in message pane are now sorted alphabetically. * DOCUMENTATION AND LOCALIZATION