bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
    Q_UNUSED(arguments)
    Core::ICore *core = Core::ICore::instance();
    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/resourceeditor/ResourceEditor.mimetypes.xml"), errorMessage))
        return false;

    m_editor = new ResourceEditorFactory(this);
    addObject(m_editor);

    Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
    wizardParameters.setDescription(tr("Creates a Qt Resource file (.qrc)."));
    wizardParameters.setName(tr("Qt Resource file"));
    wizardParameters.setCategory(QLatin1String("Qt"));
    wizardParameters.setTrCategory(tr("Qt"));

    m_wizard = new ResourceWizard(wizardParameters, this);
    addObject(m_wizard);

    errorMessage->clear();

    // Register undo and redo
    Core::ActionManager * const actionManager = core->actionManager();
    int const pluginId = core->uniqueIDManager()->uniqueIdentifier(
            Constants::C_RESOURCEEDITOR);
    const QList<int> idList = QList<int>() << pluginId;
    m_undoAction = new QAction(tr("&Undo"), this);
    m_redoAction = new QAction(tr("&Redo"), this);
    actionManager->registerAction(m_undoAction, Core::Constants::UNDO, idList);
    actionManager->registerAction(m_redoAction, Core::Constants::REDO, idList);
    connect(m_undoAction, SIGNAL(triggered()), this, SLOT(onUndo()));
    connect(m_redoAction, SIGNAL(triggered()), this, SLOT(onRedo()));

    return true;
}
QuickToolBarSettings QuickToolBarSettings::get()
{
    Core::ICore *core = Core::ICore::instance();
    QuickToolBarSettings settings;
    settings.fromSettings(core->settings());
    return settings;
}
void BehaviorSettingsPage::apply()
{
    TabSettings newTabSettings;
    StorageSettings newStorageSettings;
    InteractionSettings newInteractionSettings;

    settingsFromUI(newTabSettings, newStorageSettings, newInteractionSettings);

    Core::ICore *core = Core::ICore::instance();
    QSettings *s = core->settings();

    if (newTabSettings != m_d->m_tabSettings) {
        m_d->m_tabSettings = newTabSettings;
        if (s)
            m_d->m_tabSettings.toSettings(m_d->m_parameters.settingsPrefix, s);

        emit tabSettingsChanged(newTabSettings);
    }

    if (newStorageSettings != m_d->m_storageSettings) {
        m_d->m_storageSettings = newStorageSettings;
        if (s)
            m_d->m_storageSettings.toSettings(m_d->m_parameters.settingsPrefix, s);

        emit storageSettingsChanged(newStorageSettings);
    }

    if (newInteractionSettings != m_d->m_interactionSettings) {
        m_d->m_interactionSettings = newInteractionSettings;
        if (s)
            m_d->m_interactionSettings.toSettings(m_d->m_parameters.settingsPrefix, s);
    }
}
bool QtScriptEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message)
{
    typedef SharedTools::QScriptHighlighter QScriptHighlighter;

    Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/qtscripteditor/QtScriptEditor.mimetypes.xml"), error_message))
        return false;
    m_scriptcontext << core->uniqueIDManager()->uniqueIdentifier(QtScriptEditor::Constants::C_QTSCRIPTEDITOR);
    m_context = m_scriptcontext;
    m_context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);

    registerActions(core);

    m_editor = new QtScriptEditorFactory(core, m_context, this);
    addObject(m_editor);

    Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
    wizardParameters.setDescription(tr("Qt Script file"));
    wizardParameters.setName(tr("Qt Script file"));
    wizardParameters.setCategory(QLatin1String("Qt"));
    wizardParameters.setTrCategory(tr("Qt"));
    m_wizard = new TextEditor::TextFileWizard(QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR_MIMETYPE),
                                              QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR),
                                              QLatin1String("qtscript$"),
                                              wizardParameters, core, this);
    addObject(m_wizard);

    error_message->clear();
    return true;
}
示例#5
0
bool CdbSymbolPathListEditor::promptToAddSymbolServer(const QString &settingsGroup, QStringList *symbolPaths)
{
    // Check symbol server unless the user has an external/internal setup
    if (!qgetenv("_NT_SYMBOL_PATH").isEmpty()
            || CdbSymbolPathListEditor::indexOfSymbolServerPath(*symbolPaths) != -1)
        return false;
    // Prompt to use Symbol server unless the user checked "No nagging".
    Core::ICore *core = Core::ICore::instance();
    const QString nagSymbolServerKey = settingsGroup + QLatin1String("/NoPromptSymbolServer");
    bool noFurtherNagging = core->settings()->value(nagSymbolServerKey, false).toBool();
    if (noFurtherNagging)
        return false;

    const QString symServUrl = QLatin1String("http://support.microsoft.com/kb/311503");
    const QString msg = tr("<html><head/><body><p>The debugger is not configured to use the public "
                           "<a href=\"%1\">Microsoft Symbol Server</a>. This is recommended "
                           "for retrieval of the symbols of the operating system libraries.</p>"
                           "<p><i>Note:</i> A fast internet connection is required for this to work smoothly. Also, a delay "
                           "might occur when connecting for the first time.</p>"
                           "<p>Would you like to set it up?</p></br>"
                           "</body></html>").arg(symServUrl);
    const QDialogButtonBox::StandardButton answer =
        Utils::CheckableMessageBox::question(core->mainWindow(), tr("Symbol Server"), msg,
                tr("Do not ask again"), &noFurtherNagging);
    core->settings()->setValue(nagSymbolServerKey, noFurtherNagging);
    if (answer == QDialogButtonBox::No)
        return false;
    // Prompt for path and add it. Synchronize QSetting and debugger.
    const QString cacheDir = CdbSymbolPathListEditor::promptCacheDirectory(core->mainWindow());
    if (cacheDir.isEmpty())
        return false;

    symbolPaths->push_back(CdbSymbolPathListEditor::symbolServerPath(cacheDir));
    return true;
}
示例#6
0
// Set up new class widget from settings
void ClassNamePage::initParameters()
{
    Core::ICore *core = Core::ICore::instance();
    const Core::MimeDatabase *mdb = core->mimeDatabase();
    m_newClassWidget->setHeaderExtension(mdb->preferredSuffixByType(QLatin1String(Constants::CPP_HEADER_MIMETYPE)));
    m_newClassWidget->setSourceExtension(mdb->preferredSuffixByType(QLatin1String(Constants::CPP_SOURCE_MIMETYPE)));
    m_newClassWidget->setLowerCaseFiles(lowerCaseFiles(core));
}
// Set up new class widget from settings
void FormClassWizardPage::initFileGenerationSettings()
{
    Core::ICore *core = Core::ICore::instance();
    const Core::MimeDatabase *mdb = core->mimeDatabase();
    m_ui->newClassWidget->setHeaderExtension(mdb->preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_HEADER_MIMETYPE)));
    m_ui->newClassWidget->setSourceExtension(mdb->preferredSuffixByType(QLatin1String(CppTools::Constants::CPP_SOURCE_MIMETYPE)));
    m_ui->newClassWidget->setLowerCaseFiles(lowercaseHeaderFiles());
}
bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{
    Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage))
        return false;
    addAutoReleasedObject(new CMakeManager());
    addAutoReleasedObject(new CMakeRunConfigurationFactory());
    return true;
}
示例#9
0
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);
}
示例#10
0
/*! Initializes the plugin. Returns true on success.
    Plugins want to register objects with the plugin manager here.

    \a error_message can be used to pass an error message to the plugin system,
       if there was any.
*/
bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *error_message)
{
    Q_UNUSED(arguments)
    Q_UNUSED(error_message)

    // Get the primary access point to the workbench.
    Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();

    // Create a unique context id for our own view, that will be used for the
    // menu entry later.
    QList<int> context = QList<int>()
        << core->uniqueIDManager()->uniqueIdentifier(
                QLatin1String("HelloWorld.MainView"));

    // Create an action to be triggered by a menu entry
    QAction *helloWorldAction = new QAction("Say \"&Hello World!\"", this);
    connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld()));

    // Register the action with the action manager
    Core::ActionManagerInterface *actionManager = core->actionManager();
    Core::ICommand *command =
            actionManager->registerAction(
                    helloWorldAction, "HelloWorld.HelloWorldAction", context);

    // Create our own menu to place in the Tools menu
    Core::IActionContainer *helloWorldMenu =
            actionManager->createMenu("HelloWorld.HelloWorldMenu");
    QMenu *menu = helloWorldMenu->menu();
    menu->setTitle(tr("&Hello World"));
    menu->setEnabled(true);

    // Add the Hello World action command to the menu
    helloWorldMenu->addAction(command);

    // Request the Tools menu and add the Hello World menu to it
    Core::IActionContainer *toolsMenu =
            actionManager->actionContainer(Core::Constants::M_TOOLS);
    toolsMenu->addMenu(helloWorldMenu);

    // Add a mode with a push button based on BaseMode. Like the BaseView,
    // it will unregister itself from the plugin manager when it is deleted.
    Core::BaseMode *baseMode = new Core::BaseMode;
    baseMode->setUniqueModeName("HelloWorld.HelloWorldMode");
    baseMode->setName(tr("Hello world!"));
    baseMode->setIcon(QIcon());
    baseMode->setPriority(0);
    baseMode->setWidget(new QPushButton(tr("Hello World PushButton!")));
    addAutoReleasedObject(baseMode);

    // Add the Hello World action command to the mode manager (with 0 priority)
    Core::ModeManager *modeManager = core->modeManager();
    modeManager->addAction(command, 0);

    return true;
}
示例#11
0
bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
{
    Q_UNUSED(arguments)
    Q_UNUSED(error)

    qRegisterMetaType<CppTools::CppCodeStyleSettings>("CppTools::CppCodeStyleSettings");

    Core::ICore *core = Core::ICore::instance();
    Core::ActionManager *am = core->actionManager();

    m_settings = new CppToolsSettings(this); // force registration of cpp tools settings

    // Objects
    m_modelManager = new CppModelManager(this);
    Core::VcsManager *vcsManager = core->vcsManager();
    Core::FileManager *fileManager = core->fileManager();
    connect(vcsManager, SIGNAL(repositoryChanged(QString)),
            m_modelManager, SLOT(updateModifiedSourceFiles()));
    connect(fileManager, SIGNAL(filesChangedInternally(QStringList)),
            m_modelManager, SLOT(updateSourceFiles(QStringList)));
    addAutoReleasedObject(m_modelManager);

    addAutoReleasedObject(new CppCompletionAssistProvider);
    addAutoReleasedObject(new CppLocatorFilter(m_modelManager));
    addAutoReleasedObject(new CppClassesFilter(m_modelManager));
    addAutoReleasedObject(new CppFunctionsFilter(m_modelManager));
    addAutoReleasedObject(new CppCurrentDocumentFilter(m_modelManager, core->editorManager()));
    addAutoReleasedObject(new CompletionSettingsPage);
    addAutoReleasedObject(new CppFileSettingsPage(m_fileSettings));
    addAutoReleasedObject(new SymbolsFindFilter(m_modelManager));
    addAutoReleasedObject(new CppCodeStyleSettingsPage);

    TextEditor::CodeStylePreferencesManager::instance()->registerFactory(
                new CppTools::CppCodeStylePreferencesFactory());

    // Menus
    Core::ActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS);
    Core::ActionContainer *mcpptools = am->createMenu(CppTools::Constants::M_TOOLS_CPP);
    QMenu *menu = mcpptools->menu();
    menu->setTitle(tr("&C++"));
    menu->setEnabled(true);
    mtools->addMenu(mcpptools);

    // Actions
    Core::Context context(CppEditor::Constants::C_CPPEDITOR);

    QAction *switchAction = new QAction(tr("Switch Header/Source"), this);
    Core::Command *command = am->registerAction(switchAction, Constants::SWITCH_HEADER_SOURCE, context, true);
    command->setDefaultKeySequence(QKeySequence(Qt::Key_F4));
    mcpptools->addAction(command);
    connect(switchAction, SIGNAL(triggered()), this, SLOT(switchHeaderSource()));

    return true;
}
void InspectorPlugin::extensionsInitialized()
{
    ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();

    connect(pluginManager, SIGNAL(objectAdded(QObject*)), SLOT(objectAdded(QObject*)));
    connect(pluginManager, SIGNAL(aboutToRemoveObject(QObject*)), SLOT(aboutToRemoveObject(QObject*)));

    Core::ICore *core = Core::ICore::instance();
    connect(core->modeManager(), SIGNAL(currentModeAboutToChange(Core::IMode*)),
            this, SLOT(modeAboutToChange(Core::IMode*)));
}
void DisplaySettingsPage::setDisplaySettings(const DisplaySettings &newDisplaySettings)
{
    if (newDisplaySettings != m_d->m_displaySettings) {
        m_d->m_displaySettings = newDisplaySettings;
        Core::ICore *core = Core::ICore::instance();
        if (QSettings *s = core->settings())
            m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s);

        emit displaySettingsChanged(newDisplaySettings);
    }
}
示例#14
0
OutputWindow::OutputWindow(Core::Context context, QWidget *parent)
    : QPlainTextEdit(parent)
    , m_formatter(0)
    , m_enforceNewline(false)
    , m_scrollToBottom(false)
    , m_linksActive(true)
    , m_mousePressed(false)
    , m_maxLineCount(100000)
{
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    //setCenterOnScroll(false);
    setFrameShape(QFrame::NoFrame);
    setMouseTracking(true);

    Core::ICore *core = Core::ICore::instance();

    m_outputWindowContext = new Core::IContext;
    m_outputWindowContext->setContext(context);
    m_outputWindowContext->setWidget(this);
    core->addContextObject(m_outputWindowContext);

    QAction *undoAction = new QAction(this);
    QAction *redoAction = new QAction(this);
    QAction *cutAction = new QAction(this);
    QAction *copyAction = new QAction(this);
    QAction *pasteAction = new QAction(this);
    QAction *selectAllAction = new QAction(this);

    Core::ActionManager *am = core->actionManager();
    am->registerAction(undoAction, Core::Constants::UNDO, context);
    am->registerAction(redoAction, Core::Constants::REDO, context);
    am->registerAction(cutAction, Core::Constants::CUT, context);
    am->registerAction(copyAction, Core::Constants::COPY, context);
    am->registerAction(pasteAction, Core::Constants::PASTE, context);
    am->registerAction(selectAllAction, Core::Constants::SELECTALL, context);

    connect(undoAction, SIGNAL(triggered()), this, SLOT(undo()));
    connect(redoAction, SIGNAL(triggered()), this, SLOT(redo()));
    connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()));
    connect(copyAction, SIGNAL(triggered()), this, SLOT(copy()));
    connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
    connect(selectAllAction, SIGNAL(triggered()), this, SLOT(selectAll()));

    connect(this, SIGNAL(undoAvailable(bool)), undoAction, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(redoAvailable(bool)), redoAction, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(copyAvailable(bool)), cutAction, SLOT(setEnabled(bool)));  // OutputWindow never read-only
    connect(this, SIGNAL(copyAvailable(bool)), copyAction, SLOT(setEnabled(bool)));

    undoAction->setEnabled(false);
    redoAction->setEnabled(false);
    cutAction->setEnabled(false);
    copyAction->setEnabled(false);
}
示例#15
0
PythonCurrentDocumentFilter::PythonCurrentDocumentFilter(
    WorkerPool<WorkerClient>* worker_pool, const PythonIcons* icons)
  : PythonFilterBase(worker_pool, icons)
{
  Core::ICore* core = Core::ICore::instance();
  Core::EditorManager* editor_manager = core->editorManager();

  connect(editor_manager, SIGNAL(currentEditorChanged(Core::IEditor*)),
          SLOT(CurrentEditorChanged(Core::IEditor*)));

  setShortcutString(".");
}
OutputWindow::OutputWindow(QWidget *parent)
    : QPlainTextEdit(parent)
    , m_enforceNewline(false)
    , m_scrollToBottom(false)
{
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    //setCenterOnScroll(false);
    setWindowTitle(tr("Application Output Window"));
    setWindowIcon(QIcon(":/qt4projectmanager/images/window.png"));
    setFrameShape(QFrame::NoFrame);
    setMouseTracking(true);

    static uint usedIds = 0;
    Core::ICore *core = Core::ICore::instance();
    QList<int> context;
    context << core->uniqueIDManager()->uniqueIdentifier(QString(Constants::C_APP_OUTPUT) + QString().setNum(usedIds++));
    m_outputWindowContext = new Core::BaseContext(this, context);
    core->addContextObject(m_outputWindowContext);

    QAction *undoAction = new QAction(this);
    QAction *redoAction = new QAction(this);
    QAction *cutAction = new QAction(this);
    QAction *copyAction = new QAction(this);
    QAction *pasteAction = new QAction(this);
    QAction *selectAllAction = new QAction(this);

    Core::ActionManager *am = core->actionManager();
    am->registerAction(undoAction, Core::Constants::UNDO, context);
    am->registerAction(redoAction, Core::Constants::REDO, context);
    am->registerAction(cutAction, Core::Constants::CUT, context);
    am->registerAction(copyAction, Core::Constants::COPY, context);
    am->registerAction(pasteAction, Core::Constants::PASTE, context);
    am->registerAction(selectAllAction, Core::Constants::SELECTALL, context);

    connect(undoAction, SIGNAL(triggered()), this, SLOT(undo()));
    connect(redoAction, SIGNAL(triggered()), this, SLOT(redo()));
    connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()));
    connect(copyAction, SIGNAL(triggered()), this, SLOT(copy()));
    connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()));
    connect(selectAllAction, SIGNAL(triggered()), this, SLOT(selectAll()));

    connect(this, SIGNAL(undoAvailable(bool)), undoAction, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(redoAvailable(bool)), redoAction, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(copyAvailable(bool)), cutAction, SLOT(setEnabled(bool)));  // OutputWindow never read-only
    connect(this, SIGNAL(copyAvailable(bool)), copyAction, SLOT(setEnabled(bool)));

    undoAction->setEnabled(false);
    redoAction->setEnabled(false);
    cutAction->setEnabled(false);
    copyAction->setEnabled(false);
}
示例#17
0
bool ImageViewerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
    Q_UNUSED(arguments)

    Core::ICore *core = Core::ICore::instance();
    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/imageviewer/ImageViewer.mimetypes.xml"), errorMessage))
        return false;

    d_ptr->factory = new ImageViewerFactory(this);
    Aggregation::Aggregate *aggregate = new Aggregation::Aggregate;
    aggregate->add(d_ptr->factory);

    addAutoReleasedObject(d_ptr->factory);
    return true;
}
示例#18
0
TestContextMenuPrivate::TestContextMenuPrivate(QObject *widget)
{
    m_testInsertUnitOrSystemTestAction = new QAction(widget);
    m_testInsertUnitOrSystemTestAction->setEnabled(false);

    m_editorInsertTestFunctionAction = new QAction(widget);
    m_editorInsertTestFunctionAction->setEnabled(false);

    m_testRunAction = new QAction(widget);
    m_testRunAction->setIcon(QIcon(QPixmap(QLatin1String(":/testrun.png"))));
    m_testRunAsManualAction = new QAction(widget);
    m_testRunAsManualAction->setIcon(QIcon(QPixmap(QLatin1String(":/testrun.png"))));
    m_testDebugAction = new QAction(widget);
    m_testDebugAction->setIcon(QIcon(QPixmap(QLatin1String(":/testlearn.png"))));
    m_editorRunSingleTestAction = new QAction(widget);
    m_editorRunSingleTestAction->setIcon(QIcon(QPixmap(QLatin1String(":/testrun.png"))));
    m_editorRunSingleTestAction->setVisible(false);

    m_testStopTestingAction = new QAction(widget);
    m_testStopTestingAction->setIcon(QIcon(QPixmap(QLatin1String(":/teststop.png"))));
    m_editorStopTestingAction = new QAction(widget);
    m_editorStopTestingAction->setIcon(QIcon(QPixmap(QLatin1String(":/teststop.png"))));

    m_testLearnAction = new QAction(widget);
    m_testLearnAction->setCheckable(true);
    m_testLearnAction->setChecked(m_testSettings.learnMode() == 1);
    QObject::connect(m_testLearnAction, SIGNAL(toggled(bool)), this, SLOT(onLearnChanged()));
    m_testLearnAllAction = new QAction(widget);
    m_testLearnAllAction->setCheckable(true);
    m_testLearnAllAction->setChecked(m_testSettings.learnMode() == 2);
    QObject::connect(m_testLearnAllAction, SIGNAL(toggled(bool)), this, SLOT(onLearnAllChanged()));

    m_testLocalSettingsAction = new QAction(widget);
    m_testToggleCurrentSelectAction = new QAction(widget);
    m_testSelectAllTestsAction = new QAction(widget);
    m_testSelectAllManualTestsAction = new QAction(widget);
    m_testDeselectAllTestsAction = new QAction(widget);
    m_testGroupsAction = new QAction(widget);
    m_testRescanAction = new QAction(widget);
    m_testOpenIncludeFileAction = new QAction(widget);

    languageChange();

    Core::ICore *core = Core::ICore::instance();
    Core::EditorManager* em = core->editorManager();
    QObject::connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)),
         this, SLOT(editorChanged(Core::IEditor*)), Qt::DirectConnection);
}
bool DocumentEditorPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
    Q_UNUSED(arguments)
    Q_UNUSED(errorMessage)

    Core::ICore *core = Core::ICore::instance();
    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/documenteditor/DocumentEditor.mimetypes.xml"), errorMessage))
        return false;

    connect(core, SIGNAL(contextAboutToChange(Core::IContext *)),
        this, SLOT(updateCurrentEditor(Core::IContext *)));

    addAutoReleasedObject(new DocumentEditorFactory(this));

    return true;
}
bool RegExpPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
    Q_UNUSED(arguments)
    Q_UNUSED(errorMessage)
    Core::ICore *core = Core::ICore::instance();
    m_regexpWindow = new RegExpWindow;
    Settings settings;
    settings.fromQSettings(core->settings());
    m_regexpWindow->setSettings(settings);
    addAutoReleasedObject(new Core::BaseView("TextEditor.RegExpWindow",
                                             m_regexpWindow,
                                             Core::Contect("RegExpPlugin"),
                                             plugId,
                                             Qt::RightDockWidgetArea));
    return true;
}
////////////////////////////////////////////////////
//
// INHERITED FROM ExtensionSystem::Plugin
//
////////////////////////////////////////////////////
bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
{
    Q_UNUSED(arguments)
    Q_UNUSED(error)

    Core::ICore *core = Core::ICore::instance();
    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/formeditor/Designer.mimetypes.xml"), error))
        return false;

    initializeTemplates();

    const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR));
    const QList<int> context = QList<int>() << uid;

    addAutoReleasedObject(new FormEditorFactory);

    // Ensure that loading designer translations is done before FormEditorW is instantiated
    const QString locale = qApp->property("qtc_locale").toString();
    if (!locale.isEmpty()) {
        QTranslator *qtr = new QTranslator(this);
        const QString &creatorTrPath =
                Core::ICore::instance()->resourcePath() + QLatin1String("/translations");
        const QString &qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
        const QString &trFile = QLatin1String("designer_") + locale;
        if (qtr->load(trFile, qtTrPath) || qtr->load(trFile, creatorTrPath))
            qApp->installTranslator(qtr);
    }

    if (qgetenv("KDE_SESSION_VERSION") == QByteArray("4")) {
        // KDE 4, possibly dangerous...
        // KDE 4.2.0 had a nasty bug, which resulted in the File/Open Dialog crashing
        // so check for that an fully load the plugins
        QProcess proc;
        proc.start(QLatin1String("kde4-config"), QStringList(QLatin1String("--version")));
        proc.waitForFinished();
        const QByteArray output = proc.readAll();
        if (output.contains("KDE: 4.2.0"))
            FormEditorW::ensureInitStage(FormEditorW::FullyInitialized);
    } else {
        FormEditorW::ensureInitStage(FormEditorW::RegisterPlugins);
    }

    error->clear();
    return true;
}
示例#22
0
/*! Initializes the plugin. Returns true on success.
    Plugins want to register objects with the plugin manager here.

    \a errorMessage can be used to pass an error message to the plugin system,
       if there was any.
*/
bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
    Q_UNUSED(arguments)
    Q_UNUSED(errorMessage)

    // Get the primary access point to the workbench.
    Core::ICore *core = Core::ICore::instance();

    // Create a unique context for our own view, that will be used for the
    // menu entry later.
    Core::Context context("HelloWorld.MainView");

    // Create an action to be triggered by a menu entry
    QAction *helloWorldAction = new QAction(tr("Say \"&Hello World!\""), this);
    connect(helloWorldAction, SIGNAL(triggered()), SLOT(sayHelloWorld()));

    // Register the action with the action manager
    Core::ActionManager *actionManager = core->actionManager();
    Core::Command *command =
            actionManager->registerAction(
                    helloWorldAction, "HelloWorld.HelloWorldAction", context);

    // Create our own menu to place in the Tools menu
    Core::ActionContainer *helloWorldMenu =
            actionManager->createMenu("HelloWorld.HelloWorldMenu");
    QMenu *menu = helloWorldMenu->menu();
    menu->setTitle(tr("&Hello World"));
    menu->setEnabled(true);

    // Add the Hello World action command to the menu
    helloWorldMenu->addAction(command);

    // Request the Tools menu and add the Hello World menu to it
    Core::ActionContainer *toolsMenu =
            actionManager->actionContainer(Core::Constants::M_TOOLS);
    toolsMenu->addMenu(helloWorldMenu);

    // Add a mode with a push button based on BaseMode. Like the BaseView,
    // it will unregister itself from the plugin manager when it is deleted.
    Core::IMode *helloMode = new HelloMode;
    addAutoReleasedObject(helloMode);

    return true;
}
示例#23
0
bool TaskListPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
    Q_UNUSED(arguments)

    ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
    d->hub = pm->getObject<ProjectExplorer::TaskHub>();

    //: Category under which tasklist tasks are listed in build issues view
    d->hub->addCategory(QLatin1String(Constants::TASKLISTTASK_ID), tr("My Tasks"));

    Core::ICore *core = Core::ICore::instance();
    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":tasklist/TaskList.mimetypes.xml"), errorMessage))
        return false;

    d->fileFactory = new Internal::TaskFileFactory(this);
    addAutoReleasedObject(d->fileFactory);
    addAutoReleasedObject(new Internal::StopMonitoringHandler);
    return true;
}
bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *errorMessage)
{
    Core::ICore *core = Core::ICore::instance();
    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage))
        return false;
    CMakeSettingsPage *cmp = new CMakeSettingsPage();
    addAutoReleasedObject(cmp);
    CMakeManager *manager = new CMakeManager(cmp);
    addAutoReleasedObject(manager);
    addAutoReleasedObject(new MakeStepFactory);
    addAutoReleasedObject(new CMakeRunConfigurationFactory);
    TextEditor::TextEditorActionHandler *editorHandler
           = new TextEditor::TextEditorActionHandler(CMakeProjectManager::Constants::C_CMAKEEDITOR);

    addAutoReleasedObject(new CMakeEditorFactory(manager, editorHandler));
    addAutoReleasedObject(new CMakeTargetFactory);

    return true;
}
示例#25
0
void QuickOpenPlugin::saveSettings()
{
    Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
    if (core && core->settings()) {
        QSettings *s = core->settings();
        s->beginGroup("QuickOpen");
        s->setValue("Interval", m_refreshTimer.interval()/60000);
        s->remove("");
        foreach (IQuickOpenFilter *filter, m_filter) {
            if (!m_customFilter.contains(filter)) {
                s->setValue(filter->name(), filter->saveState());
            }
        }
        s->beginGroup("CustomFilters");
        int i = 0;
        foreach (IQuickOpenFilter *filter, m_customFilter) {
            s->setValue(QString("directory%1").arg(i), filter->saveState());
            ++i;
        }
示例#26
0
bool VCSPlugin::initialize(const QStringList &arguments, QString *errorMessage)
{
    Q_UNUSED(arguments)
    Q_UNUSED(errorMessage)

    Core::ICore *core = Core::ICore::instance();
    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/vcsbase/VCSBase.mimetypes.xml"), errorMessage))
        return false;

    m_coreListener = new CoreListener;
    addAutoReleasedObject(m_coreListener);

    m_settingsPage = new CommonOptionsPage;
    addAutoReleasedObject(m_settingsPage);
    addAutoReleasedObject(VCSBaseOutputWindow::instance());
    connect(m_settingsPage, SIGNAL(settingsChanged(VCSBase::Internal::CommonVcsSettings)),
            this, SIGNAL(settingsChanged(VCSBase::Internal::CommonVcsSettings)));
    connect(m_settingsPage, SIGNAL(settingsChanged(VCSBase::Internal::CommonVcsSettings)),
            this, SLOT(slotSettingsChanged()));
    slotSettingsChanged();
    return true;
}
示例#27
0
void MacroOptionsWidget::createTable()
{
    QDir dir(MacroManager::instance()->macrosDirectory());
    Core::ICore *core = Core::ICore::instance();
    Core::ActionManager *am = core->actionManager();

    QMapIterator<QString, Macro *> it(MacroManager::instance()->macros());
    while (it.hasNext()) {
        it.next();
        QFileInfo fileInfo(it.value()->fileName());
        if (fileInfo.absoluteDir() == dir.absolutePath()) {
            QTreeWidgetItem *macroItem = new QTreeWidgetItem(m_ui->treeWidget);
            macroItem->setText(0, it.value()->displayName());
            macroItem->setText(1, it.value()->description());
            macroItem->setData(0, NAME_ROLE, it.value()->displayName());
            macroItem->setData(0, WRITE_ROLE, it.value()->isWritable());

            Core::Command *command = am->command(Core::Id(Constants::PREFIX_MACRO+it.value()->displayName()));
            if (command && command->shortcut())
                macroItem->setText(2, command->shortcut()->key().toString());
        }
    }
}
示例#28
0
bool QuickOpenPlugin::initialize(const QStringList &, QString *)
{
    Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();

    m_settingsPage = new SettingsPage(core, this);
    addObject(m_settingsPage);

    m_quickOpenToolWindow = new QuickOpenToolWindow(this);
    m_quickOpenToolWindow->setEnabled(false);
    Core::BaseView *view = new Core::BaseView("QuickOpen.ToolWindow",
            m_quickOpenToolWindow,
            QList<int>() << core->uniqueIDManager()->uniqueIdentifier(QLatin1String("QuickOpenToolWindow")),
            Core::IView::First);
    addAutoReleasedObject(view);

    const QString actionId = QLatin1String("QtCreator.View.QuickOpen.ToolWindow");
    QAction *action = new QAction(m_quickOpenToolWindow->windowIcon(), m_quickOpenToolWindow->windowTitle(), this);
    Core::ICommand *cmd = core->actionManager()->registerAction(action, actionId, QList<int>() << Core::Constants::C_GLOBAL_ID);
    cmd->setDefaultKeySequence(QKeySequence("Ctrl+K"));
    connect(action, SIGNAL(triggered()), this, SLOT(openQuickOpen()));

    Core::IActionContainer *mtools = core->actionManager()->actionContainer(Core::Constants::M_TOOLS);
    mtools->addAction(cmd);

    addObject(new QuickOpenManager(m_quickOpenToolWindow));

    m_openDocumentsFilter = new OpenDocumentsFilter(core->editorManager());
    addObject(m_openDocumentsFilter);

    m_fileSystemFilter = new FileSystemFilter(core->editorManager(), m_quickOpenToolWindow);
    addObject(m_fileSystemFilter);

    addAutoReleasedObject(new QuickOpenFiltersFilter(this, m_quickOpenToolWindow));

    connect(core, SIGNAL(coreOpened()), this, SLOT(startSettingsLoad()));
    return true;
}
示例#29
0
bool GLSLEditorPlugin::initialize(const QStringList & /*arguments*/, QString *error_message)
{
    Core::ICore *core = Core::ICore::instance();
    if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":/glsleditor/GLSLEditor.mimetypes.xml"), error_message))
        return false;

    parseGlslFile(QLatin1String("glsl_120.frag"), &m_glsl_120_frag);
    parseGlslFile(QLatin1String("glsl_120.vert"), &m_glsl_120_vert);
    parseGlslFile(QLatin1String("glsl_120_common.glsl"), &m_glsl_120_common);
    parseGlslFile(QLatin1String("glsl_es_100.frag"), &m_glsl_es_100_frag);
    parseGlslFile(QLatin1String("glsl_es_100.vert"), &m_glsl_es_100_vert);
    parseGlslFile(QLatin1String("glsl_es_100_common.glsl"), &m_glsl_es_100_common);


