Commit a8ac34c3 authored by Friedemann Kleint's avatar Friedemann Kleint

Options: Sort by category, id.

Separate category and trCategory and introduce sorting characters
to the categories. Same for id/name.
parent f9281451
......@@ -251,7 +251,7 @@ QString CMakeSettingsPage::trName() const
QString CMakeSettingsPage::category() const
{
return QLatin1String("CMake");
return QLatin1String("M.CMake");
}
QString CMakeSettingsPage::trCategory() const
......
......@@ -223,6 +223,9 @@ const char * const ICON_TOGGLE_SIDEBAR = ":/core/images/sidebaricon.png";
const char * const WIZARD_CATEGORY_QT = "M.Qt";
const char * const WIZARD_TR_CATEGORY_QT = QT_TRANSLATE_NOOP("Core", "Qt");
const char * const SETTINGS_CATEGORY_CORE = "A.Core";
const char * const SETTINGS_TR_CATEGORY_CORE = QT_TRANSLATE_NOOP("Core", "Environment");
} // namespace Constants
} // namespace Core
......
......@@ -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),
......
......@@ -44,6 +44,7 @@
#include <QtGui/QShortcut>
#include <QtGui/QHeaderView>
#include <QtGui/QFileDialog>
#include <QtCore/QCoreApplication>
#include <QtDebug>
Q_DECLARE_METATYPE(Core::Internal::ShortcutItem*);
......@@ -62,9 +63,10 @@ ShortcutSettings::~ShortcutSettings()
// IOptionsPage
QString ShortcutSettings::id() const
{
return QLatin1String("Keyboard");
return QLatin1String("D.Keyboard");
}
QString ShortcutSettings::trName() const
......@@ -74,12 +76,12 @@ QString ShortcutSettings::trName() const
QString ShortcutSettings::category() const
{
return QLatin1String("Environment");
return QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE);
}
QString ShortcutSettings::trCategory() const
{
return tr("Environment");
return QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE);
}
QWidget *ShortcutSettings::createPage(QWidget *parent)
......
......@@ -28,6 +28,7 @@
**************************************************************************/
#include "generalsettings.h"
#include "coreconstants.h"
#include <utils/stylehelper.h>
#include <utils/qtcolorbutton.h>
......@@ -37,6 +38,7 @@
#include <QtGui/QMessageBox>
#include <QtCore/QCoreApplication>
#include <QtCore/QTextStream>
#include "ui_generalsettings.h"
......@@ -51,7 +53,7 @@ GeneralSettings::GeneralSettings():
QString GeneralSettings::id() const
{
return QLatin1String("General");
return QLatin1String("A.General");
}
QString GeneralSettings::trName() const
......@@ -61,12 +63,12 @@ QString GeneralSettings::trName() const
QString GeneralSettings::category() const
{
return QLatin1String("Environment");
return QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE);
}
QString GeneralSettings::trCategory() const
{
return tr("Environment");
return QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE);
}
QWidget *GeneralSettings::createPage(QWidget *parent)
......
......@@ -28,10 +28,12 @@
**************************************************************************/
#include "codepastersettings.h"
#include "cpasterconstants.h"
#include <coreplugin/icore.h>
#include <QtCore/QSettings>
#include <QtCore/QCoreApplication>
#include <QtGui/QLineEdit>
#include <QtGui/QFileDialog>
#include <QtGui/QGroupBox>
......@@ -54,7 +56,7 @@ CodePasterSettingsPage::CodePasterSettingsPage()
QString CodePasterSettingsPage::id() const
{
return QLatin1String("CodePaster");
return QLatin1String("C.CodePaster");
}
QString CodePasterSettingsPage::trName() const
......@@ -64,12 +66,12 @@ QString CodePasterSettingsPage::trName() const
QString CodePasterSettingsPage::category() const
{
return QLatin1String("CodePaster");
return QLatin1String(Constants::CPASTER_SETTINGS_CATEGORY);
}
QString CodePasterSettingsPage::trCategory() const
{
return tr("Code Pasting");
return QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY);
}
QWidget *CodePasterSettingsPage::createPage(QWidget *parent)
......
......@@ -8,6 +8,7 @@ HEADERS += cpasterplugin.h \
protocol.h \
codepasterprotocol.h \
pasteview.h \
cpasterconstants.h \
codepastersettings.h \
pastebindotcomprotocol.h \
pastebindotcomsettings.h \
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/
#ifndef CPASTERCONSTANTS_H
#define CPASTERCONSTANTS_H
#include <QtCore/QtGlobal>
namespace CodePaster {
namespace Constants {
const char * const CPASTER_SETTINGS_CATEGORY = "X.CPaster";
const char * const CPASTER_SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("CodePaster", "Code Pasting");
}
}
#endif // CPASTERCONSTANTS_H
......@@ -28,10 +28,12 @@
**************************************************************************/
#include "pastebindotcomsettings.h"
#include "cpasterconstants.h"
#include "ui_pastebindotcomsettings.h"
#include <coreplugin/icore.h>
#include <QtCore/QSettings>
#include <QtCore/QCoreApplication>
PasteBinDotComSettings::PasteBinDotComSettings()
{
......@@ -45,7 +47,7 @@ PasteBinDotComSettings::PasteBinDotComSettings()
QString PasteBinDotComSettings::id() const
{
return QLatin1String("Pastebin.com");
return QLatin1String("B.Pastebin.com");
}
QString PasteBinDotComSettings::trName() const
......@@ -55,12 +57,12 @@ QString PasteBinDotComSettings::trName() const
QString PasteBinDotComSettings::category() const
{
return QLatin1String("CodePaster");
return QLatin1String(CodePaster::Constants::CPASTER_SETTINGS_CATEGORY);
}
QString PasteBinDotComSettings::trCategory() const
{
return tr("Code Pasting");
return QCoreApplication::translate("CodePaster", CodePaster::Constants::CPASTER_SETTINGS_TR_CATEGORY);
}
QWidget *PasteBinDotComSettings::createPage(QWidget *parent)
......
......@@ -28,6 +28,7 @@
**************************************************************************/
#include "settingspage.h"
#include "cpasterconstants.h"
#include <coreplugin/icore.h>
......@@ -38,6 +39,7 @@
#include <QtCore/QVariant>
#include <QtCore/QSettings>
#include <QtCore/QTextStream>
#include <QtCore/QCoreApplication>
using namespace CodePaster;
......@@ -61,7 +63,7 @@ SettingsPage::SettingsPage()
QString SettingsPage::id() const
{
return QLatin1String("General");
return QLatin1String("A.General");
}
QString SettingsPage::trName() const
......@@ -71,12 +73,12 @@ QString SettingsPage::trName() const
QString SettingsPage::category() const
{
return QLatin1String("CodePaster");
return QLatin1String(Constants::CPASTER_SETTINGS_CATEGORY);
}
QString SettingsPage::trCategory() const
{
return tr("Code Pasting");
return QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY);
}
QWidget *SettingsPage::createPage(QWidget *parent)
......
......@@ -32,9 +32,11 @@
#include "ui_completionsettingspage.h"
#include <coreplugin/icore.h>
#include <texteditor/texteditorconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <QtCore/QTextStream>
#include <QtCore/QCoreApplication>
using namespace CppTools::Internal;
......@@ -51,7 +53,7 @@ CompletionSettingsPage::~CompletionSettingsPage()
QString CompletionSettingsPage::id() const
{
return QLatin1String("Completion");
return QLatin1String("P.Completion");
}
QString CompletionSettingsPage::trName() const
......@@ -61,12 +63,13 @@ QString CompletionSettingsPage::trName() const
QString CompletionSettingsPage::category() const
{
return QLatin1String("TextEditor");
return QLatin1String(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY);
}
QString CompletionSettingsPage::trCategory() const
{
return tr("Text Editor");
return QCoreApplication::translate("Text Editor", TextEditor::Constants::TEXT_EDITOR_SETTINGS_TR_CATEGORY);
}
QWidget *CompletionSettingsPage::createPage(QWidget *parent)
......
......@@ -306,7 +306,7 @@ QString CppFileSettingsPage::id() const
QString CppFileSettingsPage::trName() const
{
return QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_ID);
return QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_NAME);
}
QString CppFileSettingsPage::category() const
......@@ -316,7 +316,7 @@ QString CppFileSettingsPage::category() const
QString CppFileSettingsPage::trCategory() const
{
return QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_CATEGORY);
return QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_TR_CATEGORY);
}
QWidget *CppFileSettingsPage::createPage(QWidget *parent)
......
......@@ -50,8 +50,10 @@ const char * const CPPTOOLS_SETTINGSGROUP = "CppTools";
const char * const LOWERCASE_CPPFILES_KEY = "LowerCaseFiles";
enum { lowerCaseFilesDefault = 1 };
const char * const CPP_SETTINGS_ID = QT_TRANSLATE_NOOP("CppTools", "File Naming");
const char * const CPP_SETTINGS_CATEGORY = QT_TRANSLATE_NOOP("CppTools", "C++");
const char * const CPP_SETTINGS_ID = "File Naming";
const char * const CPP_SETTINGS_NAME = QT_TRANSLATE_NOOP("CppTools", "File Naming");
const char * const CPP_SETTINGS_CATEGORY = "I.C++";
const char * const CPP_SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("CppTools", "C++");
} // namespace Constants
} // namespace CppTools
......
......@@ -88,7 +88,7 @@ SettingsPage::SettingsPage()
QString SettingsPage::id() const
{
return QLatin1String("CVS");
return QLatin1String(VCSBase::Constants::VCS_ID_CVS);
}
QString SettingsPage::trName() const
......@@ -103,7 +103,7 @@ QString SettingsPage::category() const
QString SettingsPage::trCategory() const
{
return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_CATEGORY);
return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_TR_CATEGORY);
}
QWidget *SettingsPage::createPage(QWidget *parent)
......
......@@ -39,8 +39,6 @@
#include <QtGui/QMessageBox>
#include <QtGui/QDesktopServices>
const char * const CDB_SETTINGS_ID = QT_TRANSLATE_NOOP("Debugger::Internal::CdbOptionsPageWidget", "Cdb");
static const char *dgbToolsDownloadLink32C = "http://www.microsoft.com/whdc/devtools/debugging/installx86.Mspx";
static const char *dgbToolsDownloadLink64C = "http://www.microsoft.com/whdc/devtools/debugging/install64bit.Mspx";
......@@ -160,12 +158,12 @@ QString CdbOptionsPage::trName() const
QString CdbOptionsPage::category() const
{
return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
return QLatin1String("P.Cdb");
}
QString CdbOptionsPage::trCategory() const
{
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
return tr("Cdb");
}
QWidget *CdbOptionsPage::createPage(QWidget *parent)
......
......@@ -52,8 +52,10 @@ const char * const M_DEBUG_VIEWS = "Debugger.Menu.View.Debug";
const char * const C_GDBDEBUGGER = "Gdb Debugger";
const char * const GDBRUNNING = "Gdb.Running";
const char * const DEBUGGER_COMMON_SETTINGS_PAGE = QT_TRANSLATE_NOOP("Debugger", "Common");
const char * const DEBUGGER_SETTINGS_CATEGORY = QT_TRANSLATE_NOOP("Debugger", "Debugger");
const char * const DEBUGGER_COMMON_SETTINGS_ID = "A.Common";
const char * const DEBUGGER_COMMON_SETTINGS_NAME = QT_TRANSLATE_NOOP("Debugger", "Common");
const char * const DEBUGGER_SETTINGS_CATEGORY = "O.Debugger";
const char * const DEBUGGER_SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("Debugger", "Debugger");
namespace Internal {
enum { debug = 0 };
......
......@@ -318,13 +318,13 @@ public:
// IOptionsPage
QString id() const
{ return QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_PAGE); }
{ return QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_ID); }
QString trName() const
{ return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_COMMON_SETTINGS_PAGE); }
{ return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_COMMON_SETTINGS_NAME); }
QString category() const
{ return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
QString trCategory() const
{ return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
{ return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY); }
QWidget *createPage(QWidget *parent);
void apply() { m_group.apply(settings()); }
......@@ -416,10 +416,10 @@ public:
DebuggingHelperOptionPage() {}
// IOptionsPage
QString id() const { return QLatin1String("DebuggingHelper"); }
QString id() const { return QLatin1String("B.DebuggingHelper"); }
QString trName() const { return tr("Debugging Helper"); }
QString category() const { return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
QString trCategory() const { return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
QString trCategory() const { return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY); }
QWidget *createPage(QWidget *parent);
void apply() { m_group.apply(settings()); }
......@@ -1257,7 +1257,7 @@ void DebuggerPlugin::showSettingsDialog()
{
Core::ICore::instance()->showOptionsDialog(
QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY),
QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_PAGE));
QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_ID));
}
void DebuggerPlugin::startExternalApplication()
......
......@@ -6,8 +6,6 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QTextStream>
const char * const GDB_SETTINGS_ID = QT_TRANSLATE_NOOP("Debugger::Internal::GdbOptionsPage", "Gdb");
namespace Debugger {
namespace Internal {
......@@ -17,12 +15,12 @@ GdbOptionsPage::GdbOptionsPage()
QString GdbOptionsPage::settingsId()
{
return QLatin1String(GDB_SETTINGS_ID);
return QLatin1String("M.Gdb");
}
QString GdbOptionsPage::trName() const
{
return tr(GDB_SETTINGS_ID);
return tr("Gdb");
}
QString GdbOptionsPage::category() const
......@@ -32,7 +30,7 @@ QString GdbOptionsPage::category() const
QString GdbOptionsPage::trCategory() const
{
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
}
QWidget *GdbOptionsPage::createPage(QWidget *parent)
......
......@@ -40,8 +40,6 @@
namespace Debugger {
namespace Internal {
const char * const TRK_SETTINGS_ID = QT_TRANSLATE_NOOP("Debugger::Internal::TrkOptionsPage", "Symbian TRK");
TrkOptionsPage::TrkOptionsPage(const TrkOptionsPtr &options) :
m_options(options)
{
......@@ -53,12 +51,12 @@ TrkOptionsPage::~TrkOptionsPage()
QString TrkOptionsPage::settingsId()
{
return QLatin1String(TRK_SETTINGS_ID);
return QLatin1String("S.Trk");
}
QString TrkOptionsPage::trName() const
{
return tr(TRK_SETTINGS_ID);
return tr("Symbian TRK");
}
QString TrkOptionsPage::category() const
......@@ -68,7 +66,7 @@ QString TrkOptionsPage::category() const
QString TrkOptionsPage::trCategory() const
{
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
}
QWidget *TrkOptionsPage::createPage(QWidget *parent)
......
......@@ -105,12 +105,12 @@ CppSettingsPage::CppSettingsPage(QObject *parent) : Core::IOptionsPage(parent)
QString CppSettingsPage::id() const
{
return QLatin1String(Designer::Constants::SETTINGS_CPP_SETTINGS);
return QLatin1String(Designer::Constants::SETTINGS_CPP_SETTINGS_ID);
}
QString CppSettingsPage::trName() const
{
return QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_CPP_SETTINGS);
return QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_CPP_SETTINGS_NAME);
}
QString CppSettingsPage::category() const
......@@ -120,7 +120,7 @@ QString CppSettingsPage::category() const
QString CppSettingsPage::trCategory() const
{
return QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_CATEGORY);
return QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_TR_CATEGORY);
}
QWidget *CppSettingsPage::createPage(QWidget *parent)
......
......@@ -35,8 +35,10 @@
namespace Designer {
namespace Constants {
const char * const SETTINGS_CATEGORY = QT_TRANSLATE_NOOP("Designer", "Designer");
const char * const SETTINGS_CPP_SETTINGS = QT_TRANSLATE_NOOP("Designer", "Class Generation");
const char * const SETTINGS_CATEGORY = "P.Designer";
const char * const SETTINGS_TR_CATEGORY = QT_TRANSLATE_NOOP("Designer", "Designer");
const char * const SETTINGS_CPP_SETTINGS_ID = "Class Generation";
const char * const SETTINGS_CPP_SETTINGS_NAME = QT_TRANSLATE_NOOP("Designer", "Class Generation");
// context
const char * const C_FORMEDITOR = "FormEditor";
......
......@@ -62,7 +62,7 @@ QString SettingsPage::category() const
QString SettingsPage::trCategory() const
{
return QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_CATEGORY);
return QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_TR_CATEGORY);
}
QWidget *SettingsPage::createPage(QWidget *parent)
......
......@@ -89,6 +89,8 @@ namespace Constants {
const char * const INSTALL_HANDLER = "TextEditor.FakeVimHandler";
const char * const MINI_BUFFER = "TextEditor.FakeVimMiniBuffer";
const char * const INSTALL_KEY = "Alt+V,Alt+V";
const char * const SETTINGS_CATEGORY = "D.FakeVim";
const char * const SETTINGS_ID = "General";
} // namespace Constants
} // namespace FakeVim
......@@ -111,9 +113,9 @@ public:
FakeVimOptionPage() {}
// IOptionsPage
QString id() const { return QLatin1String("General"); }
QString id() const { return QLatin1String(Constants::SETTINGS_ID); }
QString trName() const { return tr("General"); }
QString category() const { return QLatin1String("FakeVim"); }
QString category() const { return QLatin1String(Constants::SETTINGS_CATEGORY); }
QString trCategory() const { return tr("FakeVim"); }
QWidget *createPage(QWidget *parent);
......@@ -350,7 +352,8 @@ bool FakeVimPluginPrivate::initialize()
void FakeVimPluginPrivate::showSettingsDialog()
{
Core::ICore::instance()->showOptionsDialog("FakeVim", "General");
Core