Options: Sort by category, id.

Separate category and trCategory and introduce sorting characters
to the categories. Same for id/name.
This commit is contained in:
Friedemann Kleint
2009-11-27 16:12:12 +01:00
parent f928145163
commit a8ac34c347
51 changed files with 262 additions and 123 deletions

View File

@@ -189,10 +189,27 @@ static QStandardItemModel *pageModel(const QList<IOptionsPage*> &pages,
return model;
}
// ----------- SettingsDialog
// Helpers to sort by category. id
bool optionsPageLessThan(const IOptionsPage *p1, const IOptionsPage *p2)
{
if (const int cc = p1->category().compare(p2->category()))
return cc < 0;
return p1->id().compare(p2->id()) < 0;
}
static inline QList<Core::IOptionsPage*> sortedOptionsPages()
{
QList<Core::IOptionsPage*> rc = ExtensionSystem::PluginManager::instance()->getObjects<IOptionsPage>();
qStableSort(rc.begin(), rc.end(), optionsPageLessThan);
return rc;
}
SettingsDialog::SettingsDialog(QWidget *parent, const QString &categoryId,
const QString &pageId) :
QDialog(parent),
m_pages(ExtensionSystem::PluginManager::instance()->getObjects<IOptionsPage>()),
m_pages(sortedOptionsPages()),
m_proxyModel(new PageFilterModel),
m_model(0),
m_applied(false),