//    m_modelManager = new ModelManager(this);
//    addAutoReleasedObject(m_modelManager);

    addAutoReleasedObject(new GLSLHoverHandler(this));

    Core::Context context(GLSLEditor::Constants::C_GLSLEDITOR_ID);

    m_editor = new GLSLEditorFactory(this);
    addObject(m_editor);

    addAutoReleasedObject(new GLSLCompletionAssistProvider);

    m_actionHandler = new TextEditor::TextEditorActionHandler(GLSLEditor::Constants::C_GLSLEDITOR_ID,
                                                              TextEditor::TextEditorActionHandler::Format
                                                              | TextEditor::TextEditorActionHandler::UnCommentSelection
                                                              | TextEditor::TextEditorActionHandler::UnCollapseAll);
    m_actionHandler->initializeActions();

    Core::ActionManager *am =  core->actionManager();
    Core::ActionContainer *contextMenu = am->createMenu(GLSLEditor::Constants::M_CONTEXT);
    Core::ActionContainer *glslToolsMenu = am->createMenu(Core::Id(Constants::M_TOOLS_GLSL));
    glslToolsMenu->setOnAllDisabledBehavior(Core::ActionContainer::Hide);
    QMenu *menu = glslToolsMenu->menu();
    //: GLSL sub-menu in the Tools menu
    menu->setTitle(tr("GLSL"));
    am->actionContainer(Core::Constants::M_TOOLS)->addMenu(glslToolsMenu);

    Core::Command *cmd = 0;

    // Insert marker for "Refactoring" menu:
    Core::Context globalContext(Core::Constants::C_GLOBAL);
    Core::Command *sep = createSeparator(am, this, globalContext,
                                         Constants::SEPARATOR1);
    sep->action()->setObjectName(Constants::M_REFACTORING_MENU_INSERTION_POINT);
    contextMenu->addAction(sep);
    contextMenu->addAction(createSeparator(am, this, globalContext,
                                           Constants::SEPARATOR2));

    cmd = am->command(TextEditor::Constants::UN_COMMENT_SELECTION);
    contextMenu->addAction(cmd);

    error_message->clear();

    Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
    Core::MimeDatabase *mimeDatabase = Core::ICore::instance()->mimeDatabase();
    iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")),
                                                 mimeDatabase->findByType(QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE)));
    iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")),
                                                 mimeDatabase->findByType(QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_VERT)));
    iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")),
                                                 mimeDatabase->findByType(QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG)));
    iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")),
                                                 mimeDatabase->findByType(QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_VERT_ES)));
    iconProvider->registerIconOverlayForMimeType(QIcon(QLatin1String(":/glsleditor/images/glslfile.png")),
                                                 mimeDatabase->findByType(QLatin1String(GLSLEditor::Constants::GLSL_MIMETYPE_FRAG_ES)));

    Core::BaseFileWizardParameters fragWizardParameters(Core::IWizard::FileWizard);
    fragWizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL));
    fragWizardParameters.setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL));
    fragWizardParameters.setDescription
        (tr("Creates a fragment shader in the OpenGL/ES 2.0 Shading "
            "Language (GLSL/ES). Fragment shaders generate the final "
            "pixel colors for triangles, points and lines rendered "
            "with OpenGL."));
    fragWizardParameters.setDisplayName(tr("Fragment Shader (OpenGL/ES 2.0)"));
    fragWizardParameters.setId(QLatin1String("F.GLSL"));
    addAutoReleasedObject(new GLSLFileWizard(fragWizardParameters, GLSLFileWizard::FragmentShaderES, core));

    Core::BaseFileWizardParameters vertWizardParameters(Core::IWizard::FileWizard);
    vertWizardParameters.setCategory(QLatin1String(Constants::WIZARD_CATEGORY_GLSL));
    vertWizardParameters.setDisplayCategory(QCoreApplication::translate("GLSLEditor", Constants::WIZARD_TR_CATEGORY_GLSL));
    vertWizardParameters.setDescription
        (tr("Creates a vertex shader in the OpenGL/ES 2.0 Shading "
            "Language (GLSL/ES). Vertex shaders transform the "
            "positions, normals and texture co-ordinates of "
            "triangles, points and lines rendered with OpenGL."));
    vertWizardParameters.setDisplayName(tr("Vertex Shader (OpenGL/ES 2.0)"));
    vertWizardParameters.setId(QLatin1String("G.GLSL"));
    addAutoReleasedObject(new GLSLFileWizard(vertWizardParameters, GLSLFileWizard::VertexShaderES, core));

    fragWizardParameters.setDescription
        (tr("Creates a fragment shader in the Desktop OpenGL Shading "
            "Language (GLSL). Fragment shaders generate the final "
            "pixel colors for triangles, points and lines rendered "
            "with OpenGL."));
    fragWizardParameters.setDisplayName(tr("Fragment Shader (Desktop OpenGL)"));
    fragWizardParameters.setId(QLatin1String("J.GLSL"));
    addAutoReleasedObject(new GLSLFileWizard(fragWizardParameters, GLSLFileWizard::FragmentShaderDesktop, core));

    vertWizardParameters.setDescription
        (tr("Creates a vertex shader in the Desktop OpenGL Shading "
            "Language (GLSL). Vertex shaders transform the "
            "positions, normals and texture co-ordinates of "
            "triangles, points and lines rendered with OpenGL."));
    vertWizardParameters.setDisplayName(tr("Vertex Shader (Desktop OpenGL)"));
    vertWizardParameters.setId(QLatin1String("K.GLSL"));
    addAutoReleasedObject(new GLSLFileWizard(vertWizardParameters, GLSLFileWizard::VertexShaderDesktop, core));

    return true;
}
示例#30
0
QWidget *QmlProfilerTool::createWidgets()
{
//     Analyzer::AnalyzerManager *analyzerMgr = Analyzer::AnalyzerManager::instance();
//     Utils::FancyMainWindow *mw = analyzerMgr->mainWindow();

    QWidget *mw = this;
    d->m_traceWindow = new TraceWindow(mw);
    d->m_traceWindow->reset(d->m_client);

    connect(d->m_traceWindow, SIGNAL(gotoSourceLocation(QString,int)),this, SLOT(gotoSourceLocation(QString,int)));
    connect(d->m_traceWindow, SIGNAL(timeChanged(qreal)), this, SLOT(updateTimer(qreal)));

    d->m_statistics = new QmlProfilerEventStatistics(mw);
    d->m_eventsView = new QmlProfilerEventsView(mw, d->m_statistics);
    d->m_eventsView->setViewType(QmlProfilerEventsView::EventsView);

    connect(d->m_traceWindow, SIGNAL(range(int,int,int,qint64,qint64,QStringList,QString,int)),
            d->m_statistics, SLOT(addRangedEvent(int,int,int,qint64,qint64,QStringList,QString,int)));
    connect(d->m_traceWindow, SIGNAL(viewUpdated()),
            d->m_statistics, SLOT(complete()));
    connect(d->m_eventsView, SIGNAL(gotoSourceLocation(QString,int)),
            this, SLOT(gotoSourceLocation(QString,int)));

    d->m_calleeView = new QmlProfilerEventsView(mw, d->m_statistics);
    d->m_calleeView->setViewType(QmlProfilerEventsView::CalleesView);
    connect(d->m_calleeView, SIGNAL(gotoSourceLocation(QString,int)),
            this, SLOT(gotoSourceLocation(QString,int)));

    d->m_callerView = new QmlProfilerEventsView(mw, d->m_statistics);
    d->m_callerView->setViewType(QmlProfilerEventsView::CallersView);
    connect(d->m_callerView, SIGNAL(gotoSourceLocation(QString,int)),
            this, SLOT(gotoSourceLocation(QString,int)));

#if 0
    Core::ICore *core = Core::ICore::instance();
    Core::ActionManager *am = core->actionManager();
    Core::ActionContainer *manalyzer = am->actionContainer(Analyzer::Constants::M_DEBUG_ANALYZER);
    const Core::Context globalcontext(Core::Constants::C_GLOBAL);

    d->m_attachAction = new QAction(tr("Attach..."), manalyzer);
    Core::Command *command = am->registerAction(d->m_attachAction,
                                                Constants::ATTACH, globalcontext);
    command->setAttribute(Core::Command::CA_UpdateText);
    //manalyzer->addAction(command, Analyzer::Constants::G_ANALYZER_STARTSTOP);
    connect(d->m_attachAction, SIGNAL(triggered()), this, SLOT(attach()));

    updateAttachAction(false);

    QDockWidget *eventsDock = AnalyzerManager::createDockWidget
            (this, tr("Events"), d->m_eventsView, Qt::BottomDockWidgetArea);
    QDockWidget *timelineDock = AnalyzerManager::createDockWidget
            (this, tr("Timeline"), d->m_traceWindow, Qt::BottomDockWidgetArea);
    QDockWidget *calleeDock = AnalyzerManager::createDockWidget
            (this, tr("Callees"), d->m_calleeView, Qt::BottomDockWidgetArea);
    QDockWidget *callerDock = AnalyzerManager::createDockWidget
            (this, tr("Callers"), d->m_callerView, Qt::BottomDockWidgetArea);

    mw->splitDockWidget(mw->toolBarDockWidget(), eventsDock, Qt::Vertical);
    mw->tabifyDockWidget(eventsDock, timelineDock);
    mw->tabifyDockWidget(timelineDock, calleeDock);
    mw->tabifyDockWidget(calleeDock, callerDock);
#endif
    QTabWidget *tabWidget = new QTabWidget;
    tabWidget->addTab(d->m_eventsView, tr("Events"));
    tabWidget->addTab(d->m_traceWindow, tr("Timeline"));
    tabWidget->addTab(d->m_calleeView, tr("Callees"));
    tabWidget->addTab(d->m_callerView, tr("Callers"));

    //
    // Toolbar
    //
    QWidget *toolbarWidget = new QWidget;
    toolbarWidget->setObjectName(QLatin1String("QmlProfilerToolBarWidget"));

    QHBoxLayout *layout = new QHBoxLayout;
    layout->setMargin(0);
    layout->setSpacing(0);

    d->m_recordButton = new QToolButton(toolbarWidget);
    // icon and tooltip set in setRecording(), called later
    d->m_recordButton->setCheckable(true);

    connect(d->m_recordButton,SIGNAL(toggled(bool)), this, SLOT(setRecording(bool)));
    d->m_recordButton->setChecked(true);
    layout->addWidget(d->m_recordButton);

    d->m_clearButton = new QToolButton(toolbarWidget);
    d->m_clearButton->setIcon(QIcon(QLatin1String(":/qmlprofiler/clean_pane_small.png")));
    d->m_clearButton->setToolTip(tr("Discard data"));
    connect(d->m_clearButton,SIGNAL(clicked()), this, SLOT(clearDisplay()));
    layout->addWidget(d->m_clearButton);

    QLabel *timeLabel = new QLabel(tr("Elapsed:      0 s"));
    QPalette palette = timeLabel->palette();
    palette.setColor(QPalette::WindowText, Qt::white);
    timeLabel->setPalette(palette);
    timeLabel->setIndent(10);

    connect(this, SIGNAL(setTimeLabel(QString)), timeLabel, SLOT(setText(QString)));
    layout->addWidget(timeLabel);

    toolbarWidget->setLayout(layout);

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->addWidget(toolbarWidget);
    mainLayout->addWidget(tabWidget);

    return toolbarWidget;
}