Commit e833b794 authored by hjk's avatar hjk

Use Core::Id in ICore::showOptionsDialog

Change-Id: I3865fde2347d687a7dee76dd5ca62db69cc4dd04
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 82f9de4a
......@@ -944,6 +944,5 @@ void ExternalToolManager::writeSettings()
void ExternalToolManager::openPreferences()
{
ICore::showOptionsDialog(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE),
QLatin1String(Core::Constants::SETTINGS_ID_TOOLS));
ICore::showOptionsDialog(Constants::SETTINGS_CATEGORY_CORE, Constants::SETTINGS_ID_TOOLS);
}
......@@ -71,10 +71,8 @@ static void showGraphicalShellError(QWidget *parent, const QString &app, const Q
QAbstractButton *settingsButton = mbox.addButton(QApplication::translate("Core::Internal", "Settings..."),
QMessageBox::ActionRole);
mbox.exec();
if (mbox.clickedButton() == settingsButton) {
ICore::showOptionsDialog(QLatin1String(Constants::SETTINGS_CATEGORY_CORE),
QLatin1String(Constants::SETTINGS_ID_ENVIRONMENT));
}
if (mbox.clickedButton() == settingsButton)
ICore::showOptionsDialog(Constants::SETTINGS_CATEGORY_CORE, Constants::SETTINGS_ID_ENVIRONMENT);
}
void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn)
......
......@@ -393,7 +393,7 @@ void ICore::showNewItemDialog(const QString &title,
m_mainwindow->showNewItemDialog(title, wizards, defaultLocation, extraVariables);
}
bool ICore::showOptionsDialog(const QString &group, const QString &page, QWidget *parent)
bool ICore::showOptionsDialog(const Id group, const Id page, QWidget *parent)
{
return m_mainwindow->showOptionsDialog(group, page, parent);
}
......@@ -401,7 +401,7 @@ bool ICore::showOptionsDialog(const QString &group, const QString &page, QWidget
bool ICore::showWarningWithOptions(const QString &title, const QString &text,
const QString &details,
Id settingsCategory,
const QString &settingsId,
Id settingsId,
QWidget *parent)
{
return m_mainwindow->showWarningWithOptions(title, text,
......
......@@ -82,14 +82,12 @@ public:
const QString &defaultLocation = QString(),
const QVariantMap &extraVariables = QVariantMap());
static bool showOptionsDialog(const QString &group = QString(),
const QString &page = QString(),
QWidget *parent = 0);
static bool showOptionsDialog(Id group, Id page, QWidget *parent = 0);
static bool showWarningWithOptions(const QString &title, const QString &text,
const QString &details = QString(),
Id settingsCategory = Id(),
const QString &settingsId = QString(),
Id settingsId = Id(),
QWidget *parent = 0);
static QT_DEPRECATED ActionManager *actionManager(); // Use Actionmanager::... directly.
......
......@@ -960,14 +960,12 @@ void MainWindow::showNewItemDialog(const QString &title,
wizard->runWizard(path, this, selectedPlatform, extraVariables);
}
bool MainWindow::showOptionsDialog(const QString &category,
const QString &page,
QWidget *parent)
bool MainWindow::showOptionsDialog(Id category, Id page, QWidget *parent)
{
emit m_coreImpl->optionsDialogRequested();
if (!parent)
parent = this;
SettingsDialog *dialog = SettingsDialog::getSettingsDialog(parent, category, page);
SettingsDialog *dialog = SettingsDialog::getSettingsDialog(parent, category.toString(), page.toString());
return dialog->execDialog();
}
......@@ -1349,7 +1347,7 @@ bool MainWindow::showWarningWithOptions(const QString &title,
const QString &text,
const QString &details,
Id settingsCategory,
const QString &settingsId,
Id settingsId,
QWidget *parent)
{
if (parent == 0)
......@@ -1359,11 +1357,10 @@ bool MainWindow::showWarningWithOptions(const QString &title,
if (!details.isEmpty())
msgBox.setDetailedText(details);
QAbstractButton *settingsButton = 0;
if (!settingsId.isEmpty() || settingsCategory.isValid())
if (settingsId.isValid() || settingsCategory.isValid())
settingsButton = msgBox.addButton(tr("Settings..."), QMessageBox::AcceptRole);
msgBox.exec();
if (settingsButton && msgBox.clickedButton() == settingsButton) {
return showOptionsDialog(settingsCategory.toString(), settingsId);
}
if (settingsButton && msgBox.clickedButton() == settingsButton)
return showOptionsDialog(settingsCategory, settingsId);
return false;
}
......@@ -138,14 +138,12 @@ public slots:
const QString &defaultLocation = QString(),
const QVariantMap &extraVariables = QVariantMap());
bool showOptionsDialog(const QString &category = QString(),
const QString &page = QString(),
QWidget *parent = 0);
bool showOptionsDialog(Id category, Id page, QWidget *parent = 0);
bool showWarningWithOptions(const QString &title, const QString &text,
const QString &details = QString(),
Id settingsCategory = Id(),
const QString &settingsId = QString(),
Id settingsId = Id(),
QWidget *parent = 0);
protected:
......
......@@ -168,8 +168,8 @@ bool Protocol::showConfigurationError(const Protocol *p,
mb.exec();
bool rc = false;
if (mb.clickedButton() == settingsButton)
rc = Core::ICore::showOptionsDialog(p->settingsPage()->category(),
p->settingsPage()->id(),
rc = Core::ICore::showOptionsDialog(Core::Id(p->settingsPage()->category()),
Core::Id(p->settingsPage()->id()),
parent);
return rc;
}
......
......@@ -2406,9 +2406,7 @@ void DebuggerPluginPrivate::onModeChanged(IMode *mode)
void DebuggerPluginPrivate::showSettingsDialog()
{
ICore::showOptionsDialog(
_(DEBUGGER_SETTINGS_CATEGORY),
_(DEBUGGER_COMMON_SETTINGS_ID));
ICore::showOptionsDialog(DEBUGGER_SETTINGS_CATEGORY, DEBUGGER_COMMON_SETTINGS_ID);
}
void DebuggerPluginPrivate::updateDebugWithoutDeployMenu()
......
......@@ -1281,8 +1281,8 @@ static void showQtDumperLibraryWarning(const QString &details)
dialog.exec();
if (dialog.clickedButton() == qtPref) {
Core::ICore::showOptionsDialog(
_(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
_(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID));
ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID);
} else if (dialog.clickedButton() == helperOff) {
debuggerCore()->action(UseDebuggingHelpers)->setValue(qVariantFromValue(false), false);
}
......
......@@ -4700,7 +4700,7 @@ void GdbEngine::startGdb(const QStringList &args)
handleGdbStartFailed();
handleAdapterStartFailed(
msgNoGdbBinaryForToolChain(sp.toolChainAbi),
_(Constants::DEBUGGER_COMMON_SETTINGS_ID));
Constants::DEBUGGER_COMMON_SETTINGS_ID);
return;
}
QStringList gdbArgs;
......@@ -4981,13 +4981,13 @@ void GdbEngine::abortDebugger()
}
void GdbEngine::handleAdapterStartFailed(const QString &msg,
const QString &settingsIdHint)
Core::Id settingsIdHint)
{
QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
showMessage(_("ADAPTER START FAILED"));
if (!msg.isEmpty()) {
const QString title = tr("Adapter start failed");
if (settingsIdHint.isEmpty()) {
if (!settingsIdHint.isValid()) {
Core::ICore::showWarningWithOptions(title, msg);
} else {
Core::ICore::showWarningWithOptions(title, msg, QString(),
......
......@@ -37,6 +37,8 @@
#include "watchutils.h"
#include "threaddata.h"
#include <coreplugin/id.h>
#include <QByteArray>
#include <QProcess>
#include <QHash>
......@@ -239,7 +241,7 @@ protected: ////////// Gdb Process Management //////////
// Something went wrong with the adapter *before* adapterStarted() was emitted.
// Make sure to clean up everything before emitting this signal.
void handleAdapterStartFailed(const QString &msg,
const QString &settingsIdHint = QString());
Core::Id settingsIdHint = Core::Id());
// This triggers the initial breakpoint synchronization and causes
// finishInferiorSetup() being called once done.
......
......@@ -1191,7 +1191,7 @@ void FakeVimPluginPrivate::maybeReadVimRc()
void FakeVimPluginPrivate::showSettingsDialog()
{
ICore::showOptionsDialog(_(SETTINGS_CATEGORY), _(SETTINGS_ID));
ICore::showOptionsDialog(SETTINGS_CATEGORY, SETTINGS_ID);
}
void FakeVimPluginPrivate::triggerAction(const Id &id)
......
......@@ -47,15 +47,10 @@ GerritOptionsPage::GerritOptionsPage(const QSharedPointer<GerritParameters> &p,
: VcsBase::VcsBaseOptionsPage(parent)
, m_parameters(p)
{
setId(optionsId());
setId(QLatin1String("Gerrit"));
setDisplayName(tr("Gerrit"));
}
QString GerritOptionsPage::optionsId()
{
return QLatin1String("Gerrit");
}
QWidget *GerritOptionsPage::createPage(QWidget *parent)
{
GerritOptionsWidget *gow = new GerritOptionsWidget(parent);
......
......@@ -75,8 +75,6 @@ public:
GerritOptionsPage(const QSharedPointer<GerritParameters> &p,
QObject *parent = 0);
static QString optionsId();
QWidget *createPage(QWidget *parent);
void apply();
void finish() { }
......
......@@ -360,8 +360,8 @@ void GerritPlugin::openView()
{
if (m_dialog.isNull()) {
while (!m_parameters->isValid()) {
const QString group = QLatin1String(VcsBase::Constants::VCS_SETTINGS_CATEGORY);
if (!Core::ICore::instance()->showOptionsDialog(group, GerritOptionsPage::optionsId()))
const Core::Id group = VcsBase::Constants::VCS_SETTINGS_CATEGORY;
if (!Core::ICore::instance()->showOptionsDialog(group, Core::Id("Gerrit")))
return;
}
GerritDialog *gd = new GerritDialog(m_parameters, Core::ICore::mainWindow());
......
......@@ -73,6 +73,8 @@
Q_DECLARE_METATYPE(Locator::ILocatorFilter*)
Q_DECLARE_METATYPE(Locator::FilterEntry)
using namespace Core;
namespace Locator {
namespace Internal {
......@@ -622,6 +624,5 @@ void LocatorWidget::showEvent(QShowEvent *event)
void LocatorWidget::showConfigureDialog()
{
Core::ICore::showOptionsDialog(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE),
QLatin1String(Constants::FILTER_OPTIONS_PAGE));
ICore::showOptionsDialog(Core::Constants::SETTINGS_CATEGORY_CORE, Constants::FILTER_OPTIONS_PAGE);
}
......@@ -92,7 +92,7 @@ private:
Q_SLOT void showSettingsPage()
{
Core::ICore::showOptionsDialog(MaemoQemuSettingsPage::pageCategory(),
MaemoQemuSettingsPage::pageId());
Core::Id(MaemoQemuSettingsPage::pageId()));
accept();
}
};
......@@ -105,7 +105,7 @@ MaemoQemuSettingsPage::MaemoQemuSettingsPage(QObject *parent)
{
setId(pageId());
setDisplayName(tr("MeeGo Qemu Settings"));
setCategory(pageCategory());
setCategory(pageCategory().toString());
//setDisplayCategory(QString()); // Will be set by device configurations page.
//setCategoryIcon(QIcon()) // See above.
}
......@@ -141,9 +141,9 @@ QString MaemoQemuSettingsPage::pageId()
return QLatin1String("ZZ.Qemu Settings");
}
QString MaemoQemuSettingsPage::pageCategory()
Core::Id MaemoQemuSettingsPage::pageCategory()
{
return QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
return ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY;
}
} // namespace Internal
......
......@@ -31,6 +31,7 @@
#define MAEMOSETTINGSPAGES_H
#include <coreplugin/dialogs/ioptionspage.h>
#include <coreplugin/id.h>
namespace Madde{
namespace Internal {
......@@ -50,7 +51,7 @@ public:
static void showQemuCrashDialog();
static QString pageId();
static QString pageCategory();
static Core::Id pageCategory();
private:
QString m_keywords;
......
......@@ -46,6 +46,8 @@
#include <QLabel>
#include <QPushButton>
using namespace Core;
namespace ProjectExplorer {
namespace Internal {
......@@ -186,8 +188,8 @@ void ToolChainInformationConfigWidget::toolChainUpdated(ProjectExplorer::ToolCha
void ToolChainInformationConfigWidget::manageToolChains()
{
Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
QLatin1String(ProjectExplorer::Constants::TOOLCHAIN_SETTINGS_PAGE_ID));
Core::ICore::showOptionsDialog(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
Constants::TOOLCHAIN_SETTINGS_PAGE_ID);
}
void ToolChainInformationConfigWidget::currentToolChainChanged(int idx)
......@@ -333,8 +335,8 @@ QWidget *DeviceInformationConfigWidget::buttonWidget() const
void DeviceInformationConfigWidget::manageDevices()
{
Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY),
QLatin1String(ProjectExplorer::Constants::DEVICE_SETTINGS_PAGE_ID));
ICore::showOptionsDialog(Constants::DEVICE_SETTINGS_CATEGORY,
Constants::DEVICE_SETTINGS_PAGE_ID);
}
void DeviceInformationConfigWidget::modelAboutToReset()
......
......@@ -193,6 +193,6 @@ void ProjectWizardPage::slotProjectChanged(int index)
void ProjectWizardPage::slotManageVcs()
{
Core::ICore::showOptionsDialog(QLatin1String(VcsBase::Constants::VCS_SETTINGS_CATEGORY),
QLatin1String(VcsBase::Constants::VCS_COMMON_SETTINGS_ID));
Core::ICore::showOptionsDialog(VcsBase::Constants::VCS_SETTINGS_CATEGORY,
VcsBase::Constants::VCS_COMMON_SETTINGS_ID);
}
......@@ -59,9 +59,11 @@
#include <QVBoxLayout>
#include <QToolTip>
using namespace ProjectExplorer;
using namespace ProjectExplorer::Internal;
using namespace Core;
namespace ProjectExplorer {
namespace Internal {
///
// TargetSettingsWidget
......@@ -593,13 +595,12 @@ void TargetSettingsPanelWidget::openTargetPreferences()
{
int targetIndex = m_selector->currentIndex();
if (targetIndex >= 0 && targetIndex < m_targets.size()) {
ProjectExplorer::KitOptionsPage *page =
ExtensionSystem::PluginManager::instance()->getObject<ProjectExplorer::KitOptionsPage>();
KitOptionsPage *page = ExtensionSystem::PluginManager::getObject<ProjectExplorer::KitOptionsPage>();
if (page)
page->showKit(m_targets.at(targetIndex)->kit());
}
Core::ICore::showOptionsDialog(QLatin1String(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
QLatin1String(Constants::KITS_SETTINGS_PAGE_ID));
ICore::showOptionsDialog(Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
Constants::KITS_SETTINGS_PAGE_ID);
}
int TargetSettingsPanelWidget::currentSubIndex() const
......@@ -611,3 +612,6 @@ void TargetSettingsPanelWidget::setCurrentSubIndex(int subIndex)
{
m_selector->setCurrentSubIndex(subIndex);
}
} // namespace Internal
} // namespace ProjectExplorer
......@@ -116,8 +116,8 @@ void QmlProjectPlugin::showQmlObserverToolWarning()
dialog.exec();
if (dialog.clickedButton() == qtPref) {
Core::ICore::showOptionsDialog(
QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
QLatin1String(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID));
ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID);
}
}
......
......@@ -228,8 +228,8 @@ void Qt4TargetSetupWidget::manageKit()
return;
page->showKit(m_kit);
Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
QLatin1String(ProjectExplorer::Constants::KITS_SETTINGS_PAGE_ID));
Core::ICore::showOptionsDialog(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
ProjectExplorer::Constants::KITS_SETTINGS_PAGE_ID);
}
void Qt4TargetSetupWidget::setProFilePath(const QString &proFilePath)
......
......@@ -625,8 +625,8 @@ void TargetSetupPage::updateVisibility()
void TargetSetupPage::openOptions()
{
Core::ICore::instance()->showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
QLatin1String(ProjectExplorer::Constants::KITS_SETTINGS_PAGE_ID),
Core::ICore::instance()->showOptionsDialog(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
ProjectExplorer::Constants::KITS_SETTINGS_PAGE_ID,
this);
}
......
......@@ -128,8 +128,8 @@ void QtKitConfigWidget::versionsChanged(const QList<int> &added, const QList<int
void QtKitConfigWidget::manageQtVersions()
{
Core::ICore::showOptionsDialog(QLatin1String(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY),
QLatin1String(QtSupport::Constants::QTVERSION_SETTINGS_PAGE_ID));
Core::ICore::showOptionsDialog(ProjectExplorer::Constants::PROJECTEXPLORER_SETTINGS_CATEGORY,
Constants::QTVERSION_SETTINGS_PAGE_ID);
}
void QtKitConfigWidget::currentWasChanged(int idx)
......
......@@ -51,9 +51,11 @@
#include <QDebug>
using namespace TextEditor;
using namespace Core;
using namespace TextEditor::Internal;
namespace TextEditor {
PlainTextEditor::PlainTextEditor(PlainTextEditorWidget *editor)
: BaseTextEditor(editor)
{
......@@ -218,11 +220,13 @@ QString PlainTextEditorWidget::findDefinitionId(const Core::MimeType &mimeType,
void PlainTextEditorWidget::acceptMissingSyntaxDefinitionInfo()
{
Core::ICore::showOptionsDialog(QLatin1String(Constants::TEXT_EDITOR_SETTINGS_CATEGORY),
QLatin1String(Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS));
ICore::showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY,
Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS);
}
void PlainTextEditorWidget::ignoreMissingSyntaxDefinitionInfo()
{
m_ignoreMissingSyntaxDefinition = true;
}
} // namespace TextEditor
......@@ -83,8 +83,8 @@ bool VcsConfigurationPage::isComplete() const
void VcsConfigurationPage::openConfiguration()
{
Core::ICore::showOptionsDialog(QLatin1String(VcsBase::Constants::VCS_SETTINGS_CATEGORY),
d->m_versionControl->id().toString());
Core::ICore::showOptionsDialog(Constants::VCS_SETTINGS_CATEGORY,
d->m_versionControl->id());
}
} // namespace VcsBase
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment