void QtTestPlugin::extensionsInitialized() { ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); Core::ICore *core = Core::ICore::instance(); Core::ActionManager *am = core->actionManager(); m_messageOutputWindow = new TestOutputWindow(); pm->addObject(m_messageOutputWindow); m_testResultsWindow = TestResultsWindow::instance(); connect(m_testResultsWindow, SIGNAL(stopTest()), this, SLOT(stopTesting())); connect(m_testResultsWindow, SIGNAL(retryFailedTests(QStringList)), this, SLOT(retryTests(QStringList))); connect(TestExecuter::instance(), SIGNAL(testStarted()), m_testResultsWindow, SLOT(onTestStarted())); connect(TestExecuter::instance(), SIGNAL(testStop()), m_testResultsWindow, SLOT(onTestStopped())); connect(TestExecuter::instance(), SIGNAL(testFinished()), m_testResultsWindow, SLOT(onTestFinished())); pm->addObject(m_testResultsWindow); connect(testResultsPane(), SIGNAL(defectSelected(TestCaseRec)), this, SLOT(onDefectSelected(TestCaseRec))); // Add context menu to CPP editor Core::ActionContainer *mcontext = am->actionContainer(CppEditor::Constants::M_CONTEXT); m_contextMenu->init(mcontext->menu(), 2, this); // Add context menu to JS editor mcontext = am->actionContainer(QmlJSEditor::Constants::M_CONTEXT); m_contextMenu->init(mcontext->menu(), 2, this); // Add a Test menu to the menu bar Core::ActionContainer* ac = am->createMenu("QtTestPlugin.TestMenu"); ac->menu()->setTitle(tr("&Test")); m_contextMenu->init(ac->menu(), 0, 0); // Insert the "Test" menu between "Window" and "Help". QMenu *windowMenu = am->actionContainer(Core::Constants::M_TOOLS)->menu(); QMenuBar *menuBar = am->actionContainer(Core::Constants::MENU_BAR)->menuBar(); menuBar->insertMenu(windowMenu->menuAction(), ac->menu()); ProjectExplorer::ProjectExplorerPlugin *explorer = ProjectExplorer::ProjectExplorerPlugin::instance(); connect(explorer->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), this, SLOT(onStartupProjectChanged(ProjectExplorer::Project *))); connect(core->progressManager(), SIGNAL(allTasksFinished(QString)), this, SLOT(onAllTasksFinished(QString))); connect(explorer->session(), SIGNAL(aboutToRemoveProject(ProjectExplorer::Project *)), this, SLOT(onProjectRemoved(ProjectExplorer::Project *))); m_contextMenu->init(0, 3, this); }
TextEditorSettings::TextEditorSettings(QObject *parent) : QObject(parent) , m_d(new Internal::TextEditorSettingsPrivate) { QTC_ASSERT(!m_instance, return); m_instance = this; ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); // Note: default background colors are coming from FormatDescription::background() // Add font preference page FormatDescriptions formatDescriptions; formatDescriptions.append(FormatDescription(QLatin1String(C_TEXT), tr("Text"))); // Special categories const QPalette p = QApplication::palette(); formatDescriptions.append(FormatDescription(QLatin1String(C_LINK), tr("Link"), Qt::blue)); formatDescriptions.append(FormatDescription(QLatin1String(C_SELECTION), tr("Selection"), p.color(QPalette::HighlightedText))); formatDescriptions.append(FormatDescription(QLatin1String(C_LINE_NUMBER), tr("Line Number"))); formatDescriptions.append(FormatDescription(QLatin1String(C_SEARCH_RESULT), tr("Search Result"))); formatDescriptions.append(FormatDescription(QLatin1String(C_SEARCH_SCOPE), tr("Search Scope"))); formatDescriptions.append(FormatDescription(QLatin1String(C_PARENTHESES), tr("Parentheses"))); formatDescriptions.append(FormatDescription(QLatin1String(C_CURRENT_LINE), tr("Current Line"))); FormatDescription currentLineNumber = FormatDescription(QLatin1String(C_CURRENT_LINE_NUMBER), tr("Current Line Number"), Qt::darkGray); currentLineNumber.format().setBold(true); formatDescriptions.append(currentLineNumber); formatDescriptions.append(FormatDescription(QLatin1String(C_OCCURRENCES), tr("Occurrences"))); formatDescriptions.append(FormatDescription(QLatin1String(C_OCCURRENCES_UNUSED), tr("Unused Occurrence"))); formatDescriptions.append(FormatDescription(QLatin1String(C_OCCURRENCES_RENAME), tr("Renaming Occurrence"))); // Standard categories formatDescriptions.append(FormatDescription(QLatin1String(C_NUMBER), tr("Number"), Qt::darkBlue)); formatDescriptions.append(FormatDescription(QLatin1String(C_STRING), tr("String"), Qt::darkGreen)); formatDescriptions.append(FormatDescription(QLatin1String(C_TYPE), tr("Type"), Qt::darkMagenta)); formatDescriptions.append(FormatDescription(QLatin1String(C_LOCAL), tr("Local"))); formatDescriptions.append(FormatDescription(QLatin1String(C_FIELD), tr("Field"), Qt::darkRed)); formatDescriptions.append(FormatDescription(QLatin1String(C_STATIC), tr("Static"), Qt::darkMagenta)); FormatDescription virtualMethodFormatDescriptor(QLatin1String(C_VIRTUAL_METHOD), tr("Virtual Method")); virtualMethodFormatDescriptor.format().setItalic(true); formatDescriptions.append(virtualMethodFormatDescriptor); formatDescriptions.append(FormatDescription(QLatin1String(C_KEYWORD), tr("Keyword"), Qt::darkYellow)); formatDescriptions.append(FormatDescription(QLatin1String(C_OPERATOR), tr("Operator"))); formatDescriptions.append(FormatDescription(QLatin1String(C_PREPROCESSOR), tr("Preprocessor"), Qt::darkBlue)); formatDescriptions.append(FormatDescription(QLatin1String(C_LABEL), tr("Label"), Qt::darkRed)); formatDescriptions.append(FormatDescription(QLatin1String(C_COMMENT), tr("Comment"), Qt::darkGreen)); formatDescriptions.append(FormatDescription(QLatin1String(C_DOXYGEN_COMMENT), tr("Doxygen Comment"), Qt::darkBlue)); formatDescriptions.append(FormatDescription(QLatin1String(C_DOXYGEN_TAG), tr("Doxygen Tag"), Qt::blue)); formatDescriptions.append(FormatDescription(QLatin1String(C_VISUAL_WHITESPACE), tr("Visual Whitespace"), Qt::lightGray)); formatDescriptions.append(FormatDescription(QLatin1String(C_DISABLED_CODE), tr("Disabled Code"))); // Diff categories formatDescriptions.append(FormatDescription(QLatin1String(C_ADDED_LINE), tr("Added Line"), QColor(0, 170, 0))); formatDescriptions.append(FormatDescription(QLatin1String(C_REMOVED_LINE), tr("Removed Line"), Qt::red)); formatDescriptions.append(FormatDescription(QLatin1String(C_DIFF_FILE), tr("Diff File"), Qt::darkBlue)); formatDescriptions.append(FormatDescription(QLatin1String(C_DIFF_LOCATION), tr("Diff Location"), Qt::blue)); m_d->m_fontSettingsPage = new FontSettingsPage(formatDescriptions, QLatin1String(Constants::TEXT_EDITOR_FONT_SETTINGS), this); pm->addObject(m_d->m_fontSettingsPage); // Add the GUI used to configure the tab, storage and interaction settings TextEditor::BehaviorSettingsPageParameters behaviorSettingsPageParameters; behaviorSettingsPageParameters.id = QLatin1String(Constants::TEXT_EDITOR_BEHAVIOR_SETTINGS); behaviorSettingsPageParameters.displayName = tr("Behavior"); behaviorSettingsPageParameters.settingsPrefix = QLatin1String("text"); m_d->m_behaviorSettingsPage = new BehaviorSettingsPage(behaviorSettingsPageParameters, this); pm->addObject(m_d->m_behaviorSettingsPage); TextEditor::DisplaySettingsPageParameters displaySettingsPageParameters; displaySettingsPageParameters.id = QLatin1String(Constants::TEXT_EDITOR_DISPLAY_SETTINGS), displaySettingsPageParameters.displayName = tr("Display"); displaySettingsPageParameters.settingsPrefix = QLatin1String("text"); m_d->m_displaySettingsPage = new DisplaySettingsPage(displaySettingsPageParameters, this); pm->addObject(m_d->m_displaySettingsPage); m_d->m_highlighterSettingsPage = new HighlighterSettingsPage(QLatin1String(Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS), this); pm->addObject(m_d->m_highlighterSettingsPage); m_d->m_snippetsSettingsPage = new SnippetsSettingsPage(QLatin1String(Constants::TEXT_EDITOR_SNIPPETS_SETTINGS), this); pm->addObject(m_d->m_snippetsSettingsPage); connect(m_d->m_fontSettingsPage, SIGNAL(changed(TextEditor::FontSettings)), this, SIGNAL(fontSettingsChanged(TextEditor::FontSettings))); connect(m_d->m_behaviorSettingsPage, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)), this, SIGNAL(tabSettingsChanged(TextEditor::TabSettings))); connect(m_d->m_behaviorSettingsPage, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)), this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings))); connect(m_d->m_behaviorSettingsPage, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings)), this, SIGNAL(behaviorSettingsChanged(TextEditor::BehaviorSettings))); connect(m_d->m_displaySettingsPage, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)), this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings))); // TODO: Move these settings to TextEditor category if (QSettings *s = Core::ICore::instance()->settings()) m_d->m_completionSettings.fromSettings(QLatin1String("CppTools/"), s); }
TextEditorSettings::TextEditorSettings(QObject *parent) : QObject(parent) { QTC_ASSERT(!m_instance, return); m_instance = this; ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); // Note: default background colors are coming from FormatDescription::background() // Add font preference page FormatDescriptions formatDescriptions; formatDescriptions.push_back(FormatDescription(QLatin1String(C_TEXT), tr("Text"))); // Special categories const QPalette p = QApplication::palette(); formatDescriptions.push_back(FormatDescription(QLatin1String(C_LINK), tr("Link"), Qt::blue)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_SELECTION), tr("Selection"), p.color(QPalette::HighlightedText))); formatDescriptions.push_back(FormatDescription(QLatin1String(C_LINE_NUMBER), tr("Line Number"))); formatDescriptions.push_back(FormatDescription(QLatin1String(C_SEARCH_RESULT), tr("Search Result"))); formatDescriptions.push_back(FormatDescription(QLatin1String(C_SEARCH_SCOPE), tr("Search Scope"))); formatDescriptions.push_back(FormatDescription(QLatin1String(C_PARENTHESES), tr("Parentheses"))); formatDescriptions.push_back(FormatDescription(QLatin1String(C_CURRENT_LINE), tr("Current Line"))); // Standard categories formatDescriptions.push_back(FormatDescription(QLatin1String(C_NUMBER), tr("Number"), Qt::darkBlue)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_STRING), tr("String"), Qt::darkGreen)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_TYPE), tr("Type"), Qt::darkMagenta)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_KEYWORD), tr("Keyword"), Qt::darkYellow)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_OPERATOR), tr("Operator"))); formatDescriptions.push_back(FormatDescription(QLatin1String(C_PREPROCESSOR), tr("Preprocessor"), Qt::darkBlue)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_LABEL), tr("Label"), Qt::darkRed)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_COMMENT), tr("Comment"), Qt::darkGreen)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_DOXYGEN_COMMENT), tr("Doxygen Comment"), Qt::darkBlue)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_DOXYGEN_TAG), tr("Doxygen Tag"), Qt::blue)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_DISABLED_CODE), tr("Disabled Code"), Qt::gray)); // Diff categories formatDescriptions.push_back(FormatDescription(QLatin1String(C_ADDED_LINE), tr("Added Line"), QColor(0, 170, 0))); formatDescriptions.push_back(FormatDescription(QLatin1String(C_REMOVED_LINE), tr("Removed Line"), Qt::red)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_DIFF_FILE), tr("Diff File"), Qt::darkBlue)); formatDescriptions.push_back(FormatDescription(QLatin1String(C_DIFF_LOCATION), tr("Diff Location"), Qt::blue)); m_fontSettingsPage = new FontSettingsPage(formatDescriptions, QLatin1String("TextEditor"), tr("Text Editor"), this); pm->addObject(m_fontSettingsPage); // Add the GUI used to configure the tab, storage and interaction settings TextEditor::BehaviorSettingsPageParameters behaviorSettingsPageParameters; behaviorSettingsPageParameters.name = tr("Behavior"); behaviorSettingsPageParameters.category = QLatin1String("TextEditor"); behaviorSettingsPageParameters.trCategory = tr("Text Editor"); behaviorSettingsPageParameters.settingsPrefix = QLatin1String("text"); m_behaviorSettingsPage = new BehaviorSettingsPage(behaviorSettingsPageParameters, this); pm->addObject(m_behaviorSettingsPage); TextEditor::DisplaySettingsPageParameters displaySettingsPageParameters; displaySettingsPageParameters.name = tr("Display"); displaySettingsPageParameters.category = QLatin1String("TextEditor"); displaySettingsPageParameters.trCategory = tr("Text Editor"); displaySettingsPageParameters.settingsPrefix = QLatin1String("text"); m_displaySettingsPage = new DisplaySettingsPage(displaySettingsPageParameters, this); pm->addObject(m_displaySettingsPage); connect(m_fontSettingsPage, SIGNAL(changed(TextEditor::FontSettings)), this, SIGNAL(fontSettingsChanged(TextEditor::FontSettings))); connect(m_behaviorSettingsPage, SIGNAL(tabSettingsChanged(TextEditor::TabSettings)), this, SIGNAL(tabSettingsChanged(TextEditor::TabSettings))); connect(m_behaviorSettingsPage, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings)), this, SIGNAL(storageSettingsChanged(TextEditor::StorageSettings))); connect(m_displaySettingsPage, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)), this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings))); }