diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc index 4f393ec9dc1..6713d82e6d8 100644 --- a/doc/qtcreator.qdoc +++ b/doc/qtcreator.qdoc @@ -11,7 +11,7 @@ Development Environment (IDE) to develop Qt projects. It is available for the Linux, Mac OS X and Windows platforms. - \note The current version of Qt Creator is 0.9.1 (Beta). It is + \note The current version of Qt Creator is 0.9.2 (Beta). It is possible to edit source code, compile, run and debug applications; other features are still under development. Please send bug reports and suggestions to qt-creator@trolltech.com. To subscribe, send a @@ -1245,7 +1245,7 @@ \bold{Display Signals and Slots} If you have an instance of a class that is derived from QObject, and you - you would like to find all other objects connected to one of your object's + would like to find all other objects connected to one of your object's slots using Qt's signals and slots mechanism -- you can enable \gui{Use Custom Display for Qt Objects} feature under the \gui Debug menu. diff --git a/doc/qtcreator.qdocconf b/doc/qtcreator.qdocconf index b1a99f1319b..6daa5784d3d 100644 --- a/doc/qtcreator.qdocconf +++ b/doc/qtcreator.qdocconf @@ -17,15 +17,15 @@ sources.fileextensions = "qtcreator.qdoc" qhp.projects = QtCreator qhp.QtCreator.file = qtcreator.qhp -qhp.QtCreator.namespace = com.nokia.qtcreator.091 +qhp.QtCreator.namespace = com.nokia.qtcreator.092 qhp.QtCreator.virtualFolder = doc qhp.QtCreator.indexTitle = Qt Creator qhp.QtCreator.indexRoot = qhp.QtCreator.extraFiles = classic.css \ images/qt-logo.png -qhp.QtCreator.filterAttributes = qtcreator 0.9.1 -qhp.QtCreator.customFilters.QtCreator.name = Qt Creator 0.9.1 -qhp.QtCreator.customFilters.QtCreator.filterAttributes = qtcreator 0.9.1 +qhp.QtCreator.filterAttributes = qtcreator 0.9.2 +qhp.QtCreator.customFilters.QtCreator.name = Qt Creator 0.9.2 +qhp.QtCreator.customFilters.QtCreator.filterAttributes = qtcreator 0.9.2 # macros.qdocconf @@ -201,5 +201,5 @@ HTML.footer = "


\n" \ "\n" \ "\n" \ "\n" \ - "\n" \ + "\n" \ "
Copyright © 2008 Nokia 
Qt Creator 0.9.1
Qt Creator 0.9.2
" diff --git a/replaceVersion.sh b/replaceVersion.sh index 0bb38a68a94..3e1eff015bd 100755 --- a/replaceVersion.sh +++ b/replaceVersion.sh @@ -25,6 +25,12 @@ NEW_MINOR=`sed 's/^[0-9]\+\.\([0-9]\+\)\.[0-9]\+$/\1/' <<<"$2"` OLD_RELEASE=`sed 's/^[0-9]\+\.[0-9]\+\.\([0-9]\+\)$/\1/' <<<"$1"` NEW_RELEASE=`sed 's/^[0-9]\+\.[0-9]\+\.\([0-9]\+\)$/\1/' <<<"$2"` +OLD_THREE="${OLD_MAJOR}${OLD_MINOR}${OLD_RELEASE}" +NEW_THREE="${NEW_MAJOR}${NEW_MINOR}${NEW_RELEASE}" + +OLD_DOT_THREE="${OLD_MAJOR}\\.${OLD_MINOR}\\.${OLD_RELEASE}" +NEW_DOT_THREE="${NEW_MAJOR}\\.${NEW_MINOR}\\.${NEW_RELEASE}" + OLD_DOT_FOUR="${OLD_MAJOR}\\.${OLD_MINOR}\\.${OLD_RELEASE}\\.0" NEW_DOT_FOUR="${NEW_MAJOR}\\.${NEW_MINOR}\\.${NEW_RELEASE}\\.0" @@ -38,8 +44,10 @@ echo "# Major '${OLD_MAJOR}' -> '${NEW_MAJOR}'" echo "# Minor '${OLD_MINOR}' -> '${NEW_MINOR}'" echo "# Release '${OLD_RELEASE}' -> '${NEW_RELEASE}'" echo "#-----------------------------------------------" -echo "# Dots '${OLD_DOT_FOUR}' -> '${NEW_DOT_FOUR}'" -echo "# Comma '${OLD_COMMA_FOUR}' -> '${NEW_COMMA_FOUR}'" +echo "# 3 '${OLD_THREE}' -> '${NEW_THREE}'" +echo "# Dot 3 '${OLD_DOT_THREE}' -> '${NEW_DOT_THREE}'" +echo "# Dot 4 '${OLD_DOT_FOUR}' -> '${NEW_DOT_FOUR}'" +echo "# Comma 4 '${OLD_COMMA_FOUR}' -> '${NEW_COMMA_FOUR}'" echo "#===============================================" echo @@ -85,7 +93,7 @@ sed \ mv -f "${TMPFILE}" "${INSTALLER_RC}" -## Patch installer.rc +## Patch Info.plist TMPFILE=`mktemp` INFO_PLIST="${SCRIPT_DIR}/src/app/Info.plist" echo "Patching \`${INFO_PLIST}'" @@ -95,6 +103,27 @@ sed \ mv -f "${TMPFILE}" "${INFO_PLIST}" +## Patch qtcreator.qdocconf +TMPFILE=`mktemp` +QDOCCONF="${SCRIPT_DIR}/doc/qtcreator.qdocconf" +echo "Patching \`${QDOCCONF}'" +sed \ + -e "s/"${OLD_DOT_THREE}"/"${NEW_DOT_THREE}"/" \ + -e "s/"${OLD_THREE}"/"${NEW_THREE}"/" \ + "${QDOCCONF}" > "${TMPFILE}" +mv -f "${TMPFILE}" "${QDOCCONF}" + + +## Patch qtcreator.qdoc +TMPFILE=`mktemp` +QDOC="${SCRIPT_DIR}/doc/qtcreator.qdoc" +echo "Patching \`${QDOC}'" +sed \ + -e 's/\(The current version of Qt Creator is \)'${OLD_DOT_THREE}'/\1'${NEW_DOT_THREE}'/' \ + "${QDOC}" > "${TMPFILE}" +mv -f "${TMPFILE}" "${QDOC}" + + ## Go back to original $PWD echo "Leaving directory \`${SCRIPT_DIR}'" popd &>/dev/null || exit 1 diff --git a/scripts/shipping/prepare-linux-qt-for-shipping.sh b/scripts/shipping/prepare-linux-qt-for-shipping.sh index 869f0e837f8..2f49413ebdd 100755 --- a/scripts/shipping/prepare-linux-qt-for-shipping.sh +++ b/scripts/shipping/prepare-linux-qt-for-shipping.sh @@ -2,7 +2,7 @@ version=4.4.3 workdir=/home/berlin/dev/qt-${version}-temp -destdir=/home/berlin/dev/qt-${version}-shipping +destdir=/home/berlin/dev/qt-${version}-shipping/qt # "/qt" suffix for Bitrock dir=qt-x11-opensource-src-${version} file_tar="${dir}.tar" file_tar_gz="${file_tar}.gz" diff --git a/src/app/app.pro b/src/app/app.pro index a8cb1a8e9dc..cc8ccbe1af1 100644 --- a/src/app/app.pro +++ b/src/app/app.pro @@ -1,7 +1,7 @@ IDE_BUILD_TREE = $$OUT_PWD/../../ include(../qworkbench.pri) -include(../../shared/qtsingleapplication/qtsingleapplication.pri) +include(../shared/qtsingleapplication/qtsingleapplication.pri) macx { CONFIG(debug, debug|release):LIBS *= -lExtensionSystem_debug -lAggregation_debug diff --git a/src/libs/cplusplus/LookupContext.cpp b/src/libs/cplusplus/LookupContext.cpp index 2941489e01c..01d4e13b4eb 100644 --- a/src/libs/cplusplus/LookupContext.cpp +++ b/src/libs/cplusplus/LookupContext.cpp @@ -162,8 +162,26 @@ QList LookupContext::resolve(Name *name, const QList &visible if (QualifiedNameId *q = name->asQualifiedNameId()) { QList candidates; QList scopes = visibleScopes; - Identifier *id = identifier(name); + for (unsigned i = 0; i < q->nameCount(); ++i) { + Name *name = q->nameAt(i); + if (i + 1 == q->nameCount()) + candidates = resolve(name, scopes, mode); + else + candidates = resolveClassOrNamespace(name, scopes); + + if (candidates.isEmpty() || i + 1 == q->nameCount()) + break; + + scopes.clear(); + foreach (Symbol *candidate, candidates) { + if (ScopedSymbol *scoped = candidate->asScopedSymbol()) { + expand(scoped->members(), visibleScopes, &scopes); + } + } + } + + Identifier *id = identifier(name); foreach (Scope *scope, visibleScopes) { Symbol *symbol = scope->lookat(id); for (; symbol; symbol = symbol->next()) { @@ -189,26 +207,7 @@ QList LookupContext::resolve(Name *name, const QList &visible } } - for (unsigned i = 0; i < q->nameCount(); ++i) { - Name *name = q->nameAt(i); - - if (i + 1 == q->nameCount()) - candidates += resolve(name, scopes, mode); - else - candidates += resolveClassOrNamespace(name, scopes); - - if (candidates.isEmpty() || i + 1 == q->nameCount()) - return candidates; - - scopes.clear(); - foreach (Symbol *candidate, candidates) { - if (ScopedSymbol *scoped = candidate->asScopedSymbol()) { - expand(scoped->members(), visibleScopes, &scopes); - } - } - } - - return QList(); + return candidates; } QList candidates; diff --git a/src/libs/cplusplus/cplusplus.pri b/src/libs/cplusplus/cplusplus.pri index e2d0f6f0339..e0cdf8900f0 100644 --- a/src/libs/cplusplus/cplusplus.pri +++ b/src/libs/cplusplus/cplusplus.pri @@ -1,3 +1,3 @@ -INCLUDEPATH += $$PWD/../../../shared/cplusplus +INCLUDEPATH += $$PWD/../../shared/cplusplus DEFINES += HAVE_QT CPLUSPLUS_WITH_NAMESPACE LIBS *= -l$$qtLibraryTarget(CPlusPlus) diff --git a/src/libs/cplusplus/cplusplus.pro b/src/libs/cplusplus/cplusplus.pro index f89d4d3f862..ccc38abb490 100644 --- a/src/libs/cplusplus/cplusplus.pro +++ b/src/libs/cplusplus/cplusplus.pro @@ -7,7 +7,7 @@ DEFINES += NDEBUG unix:QMAKE_CXXFLAGS_DEBUG += -O3 include(../../qworkbenchlibrary.pri) -include(../../../shared/cplusplus/cplusplus.pri) +include(../../shared/cplusplus/cplusplus.pri) HEADERS += \ SimpleLexer.h \ diff --git a/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.cpp b/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.cpp new file mode 100644 index 00000000000..c0065c4fc15 --- /dev/null +++ b/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.cpp @@ -0,0 +1,123 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#include "cmakeconfigurewidget.h" +#include "cmakeprojectmanager.h" +#include +#include +#include +#include + +using namespace CMakeProjectManager; +using namespace CMakeProjectManager::Internal; + +CMakeConfigureWidget::CMakeConfigureWidget(QWidget *parent, CMakeManager *manager, const QString &sourceDirectory) + : QWidget(parent), m_configureSucceded(false), m_cmakeManager(manager), m_sourceDirectory(sourceDirectory) +{ + m_ui.setupUi(this); + m_ui.buildDirectoryLineEdit->setPath(sourceDirectory + "/qtcreator-build"); + + connect(m_ui.configureButton, SIGNAL(clicked()), this, SLOT(runCMake())); + // TODO make the configure button do stuff + // TODO set initial settings + // TODO note if there's already a build in that directory + // detect which generators we have + // let the user select generator +} + +QString CMakeConfigureWidget::buildDirectory() +{ + return m_ui.buildDirectoryLineEdit->path(); +} + +QStringList CMakeConfigureWidget::arguments() +{ + return ProjectExplorer::Environment::parseCombinedArgString(m_ui.cmakeArgumentsLineEdit->text()); +} + +bool CMakeConfigureWidget::configureSucceded() +{ + return m_configureSucceded; +} + +void CMakeConfigureWidget::runCMake() +{ + // TODO run project createCbp() + // get output and display it + + // TODO analyse wheter this worked out + m_ui.cmakeOutput->setPlainText(tr("Waiting for cmake...")); + QString string = m_cmakeManager->createXmlFile(arguments(), m_sourceDirectory, buildDirectory()); + m_ui.cmakeOutput->setPlainText(string); +} + +////// +// CMakeConfigureDialog +///// + +CMakeConfigureDialog::CMakeConfigureDialog(QWidget *parent, CMakeManager *manager, const QString &sourceDirectory) + : QDialog(parent) +{ + QVBoxLayout *vbox = new QVBoxLayout(this); + setLayout(vbox); + + m_cmakeConfigureWidget = new CMakeConfigureWidget(this, manager, sourceDirectory); + vbox->addWidget(m_cmakeConfigureWidget); + + QHBoxLayout *hboxlayout = new QHBoxLayout(this); + hboxlayout->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Fixed)); + + + QPushButton *okButton = new QPushButton(this); + okButton->setText(tr("Ok")); + okButton->setDefault(true); + connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); + + hboxlayout->addWidget(okButton); + vbox->addLayout(hboxlayout); +} + +QString CMakeConfigureDialog::buildDirectory() +{ + return m_cmakeConfigureWidget->buildDirectory(); +} + +QStringList CMakeConfigureDialog::arguments() +{ + return m_cmakeConfigureWidget->arguments(); +} + +bool CMakeConfigureDialog::configureSucceded() +{ + return m_cmakeConfigureWidget->configureSucceded(); +} diff --git a/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.h b/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.h new file mode 100644 index 00000000000..5565f8f17bc --- /dev/null +++ b/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.h @@ -0,0 +1,81 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#ifndef CMAKECONFIGUREWIDGET_H +#define CMAKECONFIGUREWIDGET_H + +#include "ui_cmakeconfigurewidget.h" +#include +#include + +namespace CMakeProjectManager { +namespace Internal { + +class CMakeManager; + +class CMakeConfigureWidget : public QWidget +{ + Q_OBJECT +public: + CMakeConfigureWidget(QWidget *parent, CMakeManager *manager, const QString &sourceDirectory); + Ui::CMakeConfigureWidget m_ui; + + QString buildDirectory(); + QStringList arguments(); + bool configureSucceded(); + +private slots: + void runCMake(); +private: + bool m_configureSucceded; + CMakeManager *m_cmakeManager; + QString m_sourceDirectory; +}; + +class CMakeConfigureDialog : public QDialog +{ +public: + CMakeConfigureDialog(QWidget *parent, CMakeManager *manager, const QString &sourceDirectory); + + QString buildDirectory(); + QStringList arguments(); + bool configureSucceded(); + +private: + CMakeConfigureWidget *m_cmakeConfigureWidget; +}; + +} +} + +#endif // CMAKECONFIGUREWIDGET_H diff --git a/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.ui b/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.ui new file mode 100644 index 00000000000..cdca9035e6f --- /dev/null +++ b/src/plugins/cmakeprojectmanager/cmakeconfigurewidget.ui @@ -0,0 +1,95 @@ + + + CMakeProjectManager::Internal::CMakeConfigureWidget + + + + 0 + 0 + 521 + 662 + + + + Form + + + + + + + + CMake Arguments: + + + + + + + + + + Builddirectory: + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Run cmake + + + + + + + + + + + + + Core::Utils::PathChooser + QLineEdit +
utils/pathchooser.h
+
+
+ + +
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index effe432e36a..34bc8fa7908 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -32,21 +32,24 @@ ***************************************************************************/ #include "cmakeproject.h" - +#include "ui_cmakeconfigurewidget.h" +#include "cmakeconfigurewidget.h" #include "cmakeprojectconstants.h" #include "cmakeprojectnodes.h" #include "cmakerunconfiguration.h" #include "cmakestep.h" #include "makestep.h" -#include #include +#include #include +#include #include #include #include #include +#include using namespace CMakeProjectManager; using namespace CMakeProjectManager::Internal; @@ -67,8 +70,6 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName) : m_manager(manager), m_fileName(fileName), m_rootNode(new CMakeProjectNode(m_fileName)) { m_file = new CMakeFile(this, fileName); - QDir dir = QFileInfo(m_fileName).absoluteDir(); - parseCMakeLists(dir); } CMakeProject::~CMakeProject() @@ -78,12 +79,12 @@ CMakeProject::~CMakeProject() // TODO also call this method if the CMakeLists.txt file changed, which is also called if the CMakeList.txt is updated // TODO make this function work even if it is reparsing -void CMakeProject::parseCMakeLists(const QDir &directory) +void CMakeProject::parseCMakeLists() { - createCbpFile(buildDirectory(QString())); - - QString cbpFile = findCbpFile(buildDirectory(QString())); + QString sourceDirectory = QFileInfo(m_fileName).absolutePath(); + m_manager->createXmlFile(cmakeStep()->userArguments(activeBuildConfiguration()), sourceDirectory, buildDirectory(activeBuildConfiguration())); + QString cbpFile = findCbpFile(buildDirectory(activeBuildConfiguration())); CMakeCbpParser cbpparser; qDebug()<<"Parsing file "< list) { @@ -300,8 +283,20 @@ void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader { // TODO Project::restoreSettingsImpl(reader); - if (buildConfigurations().isEmpty()) { - // No build configuration, adding those + bool hasUserFile = !buildConfigurations().isEmpty(); + if (!hasUserFile) { + // Ask the user for where he wants to build it + // and the cmake command line + + // TODO check wheter there's already a CMakeCache.txt in the src directory, + // then we don't need to ask, we simply need to build in the src directory + + CMakeConfigureDialog ccd(Core::ICore::instance()->mainWindow(), m_manager, QFileInfo(m_fileName).absolutePath()); + ccd.exec(); + + qDebug()<<"ccd.buildDirectory()"<setBuildTarget("all", "all", true); + if (!ccd.buildDirectory().isEmpty()) + setValue("all", "buildDirectory", ccd.buildDirectory()); + cmakeStep->setUserArguments("all", ccd.arguments()); + } + parseCMakeLists(); // Gets the directory from the active buildconfiguration + + if (!hasUserFile) { // Create run configurations for m_targets qDebug()<<"Create run configurations of m_targets"; bool setActive = false; @@ -328,7 +330,6 @@ void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader } } - // Restoring is fine } diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.h b/src/plugins/cmakeprojectmanager/cmakeproject.h index a71ca7c8b00..5195cfb5735 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.h +++ b/src/plugins/cmakeprojectmanager/cmakeproject.h @@ -106,9 +106,8 @@ public: QStringList targets() const; private: - void parseCMakeLists(const QDir &directory); + void parseCMakeLists(); QString findCbpFile(const QDir &); - void createCbpFile(const QDir &); void buildTree(CMakeProjectNode *rootNode, QList list); ProjectExplorer::FolderNode *findOrCreateFolder(CMakeProjectNode *rootNode, QString directory); diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp index 845255eda5d..6bed6c3aae8 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.cpp @@ -36,18 +36,30 @@ #include "cmakeproject.h" #include "cmakeprojectconstants.h" +#include #include #include +#include +#include +#include +#include +#include using namespace CMakeProjectManager::Internal; -CMakeManager::CMakeManager() +CMakeManager::CMakeManager(CMakeSettingsPage *cmakeSettingsPage) + : m_settingsPage(cmakeSettingsPage) { Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance(); m_projectContext = uidm->uniqueIdentifier(CMakeProjectManager::Constants::PROJECTCONTEXT); m_projectLanguage = uidm->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX); } +CMakeSettingsPage::~CMakeSettingsPage() +{ + +} + int CMakeManager::projectContext() const { return m_projectContext; @@ -61,6 +73,14 @@ int CMakeManager::projectLanguage() const ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName) { // TODO check wheter this project is already opened + // Check that we have a cmake executable first + // Look at the settings first + QString cmakeExecutable = m_settingsPage->cmakeExecutable(); + if (cmakeExecutable.isNull()) + m_settingsPage->askUserForCMakeExecutable(); + cmakeExecutable = m_settingsPage->cmakeExecutable(); + if (cmakeExecutable.isNull()) + return 0; return new CMakeProject(this, fileName); } @@ -68,3 +88,204 @@ QString CMakeManager::mimeType() const { return Constants::CMAKEMIMETYPE; } + +QString CMakeManager::cmakeExecutable() const +{ + return m_settingsPage->cmakeExecutable(); +} + +// TODO need to refactor this out +// we probably want the process instead of this function +// cmakeproject then could even run the cmake process in the background, adding the files afterwards +// sounds like a plan +QString CMakeManager::createXmlFile(const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory) +{ + // We create a cbp file, only if we didn't find a cbp file in the base directory + // Yet that can still override cbp files in subdirectories + // And we are creating tons of files in the source directories + // All of that is not really nice. + // The mid term plan is to move away from the CodeBlocks Generator and use our own + // QtCreator generator, which actually can be very similar to the CodeBlock Generator + + + // TODO we need to pass on the same paremeters as the cmakestep + QString buildDirectoryPath = buildDirectory.absolutePath(); + qDebug()<<"Creating cbp file in"< &fi) +{ + m_mutex.lock(); + QString executable = m_executable; + m_mutex.unlock(); + QProcess cmake; + cmake.start(executable, QStringList()<<"--help"); + cmake.waitForFinished(); + QString response = cmake.readAll(); + QRegExp versionRegexp("^cmake version ([*\\d\\.]*)-(|patch (\\d*))(|\\r)\\n"); + versionRegexp.indexIn(response); + + m_mutex.lock(); + m_supportsQtCreator = response.contains("QtCreator"); + m_version = versionRegexp.cap(1); + if (!versionRegexp.capturedTexts().size()>3) + m_version += "." + versionRegexp.cap(3); + m_cacheUpToDate = true; + m_mutex.unlock(); + fi.reportFinished(); +} + +void CMakeRunner::setExecutable(const QString &executable) +{ + waitForUpToDate(); + m_mutex.lock(); + m_executable = executable; + m_cacheUpToDate = false; + m_mutex.unlock(); + m_future = QtConcurrent::run(&CMakeRunner::run, this); +} + +QString CMakeRunner::executable() const +{ + waitForUpToDate(); + m_mutex.lock(); + QString result = m_executable; + m_mutex.unlock(); + return result; +} + +QString CMakeRunner::version() const +{ + waitForUpToDate(); + m_mutex.lock(); + QString result = m_version; + m_mutex.unlock(); + return result; +} + +bool CMakeRunner::supportsQtCreator() const +{ + waitForUpToDate(); + m_mutex.lock(); + bool result = m_supportsQtCreator; + m_mutex.unlock(); + return result; +} + +void CMakeRunner::waitForUpToDate() const +{ + m_future.waitForFinished(); +} + +///// +// CMakeSettingsPage +//// + + +CMakeSettingsPage::CMakeSettingsPage() +{ + Core::ICore *core = Core::ICore::instance(); + QSettings * settings = core->settings(); + settings->beginGroup("CMakeSettings"); + m_cmakeRunner.setExecutable(settings->value("cmakeExecutable").toString()); + settings->endGroup(); +} + +QString CMakeSettingsPage::findCmakeExecutable() const +{ + ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment(); + return env.searchInPath("cmake"); +} + + +QString CMakeSettingsPage::name() const +{ + return "CMake"; +} + +QString CMakeSettingsPage::category() const +{ + return "CMake"; +} + +QString CMakeSettingsPage::trCategory() const +{ + return tr("CMake"); +} + +QWidget *CMakeSettingsPage::createPage(QWidget *parent) +{ + QWidget *w = new QWidget(parent); + QFormLayout *fl = new QFormLayout(w); + m_pathchooser = new Core::Utils::PathChooser(w); + m_pathchooser->setExpectedKind(Core::Utils::PathChooser::Command); + fl->addRow("CMake executable", m_pathchooser); + m_pathchooser->setPath(cmakeExecutable()); + return w; +} + +void CMakeSettingsPage::saveSettings() const +{ + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup("CMakeSettings"); + settings->setValue("cmakeExecutable", m_cmakeRunner.executable()); + settings->endGroup(); +} + +void CMakeSettingsPage::apply() +{ + m_cmakeRunner.setExecutable(m_pathchooser->path()); + saveSettings(); +} + +void CMakeSettingsPage::finish() +{ + +} + +QString CMakeSettingsPage::cmakeExecutable() const +{ + if (m_cmakeRunner.executable().isEmpty()) { + QString cmakeExecutable = findCmakeExecutable(); + if (!cmakeExecutable.isEmpty()) { + m_cmakeRunner.setExecutable(cmakeExecutable); + saveSettings(); + } + } + return m_cmakeRunner.executable(); +} + +void CMakeSettingsPage::askUserForCMakeExecutable() +{ + // TODO implement + // That is ideally add a label to the settings page, which says something + // to the effect: please configure the cmake executable + // and show the settings page + // ensure that we rehide the label in the finish() function + // But to test that i need an environment without cmake, e.g. windows +} diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h index 34d97f1cc7c..d8a61e6e802 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.h @@ -34,27 +34,82 @@ #ifndef CMAKEPROJECTMANAGER_H #define CMAKEPROJECTMANAGER_H +#include #include +#include +#include +#include +#include namespace CMakeProjectManager { namespace Internal { +class CMakeSettingsPage; +class CMakeRunner; + class CMakeManager : public ProjectExplorer::IProjectManager { Q_OBJECT public: - CMakeManager(); + CMakeManager(CMakeSettingsPage *cmakeSettingsPage); virtual int projectContext() const; virtual int projectLanguage() const; - //virtual bool canOpenProject(const QString &fileName); virtual ProjectExplorer::Project *openProject(const QString &fileName); virtual QString mimeType() const; - //virtual QString fileFilter() const; + QString cmakeExecutable() const; + + QString createXmlFile(const QStringList &arguments, const QString &sourceDirectory, const QDir &buildDirectory); private: int m_projectContext; int m_projectLanguage; + CMakeSettingsPage *m_settingsPage; +}; + +class CMakeRunner +{ +public: + CMakeRunner(); + void run(QFutureInterface &fi); + void setExecutable(const QString &executable); + QString executable() const; + QString version() const; + bool supportsQtCreator() const; + void waitForUpToDate() const; + +private: + QString m_executable; + QString m_version; + bool m_supportsQtCreator; + bool m_cacheUpToDate; + mutable QFuture m_future; + mutable QMutex m_mutex; +}; + +class CMakeSettingsPage : public Core::IOptionsPage +{ + Q_OBJECT +public: + CMakeSettingsPage(); + virtual ~CMakeSettingsPage(); + virtual QString name() const; + virtual QString category() const; + virtual QString trCategory() const; + + virtual QWidget *createPage(QWidget *parent); + virtual void apply(); + virtual void finish(); + + QString cmakeExecutable() const; + void askUserForCMakeExecutable(); +private: + void updateCachedInformation() const; + void saveSettings() const; + QString findCmakeExecutable() const; + + mutable CMakeRunner m_cmakeRunner; + Core::Utils::PathChooser *m_pathchooser; }; } // namespace Internal diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro index 74f69fea4ab..c6f238c822c 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro @@ -9,12 +9,15 @@ HEADERS = cmakeproject.h \ cmakeprojectnodes.h \ cmakestep.h \ makestep.h \ - cmakerunconfiguration.h + cmakerunconfiguration.h \ + cmakeconfigurewidget.h SOURCES = cmakeproject.cpp \ cmakeprojectplugin.cpp \ cmakeprojectmanager.cpp \ cmakeprojectnodes.cpp \ cmakestep.cpp \ makestep.cpp \ - cmakerunconfiguration.cpp + cmakerunconfiguration.cpp \ + cmakeconfigurewidget.cpp RESOURCES += cmakeproject.qrc +FORMS += cmakeconfigurewidget.ui diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp index 29ad08ec5f1..4c16e0d997b 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp @@ -59,7 +59,9 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString * Core::ICore *core = Core::ICore::instance(); if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage)) return false; - addAutoReleasedObject(new CMakeManager()); + CMakeSettingsPage *cmp = new CMakeSettingsPage(); + addAutoReleasedObject(cmp); + addAutoReleasedObject(new CMakeManager(cmp)); addAutoReleasedObject(new CMakeBuildStepFactory()); addAutoReleasedObject(new MakeBuildStepFactory()); addAutoReleasedObject(new CMakeRunConfigurationFactory()); diff --git a/src/plugins/cmakeprojectmanager/cmakestep.cpp b/src/plugins/cmakeprojectmanager/cmakestep.cpp index 9f114893fc4..3947f6c2792 100644 --- a/src/plugins/cmakeprojectmanager/cmakestep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakestep.cpp @@ -36,6 +36,7 @@ #include "cmakeproject.h" #include "cmakeprojectconstants.h" +#include #include #include #include @@ -56,7 +57,10 @@ bool CMakeStep::init(const QString &buildConfiguration) { setEnabled(buildConfiguration, true); setWorkingDirectory(buildConfiguration, m_pro->buildDirectory(buildConfiguration)); - setCommand(buildConfiguration, "cmake"); // TODO give full path here? + + CMakeManager *cmakeProjectManager = static_cast(m_pro->projectManager()); + + setCommand(buildConfiguration, cmakeProjectManager->cmakeExecutable()); QString sourceDir = QFileInfo(m_pro->file()->fileName()).absolutePath(); setArguments(buildConfiguration, @@ -99,14 +103,14 @@ bool CMakeStep::immutable() const return true; } -QString CMakeStep::userArguments(const QString &buildConfiguration) const +QStringList CMakeStep::userArguments(const QString &buildConfiguration) const { - return ProjectExplorer::Environment::joinArgumentList(value(buildConfiguration, "userArguments").toStringList()); + return value(buildConfiguration, "userArguments").toStringList(); } -void CMakeStep::setUserArguments(const QString &buildConfiguration, const QString &arguments) +void CMakeStep::setUserArguments(const QString &buildConfiguration, const QStringList &arguments) { - setValue(buildConfiguration, "userArguments", ProjectExplorer::Environment::parseCombinedArgString(arguments)); + setValue(buildConfiguration, "userArguments", arguments); } // @@ -132,13 +136,13 @@ void CMakeBuildStepConfigWidget::init(const QString &buildConfiguration) { m_buildConfiguration = buildConfiguration; disconnect(m_arguments, SIGNAL(textChanged(QString)), this, SLOT(argumentsLineEditChanged())); - m_arguments->setText(m_cmakeStep->userArguments(buildConfiguration)); + m_arguments->setText(ProjectExplorer::Environment::joinArgumentList(m_cmakeStep->userArguments(buildConfiguration))); connect(m_arguments, SIGNAL(textChanged(QString)), this, SLOT(argumentsLineEditChanged())); } void CMakeBuildStepConfigWidget::argumentsLineEditChanged() { - m_cmakeStep->setUserArguments(m_buildConfiguration, m_arguments->text()); + m_cmakeStep->setUserArguments(m_buildConfiguration, ProjectExplorer::Environment::parseCombinedArgString(m_arguments->text())); } // diff --git a/src/plugins/cmakeprojectmanager/cmakestep.h b/src/plugins/cmakeprojectmanager/cmakestep.h index c5006a3eadc..861ccec51d5 100644 --- a/src/plugins/cmakeprojectmanager/cmakestep.h +++ b/src/plugins/cmakeprojectmanager/cmakestep.h @@ -63,8 +63,8 @@ public: virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget(); virtual bool immutable() const; - void setUserArguments(const QString &buildConfiguration, const QString &arguments); - QString userArguments(const QString &buildConfiguration) const; + void setUserArguments(const QString &buildConfiguration, const QStringList &arguments); + QStringList userArguments(const QString &buildConfiguration) const; private: CMakeProject *m_pro; }; diff --git a/src/plugins/coreplugin/actionmanager/actionmanager.cpp b/src/plugins/coreplugin/actionmanager/actionmanager.cpp index b5a1e5cc0c6..f3cf2f9c019 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager.cpp +++ b/src/plugins/coreplugin/actionmanager/actionmanager.cpp @@ -205,10 +205,11 @@ ActionManagerPrivate* ActionManagerPrivate::m_instance = 0; \internal */ -ActionManagerPrivate::ActionManagerPrivate(MainWindow *mainWnd, UniqueIDManager *uidmgr) : - ActionManager(mainWnd), +ActionManagerPrivate::ActionManagerPrivate(MainWindow *mainWnd) + : ActionManager(mainWnd), m_mainWnd(mainWnd) { + UniqueIDManager *uidmgr = UniqueIDManager::instance(); m_defaultGroups << uidmgr->uniqueIdentifier(Constants::G_DEFAULT_ONE); m_defaultGroups << uidmgr->uniqueIdentifier(Constants::G_DEFAULT_TWO); m_defaultGroups << uidmgr->uniqueIdentifier(Constants::G_DEFAULT_THREE); @@ -258,7 +259,7 @@ void ActionManagerPrivate::setContext(const QList &context) it.value()->setCurrentContext(m_context); const IdContainerMap::const_iterator acend = m_idContainerMap.constEnd(); - for ( IdContainerMap::const_iterator it = m_idContainerMap.constBegin(); it != acend; ++it) + for (IdContainerMap::const_iterator it = m_idContainerMap.constBegin(); it != acend; ++it) it.value()->update(); } @@ -273,7 +274,7 @@ bool ActionManagerPrivate::hasContext(QList context) const ActionContainer *ActionManagerPrivate::createMenu(const QString &id) { - const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id); + const int uid = UniqueIDManager::instance()->uniqueIdentifier(id); const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid); if (it != m_idContainerMap.constEnd()) return it.value(); @@ -291,7 +292,7 @@ ActionContainer *ActionManagerPrivate::createMenu(const QString &id) ActionContainer *ActionManagerPrivate::createMenuBar(const QString &id) { - const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id); + const int uid = UniqueIDManager::instance()->uniqueIdentifier(id); const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid); if (it != m_idContainerMap.constEnd()) return it.value(); @@ -320,7 +321,7 @@ Command *ActionManagerPrivate::registerAction(QAction *action, const QString &id Command *ActionManagerPrivate::registerOverridableAction(QAction *action, const QString &id, bool checkUnique) { OverrideableAction *a = 0; - const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id); + const int uid = UniqueIDManager::instance()->uniqueIdentifier(id); if (CommandPrivate *c = m_idCmdMap.value(uid, 0)) { if (c->type() != Command::CT_OverridableAction) { qWarning() << "registerAction: id" << id << "is registered with a different command type."; @@ -366,7 +367,7 @@ Command *ActionManagerPrivate::registerOverridableAction(QAction *action, const Command *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const QString &id, const QList &context) { Shortcut *sc = 0; - int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id); + int uid = UniqueIDManager::instance()->uniqueIdentifier(id); if (CommandPrivate *c = m_idCmdMap.value(uid, 0)) { if (c->type() != Command::CT_Shortcut) { qWarning() << "registerShortcut: id" << id << "is registered with a different command type."; @@ -402,7 +403,7 @@ Command *ActionManagerPrivate::registerShortcut(QShortcut *shortcut, const QStri Command *ActionManagerPrivate::command(const QString &id) const { - const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id); + const int uid = UniqueIDManager::instance()->uniqueIdentifier(id); const IdCmdMap::const_iterator it = m_idCmdMap.constFind(uid); if (it == m_idCmdMap.constEnd()) { if (warnAboutFindFailures) @@ -414,9 +415,9 @@ Command *ActionManagerPrivate::command(const QString &id) const ActionContainer *ActionManagerPrivate::actionContainer(const QString &id) const { - const int uid = m_mainWnd->uniqueIDManager()->uniqueIdentifier(id); - const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid); - if ( it == m_idContainerMap.constEnd()) { + const int uid = UniqueIDManager::instance()->uniqueIdentifier(id); + const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid); + if (it == m_idContainerMap.constEnd()) { if (warnAboutFindFailures) qWarning() << "ActionManagerPrivate::actionContainer(): failed to find :" << id << '/' << uid; return 0; @@ -429,7 +430,7 @@ Command *ActionManagerPrivate::command(int uid) const const IdCmdMap::const_iterator it = m_idCmdMap.constFind(uid); if (it == m_idCmdMap.constEnd()) { if (warnAboutFindFailures) - qWarning() << "ActionManagerPrivate::command(): failed to find :" << m_mainWnd->uniqueIDManager()->stringForUniqueIdentifier(uid) << '/' << uid; + qWarning() << "ActionManagerPrivate::command(): failed to find :" << UniqueIDManager::instance()->stringForUniqueIdentifier(uid) << '/' << uid; return 0; } return it.value(); @@ -440,7 +441,7 @@ ActionContainer *ActionManagerPrivate::actionContainer(int uid) const const IdContainerMap::const_iterator it = m_idContainerMap.constFind(uid); if (it == m_idContainerMap.constEnd()) { if (warnAboutFindFailures) - qWarning() << "ActionManagerPrivate::actionContainer(): failed to find :" << m_mainWnd->uniqueIDManager()->stringForUniqueIdentifier(uid) << uid; + qWarning() << "ActionManagerPrivate::actionContainer(): failed to find :" << UniqueIDManager::instance()->stringForUniqueIdentifier(uid) << uid; return 0; } return it.value(); @@ -458,7 +459,7 @@ void ActionManagerPrivate::initialize() settings->setArrayIndex(i); const QString sid = settings->value(QLatin1String(idKey)).toString(); const QKeySequence key(settings->value(QLatin1String(sequenceKey)).toString()); - const int id = m_mainWnd->uniqueIDManager()->uniqueIdentifier(sid); + const int id = UniqueIDManager::instance()->uniqueIdentifier(sid); Command *cmd = command(id); if (cmd) @@ -478,7 +479,7 @@ void ActionManagerPrivate::saveSettings(QSettings *settings) CommandPrivate *cmd = j.value(); QKeySequence key = cmd->keySequence(); if (key != cmd->defaultKeySequence()) { - const QString sid = m_mainWnd->uniqueIDManager()->stringForUniqueIdentifier(id); + const QString sid = UniqueIDManager::instance()->stringForUniqueIdentifier(id); settings->setArrayIndex(count); settings->setValue(QLatin1String(idKey), sid); settings->setValue(QLatin1String(sequenceKey), key.toString()); diff --git a/src/plugins/coreplugin/actionmanager/actionmanager_p.h b/src/plugins/coreplugin/actionmanager/actionmanager_p.h index f1e106c4bf7..658d3228cce 100644 --- a/src/plugins/coreplugin/actionmanager/actionmanager_p.h +++ b/src/plugins/coreplugin/actionmanager/actionmanager_p.h @@ -65,7 +65,7 @@ class ActionManagerPrivate : public Core::ActionManager Q_OBJECT public: - ActionManagerPrivate(MainWindow *mainWnd, UniqueIDManager *uidmgr); + explicit ActionManagerPrivate(MainWindow *mainWnd); ~ActionManagerPrivate(); void setContext(const QList &context); diff --git a/src/plugins/coreplugin/baseview.cpp b/src/plugins/coreplugin/baseview.cpp index ae93c281fa5..8c04ee05aa7 100644 --- a/src/plugins/coreplugin/baseview.cpp +++ b/src/plugins/coreplugin/baseview.cpp @@ -82,29 +82,10 @@ BaseView::BaseView(QObject *parent) { } -/*! - \fn BaseView::BaseView(const char *name, QWidget *widget, const QList &context, Qt::DockWidgetArea position, QObject *parent) - - Creates a view with the given properties. - - \a name - \a widget - \a context - \a position - \a parent -*/ - -BaseView::BaseView(const char *name, QWidget *widget, const QList &context, IView::ViewPosition position, QObject *parent) - : IView(parent), - m_viewName(name), - m_widget(widget), - m_context(context), - m_defaultPosition(position) -{ -} - /*! \fn BaseView::~BaseView() + + Destructor also destroys the widget. */ BaseView::~BaseView() { diff --git a/src/plugins/coreplugin/baseview.h b/src/plugins/coreplugin/baseview.h index a39e4dc8ca2..6044ace493a 100644 --- a/src/plugins/coreplugin/baseview.h +++ b/src/plugins/coreplugin/baseview.h @@ -40,14 +40,12 @@ namespace Core { -class CORE_EXPORT BaseView - : public IView +class CORE_EXPORT BaseView : public IView { Q_OBJECT public: BaseView(QObject *parent = 0); - BaseView(const char *name, QWidget *widget, const QList &context, IView::ViewPosition position, QObject *parent = 0); ~BaseView(); QList context() const; diff --git a/src/plugins/coreplugin/core.qrc b/src/plugins/coreplugin/core.qrc index c2a38452dcf..a7271ec6beb 100644 --- a/src/plugins/coreplugin/core.qrc +++ b/src/plugins/coreplugin/core.qrc @@ -67,5 +67,6 @@ images/undo.png images/unknownfile.png images/unlocked.png + images/extension.png diff --git a/src/plugins/coreplugin/coreimpl.cpp b/src/plugins/coreplugin/coreimpl.cpp index e9a3799d628..626eca58775 100644 --- a/src/plugins/coreplugin/coreimpl.cpp +++ b/src/plugins/coreplugin/coreimpl.cpp @@ -93,11 +93,6 @@ MessageManager *CoreImpl::messageManager() const return m_mainwindow->messageManager(); } -ExtensionSystem::PluginManager *CoreImpl::pluginManager() const -{ - return m_mainwindow->pluginManager(); -} - EditorManager *CoreImpl::editorManager() const { return m_mainwindow->editorManager(); diff --git a/src/plugins/coreplugin/coreimpl.h b/src/plugins/coreplugin/coreimpl.h index a845a4b9905..25e8878d106 100644 --- a/src/plugins/coreplugin/coreimpl.h +++ b/src/plugins/coreplugin/coreimpl.h @@ -58,7 +58,6 @@ public: FileManager *fileManager() const ; UniqueIDManager *uniqueIDManager() const; MessageManager *messageManager() const; - ExtensionSystem::PluginManager *pluginManager() const; EditorManager *editorManager() const; ProgressManager *progressManager() const; ScriptManager *scriptManager() const; diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp index c6bc596b282..db58f7d721c 100644 --- a/src/plugins/coreplugin/coreplugin.cpp +++ b/src/plugins/coreplugin/coreplugin.cpp @@ -50,7 +50,7 @@ using namespace Core::Internal; CorePlugin::CorePlugin() : - m_mainWindow(new MainWindow), m_welcomeMode(0), m_editMode(0), m_pm(0) + m_mainWindow(new MainWindow), m_welcomeMode(0), m_editMode(0) { } @@ -71,10 +71,10 @@ CorePlugin::~CorePlugin() delete m_mainWindow; } -bool CorePlugin::initialize(const QStringList & /*arguments*/, QString *error_message) +bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage) { - m_pm = ExtensionSystem::PluginManager::instance(); - const bool success = m_mainWindow->init(m_pm, error_message); + Q_UNUSED(arguments); + const bool success = m_mainWindow->init(errorMessage); if (success) { #if !defined(QT_NO_WEBKIT) QWebSettings *webSettings = QWebSettings::globalSettings(); diff --git a/src/plugins/coreplugin/coreplugin.h b/src/plugins/coreplugin/coreplugin.h index 020f407829a..b2aff60bca1 100644 --- a/src/plugins/coreplugin/coreplugin.h +++ b/src/plugins/coreplugin/coreplugin.h @@ -51,7 +51,7 @@ public: CorePlugin(); ~CorePlugin(); - bool initialize(const QStringList &arguments, QString *error_message = 0); + bool initialize(const QStringList &arguments, QString *errorMessage = 0); void extensionsInitialized(); public slots: @@ -61,8 +61,6 @@ private: MainWindow *m_mainWindow; WelcomeMode *m_welcomeMode; EditMode *m_editMode; - - ExtensionSystem::PluginManager *m_pm; }; } // namespace Internal diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro index 822b550c33b..e24e129d141 100644 --- a/src/plugins/coreplugin/coreplugin.pro +++ b/src/plugins/coreplugin/coreplugin.pro @@ -7,7 +7,7 @@ QT += xml \ include(../../qworkbenchplugin.pri) include(../../libs/utils/utils.pri) -include(../../../shared/scriptwrapper/scriptwrapper.pri) +include(../../shared/scriptwrapper/scriptwrapper.pri) include(coreplugin_dependencies.pri) INCLUDEPATH += dialogs \ actionmanager \ diff --git a/src/plugins/coreplugin/icorelistener.h b/src/plugins/coreplugin/icorelistener.h index 25468fbfd1a..ba0482dfd69 100644 --- a/src/plugins/coreplugin/icorelistener.h +++ b/src/plugins/coreplugin/icorelistener.h @@ -42,23 +42,25 @@ namespace Core { /*! \class Core::ICoreListener - \brief Provides a hook for plugins to veto on certain events emitted from the core plugin. - You implement this interface if you want to prevent certain events from occurring, e.g. - if you want to prevent the closing of the whole application or to prevent the closing - of an editor window under certain conditions. + \brief Provides a hook for plugins to veto on certain events emitted from +the core plugin. + + You implement this interface if you want to prevent certain events from + occurring, e.g. if you want to prevent the closing of the whole application + or to prevent the closing of an editor window under certain conditions. If e.g. the application window requests a close, then first - ICoreListener::coreAboutToClose() is called (in arbitrary order) - on all registered objects implementing this interface. If one if these calls returns - false, the process is aborted and the event is ignored. - If all calls return true, the corresponding signal is emitted and the event is accepted/performed. + ICoreListener::coreAboutToClose() is called (in arbitrary order) on all + registered objects implementing this interface. If one if these calls returns + false, the process is aborted and the event is ignored. If all calls return + true, the corresponding signal is emitted and the event is accepted/performed. Guidelines for implementing: \list \o Return false from the implemented method if you want to prevent the event. \o You need to add your implementing object to the plugin managers objects: - ICore::pluginManager()->addObject(yourImplementingObject); + ExtensionSystem::PluginManager::instance()->addObject(yourImplementingObject); \o Don't forget to remove the object again at deconstruction (e.g. in the destructor of your plugin). */ diff --git a/src/plugins/coreplugin/images/extension.png b/src/plugins/coreplugin/images/extension.png new file mode 100644 index 00000000000..6bdfc07b830 Binary files /dev/null and b/src/plugins/coreplugin/images/extension.png differ diff --git a/src/plugins/coreplugin/images/linkicon.png b/src/plugins/coreplugin/images/linkicon.png index 864f36f1747..4e4d4f7b7fb 100644 Binary files a/src/plugins/coreplugin/images/linkicon.png and b/src/plugins/coreplugin/images/linkicon.png differ diff --git a/src/plugins/coreplugin/images/splitbutton_horizontal.png b/src/plugins/coreplugin/images/splitbutton_horizontal.png index 7b5f4937587..a71fdfdb624 100644 Binary files a/src/plugins/coreplugin/images/splitbutton_horizontal.png and b/src/plugins/coreplugin/images/splitbutton_horizontal.png differ diff --git a/src/plugins/coreplugin/inavigationwidgetfactory.cpp b/src/plugins/coreplugin/inavigationwidgetfactory.cpp index 4d64ad65876..e9b21971b1c 100644 --- a/src/plugins/coreplugin/inavigationwidgetfactory.cpp +++ b/src/plugins/coreplugin/inavigationwidgetfactory.cpp @@ -33,6 +33,8 @@ #include "inavigationwidgetfactory.h" +#include + using namespace Core; INavigationWidgetFactory::INavigationWidgetFactory() diff --git a/src/plugins/coreplugin/inavigationwidgetfactory.h b/src/plugins/coreplugin/inavigationwidgetfactory.h index e3bb73e7b30..78a8d059a8f 100644 --- a/src/plugins/coreplugin/inavigationwidgetfactory.h +++ b/src/plugins/coreplugin/inavigationwidgetfactory.h @@ -37,18 +37,19 @@ #include #include #include -#include QT_BEGIN_NAMESPACE class QToolButton; +class QKeySequence; class QWidget; QT_END_NAMESPACE namespace Core { -struct NavigationView { - QWidget *widget; - QList doockToolBarWidgets; +struct NavigationView +{ + QWidget *widget; + QList doockToolBarWidgets; }; class CORE_EXPORT INavigationWidgetFactory : public QObject diff --git a/src/plugins/coreplugin/iview.h b/src/plugins/coreplugin/iview.h index 0bce0f53544..8c419b5e8ff 100644 --- a/src/plugins/coreplugin/iview.h +++ b/src/plugins/coreplugin/iview.h @@ -36,14 +36,11 @@ #include "core_global.h" -#include - #include namespace Core { -class CORE_EXPORT IView - : public IContext +class CORE_EXPORT IView : public IContext { Q_OBJECT public: diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index f15db0347ad..4269dea7d3d 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -116,7 +116,7 @@ MainWindow::MainWindow() : m_additionalContexts(m_globalContext), m_settings(new QSettings(QSettings::IniFormat, QSettings::UserScope, QLatin1String("Nokia"), QLatin1String("QtCreator"), this)), m_printer(0), - m_actionManager(new ActionManagerPrivate(this, m_uniqueIDManager)), + m_actionManager(new ActionManagerPrivate(this)), m_editorManager(0), m_fileManager(new FileManager(this)), m_progressManager(new ProgressManagerPrivate()), @@ -130,8 +130,6 @@ MainWindow::MainWindow() : m_rightPaneWidget(0), m_versionDialog(0), m_activeContext(0), - m_pluginManager(0), - m_outputPane(new OutputPane(m_globalContext)), m_outputMode(0), m_generalSettings(new GeneralSettings), m_shortcutSettings(new ShortcutSettings), @@ -150,8 +148,28 @@ MainWindow::MainWindow() : #endif m_toggleSideBarButton(new QToolButton) { + OutputPaneManager::create(); + setWindowTitle(tr("Qt Creator")); qApp->setWindowIcon(QIcon(":/core/images/qtcreator_logo_128.png")); + QCoreApplication::setApplicationName(QLatin1String("QtCreator")); + QCoreApplication::setApplicationVersion(QLatin1String(Core::Constants::IDE_VERSION_LONG)); + QCoreApplication::setOrganizationName(QLatin1String("Nokia")); + QSettings::setDefaultFormat(QSettings::IniFormat); + QString baseName = qApp->style()->objectName(); +#ifdef Q_WS_X11 + if (baseName == "windows") { + // Sometimes we get the standard windows 95 style as a fallback + // e.g. if we are running on a KDE4 desktop + QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION"); + if (desktopEnvironment == "kde") + baseName = "plastique"; + else + baseName = "cleanlooks"; + } +#endif + qApp->setStyle(new ManhattanStyle(baseName)); + setDockNestingEnabled(true); setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); @@ -183,23 +201,6 @@ MainWindow::MainWindow() : //signal(SIGINT, handleSigInt); #endif - QCoreApplication::setApplicationName(QLatin1String("QtCreator")); - QCoreApplication::setApplicationVersion(QLatin1String(Core::Constants::IDE_VERSION_LONG)); - QCoreApplication::setOrganizationName(QLatin1String("Nokia")); - QSettings::setDefaultFormat(QSettings::IniFormat); - QString baseName = qApp->style()->objectName(); -#ifdef Q_WS_X11 - if (baseName == "windows") { - // Sometimes we get the standard windows 95 style as a fallback - // e.g. if we are running on a KDE4 desktop - QByteArray desktopEnvironment = qgetenv("DESKTOP_SESSION"); - if (desktopEnvironment == "kde") - baseName = "plastique"; - else - baseName = "cleanlooks"; - } -#endif - qApp->setStyle(new ManhattanStyle(baseName)); statusBar()->setProperty("p_styled", true); } @@ -224,8 +225,9 @@ void MainWindow::setSuppressNavigationWidget(bool suppress) MainWindow::~MainWindow() { hide(); - m_pluginManager->removeObject(m_shortcutSettings); - m_pluginManager->removeObject(m_generalSettings); + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + pm->removeObject(m_shortcutSettings); + pm->removeObject(m_generalSettings); delete m_messageManager; m_messageManager = 0; delete m_shortcutSettings; @@ -240,17 +242,17 @@ MainWindow::~MainWindow() m_uniqueIDManager = 0; delete m_vcsManager; m_vcsManager = 0; - m_pluginManager->removeObject(m_outputMode); + pm->removeObject(m_outputMode); delete m_outputMode; m_outputMode = 0; //we need to delete editormanager and viewmanager explicitly before the end of the destructor, //because they might trigger stuff that tries to access data from editorwindow, like removeContextWidget // All modes are now gone - delete OutputPane::instance(); + OutputPaneManager::destroy(); - // Now that the OutputPane is gone, is a good time to delete the view - m_pluginManager->removeObject(m_outputView); + // Now that the OutputPaneManager is gone, is a good time to delete the view + pm->removeObject(m_outputView); delete m_outputView; delete m_editorManager; @@ -259,7 +261,7 @@ MainWindow::~MainWindow() m_viewManager = 0; delete m_progressManager; m_progressManager = 0; - m_pluginManager->removeObject(m_coreImpl); + pm->removeObject(m_coreImpl); delete m_coreImpl; m_coreImpl = 0; @@ -275,10 +277,12 @@ MainWindow::~MainWindow() m_mimeDatabase = 0; } -bool MainWindow::init(ExtensionSystem::PluginManager *pm, QString *) +bool MainWindow::init(QString *errorMessage) { - m_pluginManager = pm; - m_pluginManager->addObject(m_coreImpl); + Q_UNUSED(errorMessage); + + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + pm->addObject(m_coreImpl); m_viewManager->init(); m_modeManager->init(); m_progressManager->init(); @@ -299,15 +303,18 @@ bool MainWindow::init(ExtensionSystem::PluginManager *pm, QString *) outputModeWidget->layout()->addWidget(new Core::FindToolBarPlaceHolder(m_outputMode)); outputModeWidget->setFocusProxy(oph); - m_outputMode->setContext(m_outputPane->context()); - m_pluginManager->addObject(m_outputMode); - m_pluginManager->addObject(m_generalSettings); - m_pluginManager->addObject(m_shortcutSettings); + m_outputMode->setContext(m_globalContext); + pm->addObject(m_outputMode); + pm->addObject(m_generalSettings); + pm->addObject(m_shortcutSettings); - // Add widget to the bottom, we create the view here instead of inside the OutputPane, since - // the ViewManager needs to be initilized before - m_outputView = new Core::BaseView("OutputWindow.Buttons", m_outputPane->buttonsWidget(), QList(), Core::IView::Second); - m_pluginManager->addObject(m_outputView); + // Add widget to the bottom, we create the view here instead of inside the + // OutputPaneManager, since the ViewManager needs to be initilized before + m_outputView = new Core::BaseView; + m_outputView->setUniqueViewName("OutputWindow.Buttons"); + m_outputView->setWidget(OutputPaneManager::instance()->buttonsWidget()); + m_outputView->setDefaultPosition(Core::IView::Second); + pm->addObject(m_outputView); return true; } @@ -317,8 +324,8 @@ void MainWindow::extensionsInitialized() m_viewManager->extensionsInitalized(); - m_messageManager->init(m_pluginManager); - m_outputPane->init(m_pluginManager); + m_messageManager->init(); + OutputPaneManager::instance()->init(); m_actionManager->initialize(); readSettings(); @@ -341,7 +348,7 @@ void MainWindow::closeEvent(QCloseEvent *event) } const QList listeners = - pluginManager()->getObjects(); + ExtensionSystem::PluginManager::instance()->getObjects(); foreach (ICoreListener *listener, listeners) { if (!listener->coreAboutToClose()) { event->ignore(); @@ -756,7 +763,7 @@ void MainWindow::setFocusToEditor() if (focusWidget && focusWidget == qApp->focusWidget()) { if (FindToolBarPlaceHolder::getCurrent()) FindToolBarPlaceHolder::getCurrent()->hide(); - m_outputPane->slotHide(); + OutputPaneManager::instance()->slotHide(); RightPaneWidget::instance()->setShown(false); } } @@ -883,11 +890,6 @@ MimeDatabase *MainWindow::mimeDatabase() const return m_mimeDatabase; } -ExtensionSystem::PluginManager *MainWindow::pluginManager() const -{ - return m_pluginManager; -} - IContext *MainWindow::contextObject(QWidget *widget) { return m_contextWidgets.value(widget); @@ -1115,7 +1117,7 @@ void MainWindow::destroyVersionDialog() void MainWindow::aboutPlugins() { - PluginDialog dialog(ExtensionSystem::PluginManager::instance(), this); + PluginDialog dialog(this); dialog.exec(); } diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h index 4fa8f7472c1..c0203a2af37 100644 --- a/src/plugins/coreplugin/mainwindow.h +++ b/src/plugins/coreplugin/mainwindow.h @@ -49,10 +49,6 @@ class QSettings; class QShortcut; QT_END_NAMESPACE -namespace ExtensionSystem { -class PluginManager; -} - namespace Core { class ActionManager; @@ -80,13 +76,12 @@ class CoreImpl; class FancyTabWidget; class GeneralSettings; class NavigationWidget; -class OutputPane; class ProgressManagerPrivate; class ShortcutSettings; class ViewManager; class VersionDialog; -class CORE_EXPORT MainWindow : public QMainWindow +class CORE_EXPORT MainWindow : public QMainWindow { Q_OBJECT @@ -94,7 +89,7 @@ public: MainWindow(); ~MainWindow(); - bool init(ExtensionSystem::PluginManager *pm, QString *error_message); + bool init(QString *errorMessage); void extensionsInitialized(); IContext *contextObject(QWidget *widget); @@ -104,12 +99,10 @@ public: void openFiles(const QStringList &fileNames); - inline ExtensionSystem::PluginManager *pluginManager() { return m_pluginManager; } Core::ActionManager *actionManager() const; Core::FileManager *fileManager() const; Core::UniqueIDManager *uniqueIDManager() const; Core::MessageManager *messageManager() const; - ExtensionSystem::PluginManager *pluginManager() const; Core::EditorManager *editorManager() const; Core::ProgressManager *progressManager() const; Core::ScriptManager *scriptManager() const; @@ -196,9 +189,6 @@ private: QMap m_contextWidgets; - ExtensionSystem::PluginManager *m_pluginManager; - - OutputPane *m_outputPane; BaseMode *m_outputMode; GeneralSettings *m_generalSettings; ShortcutSettings *m_shortcutSettings; diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index a38a6c9774b..ee3ca2f62d1 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -345,12 +345,11 @@ void ManhattanStyle::polish(QPalette &pal) QIcon ManhattanStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { - static const QIcon closeButton(":/core/images/closebutton.png"); QIcon icon; switch (standardIcon) { case QStyle::SP_TitleBarCloseButton: - icon = closeButton; - break; + case QStyle::SP_ToolBarHorizontalExtensionButton: + return QIcon(standardPixmap(standardIcon, option, widget)); default: icon = d->style->standardIcon(standardIcon, option, widget); } @@ -360,11 +359,20 @@ QIcon ManhattanStyle::standardIconImplementation(StandardPixmap standardIcon, co QPixmap ManhattanStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const { - static const QPixmap closeButton(":/core/images/closebutton.png"); + if (widget && !panelWidget(widget)) + return d->style->standardPixmap(standardPixmap, opt, widget); + QPixmap pixmap; switch (standardPixmap) { - case QStyle::SP_TitleBarCloseButton: - pixmap = closeButton; + case QStyle::SP_ToolBarHorizontalExtensionButton: { + static const QPixmap extButton(":/core/images/extension.png"); + pixmap = extButton; + } + break; + case QStyle::SP_TitleBarCloseButton: { + static const QPixmap closeButton(":/core/images/closebutton.png"); + pixmap = closeButton; + } break; default: pixmap = d->style->standardPixmap(standardPixmap, opt, widget); @@ -593,6 +601,84 @@ void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption painter->restore(); } break; + case PE_IndicatorArrowUp: + case PE_IndicatorArrowDown: + case PE_IndicatorArrowRight: + case PE_IndicatorArrowLeft: + { + // From windowsstyle but modified to enable AA + if (option->rect.width() <= 1 || option->rect.height() <= 1) + break; + + QRect r = option->rect; + int size = qMin(r.height(), r.width()); + QPixmap pixmap; + QString pixmapName; + pixmapName.sprintf("%s-%s-%d-%d-%d-%lld", + "$qt_ia", metaObject()->className(), + uint(option->state), element, + size, option->palette.cacheKey()); + if (!QPixmapCache::find(pixmapName, pixmap)) { + int border = size/5; + int sqsize = 2*(size/2); + QImage image(sqsize, sqsize, QImage::Format_ARGB32); + image.fill(Qt::transparent); + QPainter imagePainter(&image); + imagePainter.setRenderHint(QPainter::Antialiasing, true); + imagePainter.translate(0.5, 0.5); + QPolygon a; + switch (element) { + case PE_IndicatorArrowUp: + a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize - border, sqsize/2); + break; + case PE_IndicatorArrowDown: + a.setPoints(3, border, sqsize/2, sqsize/2, sqsize - border, sqsize - border, sqsize/2); + break; + case PE_IndicatorArrowRight: + a.setPoints(3, sqsize - border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border); + break; + case PE_IndicatorArrowLeft: + a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border); + break; + default: + break; + } + + int bsx = 0; + int bsy = 0; + + if (option->state & State_Sunken) { + bsx = pixelMetric(PM_ButtonShiftHorizontal); + bsy = pixelMetric(PM_ButtonShiftVertical); + } + + QRect bounds = a.boundingRect(); + int sx = sqsize / 2 - bounds.center().x() - 1; + int sy = sqsize / 2 - bounds.center().y() - 1; + imagePainter.translate(sx + bsx, sy + bsy); + imagePainter.setPen(option->palette.buttonText().color()); + imagePainter.setBrush(option->palette.buttonText()); + + if (!(option->state & State_Enabled)) { + imagePainter.translate(1, 1); + imagePainter.setBrush(option->palette.light().color()); + imagePainter.setPen(option->palette.light().color()); + imagePainter.drawPolygon(a); + imagePainter.translate(-1, -1); + imagePainter.setBrush(option->palette.mid().color()); + imagePainter.setPen(option->palette.mid().color()); + } + + imagePainter.drawPolygon(a); + imagePainter.end(); + pixmap = QPixmap::fromImage(image); + QPixmapCache::insert(pixmapName, pixmap); + } + int xOffset = r.x() + (r.width() - size)/2; + int yOffset = r.y() + (r.height() - size)/2; + painter->drawPixmap(xOffset, yOffset, pixmap); + } + break; default: d->style->drawPrimitive(element, option, painter, widget); @@ -902,7 +988,7 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti newBtn.palette = panelPalette(option->palette); newBtn.rect = QRect(ir.right() - arrowSize - 1, ir.height() - arrowSize - 2, arrowSize, arrowSize); - QWindowsStyle::drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget); + drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget); } } break; @@ -929,7 +1015,7 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti pal.setBrush(QPalette::All, QPalette::ButtonText, StyleHelper::panelTextColor()); arrowOpt.palette = pal; - QWindowsStyle::drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget); + drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, painter, widget); painter->restore(); } diff --git a/src/plugins/coreplugin/messagemanager.cpp b/src/plugins/coreplugin/messagemanager.cpp index 1b74995ef4d..255a92de085 100644 --- a/src/plugins/coreplugin/messagemanager.cpp +++ b/src/plugins/coreplugin/messagemanager.cpp @@ -44,26 +44,26 @@ using namespace Core; MessageManager *MessageManager::m_instance = 0; MessageManager::MessageManager() - : m_pm(0), m_messageOutputWindow(0) + : m_messageOutputWindow(0) { m_instance = this; } MessageManager::~MessageManager() { - if (m_pm && m_messageOutputWindow) { - m_pm->removeObject(m_messageOutputWindow); + ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); + if (pm && m_messageOutputWindow) { + pm->removeObject(m_messageOutputWindow); delete m_messageOutputWindow; } m_instance = 0; } -void MessageManager::init(ExtensionSystem::PluginManager *pm) +void MessageManager::init() { - m_pm = pm; m_messageOutputWindow = new Internal::MessageOutputWindow; - pm->addObject(m_messageOutputWindow); + ExtensionSystem::PluginManager::instance()->addObject(m_messageOutputWindow); } void MessageManager::showOutputPane() diff --git a/src/plugins/coreplugin/messagemanager.h b/src/plugins/coreplugin/messagemanager.h index 12a1524cb47..7f9716b78e4 100644 --- a/src/plugins/coreplugin/messagemanager.h +++ b/src/plugins/coreplugin/messagemanager.h @@ -37,8 +37,6 @@ #include "core_global.h" #include -namespace ExtensionSystem { class PluginManager; } - namespace Core { namespace Internal { @@ -53,7 +51,7 @@ public: MessageManager(); ~MessageManager(); - void init(ExtensionSystem::PluginManager *pm); + void init(); static MessageManager *instance() { return m_instance; } @@ -64,7 +62,6 @@ public slots: void printToOutputPane(const QString &text, bool bringToForeground = true); private: - ExtensionSystem::PluginManager *m_pm; Internal::MessageOutputWindow *m_messageOutputWindow; static MessageManager *m_instance; diff --git a/src/plugins/coreplugin/mimedatabase.h b/src/plugins/coreplugin/mimedatabase.h index d7d696bd723..f40cb45c306 100644 --- a/src/plugins/coreplugin/mimedatabase.h +++ b/src/plugins/coreplugin/mimedatabase.h @@ -120,7 +120,8 @@ private: * Extensions: * - List of suffixes and preferred suffix (derived from glob patterns). */ -class CORE_EXPORT MimeType { +class CORE_EXPORT MimeType +{ public: /* Return value of a glob match, which is higher than magic */ enum { GlobMatchPriority = 101 }; diff --git a/src/plugins/coreplugin/outputpane.cpp b/src/plugins/coreplugin/outputpane.cpp index 1556f7e05cb..e80fec22b67 100644 --- a/src/plugins/coreplugin/outputpane.cpp +++ b/src/plugins/coreplugin/outputpane.cpp @@ -81,7 +81,7 @@ private: OutputPanePlaceHolder *OutputPanePlaceHolder::m_current = 0; OutputPanePlaceHolder::OutputPanePlaceHolder(Core::IMode *mode, QWidget *parent) - :QWidget(parent), m_mode(mode), m_closeable(true) + : QWidget(parent), m_mode(mode), m_closeable(true) { setVisible(false); setLayout(new QVBoxLayout); @@ -98,8 +98,8 @@ OutputPanePlaceHolder::OutputPanePlaceHolder(Core::IMode *mode, QWidget *parent) OutputPanePlaceHolder::~OutputPanePlaceHolder() { if (m_current == this) { - OutputPane::instance()->setParent(0); - OutputPane::instance()->hide(); + OutputPaneManager::instance()->setParent(0); + OutputPaneManager::instance()->hide(); } } @@ -117,45 +117,54 @@ void OutputPanePlaceHolder::currentModeChanged(Core::IMode *mode) { if (m_current == this) { m_current = 0; - OutputPane::instance()->setParent(0); - OutputPane::instance()->hide(); - OutputPane::instance()->updateStatusButtons(false); + OutputPaneManager::instance()->setParent(0); + OutputPaneManager::instance()->hide(); + OutputPaneManager::instance()->updateStatusButtons(false); } if (m_mode == mode) { m_current = this; - layout()->addWidget(OutputPane::instance()); - OutputPane::instance()->show(); - OutputPane::instance()->updateStatusButtons(isVisible()); - OutputPane::instance()->setCloseable(m_closeable); + layout()->addWidget(OutputPaneManager::instance()); + OutputPaneManager::instance()->show(); + OutputPaneManager::instance()->updateStatusButtons(isVisible()); + OutputPaneManager::instance()->setCloseable(m_closeable); } } //// -// OutputPane +// OutputPaneManager //// -OutputPane *OutputPane::m_instance = 0; +static OutputPaneManager *m_instance = 0; -OutputPane *OutputPane::instance() +void OutputPaneManager::create() +{ + m_instance = new OutputPaneManager; +} + +void OutputPaneManager::destroy() +{ + delete m_instance; + m_instance = 0; +} + +OutputPaneManager *OutputPaneManager::instance() { return m_instance; } -void OutputPane::updateStatusButtons(bool visible) +void OutputPaneManager::updateStatusButtons(bool visible) { int idx = m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt(); if (m_buttons.value(idx)) m_buttons.value(idx)->setChecked(visible); } -OutputPane::OutputPane(const QList &context, QWidget *parent) : +OutputPaneManager::OutputPaneManager(QWidget *parent) : QWidget(parent), - m_context(context), m_widgetComboBox(new QComboBox), m_clearButton(new QToolButton), m_closeButton(new QToolButton), m_closeAction(0), - m_pluginManager(0), m_lastIndex(-1), m_outputWidgetPane(new QStackedWidget), m_opToolBarWidgets(new QStackedWidget) @@ -191,24 +200,19 @@ OutputPane::OutputPane(const QList &context, QWidget *parent) : #else m_buttonsWidget->layout()->setSpacing(4); #endif - - m_instance = this; } -OutputPane::~OutputPane() +OutputPaneManager::~OutputPaneManager() { - m_instance = 0; } -QWidget *OutputPane::buttonsWidget() +QWidget *OutputPaneManager::buttonsWidget() { return m_buttonsWidget; } -void OutputPane::init(ExtensionSystem::PluginManager *pm) +void OutputPaneManager::init() { - m_pluginManager = pm; - ActionManager *am = Core::ICore::instance()->actionManager(); ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW); @@ -217,7 +221,8 @@ void OutputPane::init(ExtensionSystem::PluginManager *pm) mwindow->addMenu(mpanes, Constants::G_WINDOW_PANES); mpanes->menu()->setTitle(tr("Output &Panes")); - QList panes = m_pluginManager->getObjects(); + QList panes = ExtensionSystem::PluginManager::instance() + ->getObjects(); QMultiMap sorted; foreach (IOutputPane* outPane, panes) sorted.insertMulti(outPane->priorityInStatusBar(), outPane); @@ -251,7 +256,7 @@ void OutputPane::init(ExtensionSystem::PluginManager *pm) actionId.remove(QLatin1Char(' ')); QAction *action = new QAction(outPane->name(), this); - Command *cmd = am->registerAction(action, actionId, m_context); + Command *cmd = am->registerAction(action, actionId, QList() << Constants::C_GLOBAL_ID); if (outPane->priorityInStatusBar() != -1) { #ifdef Q_OS_MAC cmd->setDefaultKeySequence(QKeySequence("Ctrl+" + QString::number(shortcutNumber))); @@ -281,7 +286,7 @@ void OutputPane::init(ExtensionSystem::PluginManager *pm) changePage(); } -void OutputPane::shortcutTriggered() +void OutputPaneManager::shortcutTriggered() { QAction *action = qobject_cast(sender()); if (action && m_actions.contains(action)) { @@ -305,7 +310,7 @@ void OutputPane::shortcutTriggered() } } -void OutputPane::buttonTriggered() +void OutputPaneManager::buttonTriggered() { QPushButton *button = qobject_cast(sender()); QMap::const_iterator it, end; @@ -327,7 +332,7 @@ void OutputPane::buttonTriggered() } } -void OutputPane::updateToolTip() +void OutputPaneManager::updateToolTip() { QAction *action = qobject_cast(sender()); if (action) { @@ -337,7 +342,7 @@ void OutputPane::updateToolTip() } } -void OutputPane::slotHide() +void OutputPaneManager::slotHide() { if (OutputPanePlaceHolder::m_current) { OutputPanePlaceHolder::m_current->setVisible(false); @@ -349,7 +354,7 @@ void OutputPane::slotHide() } } -int OutputPane::findIndexForPage(IOutputPane *out) +int OutputPaneManager::findIndexForPage(IOutputPane *out) { if (!out) return -1; @@ -369,7 +374,7 @@ int OutputPane::findIndexForPage(IOutputPane *out) return -1; } -void OutputPane::ensurePageVisible(int idx) +void OutputPaneManager::ensurePageVisible(int idx) { if (m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() != idx) { m_widgetComboBox->setCurrentIndex(m_widgetComboBox->findData(idx)); @@ -379,13 +384,13 @@ void OutputPane::ensurePageVisible(int idx) } -void OutputPane::showPage(bool focus) +void OutputPaneManager::showPage(bool focus) { int idx = findIndexForPage(qobject_cast(sender())); showPage(idx, focus); } -void OutputPane::showPage(int idx, bool focus) +void OutputPaneManager::showPage(int idx, bool focus) { IOutputPane *out = m_pageMap.value(idx); if (idx > -1) { @@ -404,7 +409,7 @@ void OutputPane::showPage(int idx, bool focus) } } -void OutputPane::togglePage(bool focus) +void OutputPaneManager::togglePage(bool focus) { int idx = findIndexForPage(qobject_cast(sender())); if (OutputPanePlaceHolder::m_current @@ -416,23 +421,23 @@ void OutputPane::togglePage(bool focus) } } -void OutputPane::setCloseable(bool b) +void OutputPaneManager::setCloseable(bool b) { m_closeAction->setVisible(b); } -bool OutputPane::closeable() +bool OutputPaneManager::closeable() { return m_closeButton->isVisibleTo(m_closeButton->parentWidget()); } -void OutputPane::focusInEvent(QFocusEvent *e) +void OutputPaneManager::focusInEvent(QFocusEvent *e) { if (m_outputWidgetPane->currentWidget()) m_outputWidgetPane->currentWidget()->setFocus(e->reason()); } -void OutputPane::changePage() +void OutputPaneManager::changePage() { if (m_outputWidgetPane->count() <= 0) return; @@ -469,7 +474,7 @@ void OutputPane::changePage() m_lastIndex = idx; } -void OutputPane::clearPage() +void OutputPaneManager::clearPage() { if (m_pageMap.contains(m_outputWidgetPane->currentIndex())) m_pageMap.value(m_outputWidgetPane->currentIndex())->clearContents(); diff --git a/src/plugins/coreplugin/outputpane.h b/src/plugins/coreplugin/outputpane.h index 8505b34bfa8..b947b12aef2 100644 --- a/src/plugins/coreplugin/outputpane.h +++ b/src/plugins/coreplugin/outputpane.h @@ -47,21 +47,20 @@ class QStackedWidget; class QPushButton; QT_END_NAMESPACE -namespace ExtensionSystem { class PluginManager; } - namespace Core { class IMode; class IOutputPane; namespace Internal { -class OutputPane; +class OutputPaneManager; +class MainWindow; } class CORE_EXPORT OutputPanePlaceHolder : public QWidget { - friend class Core::Internal::OutputPane; // needs to set m_visible and thus access m_current + friend class Core::Internal::OutputPaneManager; // needs to set m_visible and thus access m_current Q_OBJECT public: OutputPanePlaceHolder(Core::IMode *mode, QWidget *parent = 0); @@ -80,17 +79,13 @@ private: namespace Internal { -class OutputPane - : public QWidget +class OutputPaneManager : public QWidget { Q_OBJECT public: - OutputPane(const QList &context, QWidget *parent = 0); - ~OutputPane(); - void init(ExtensionSystem::PluginManager *pm); - static OutputPane *instance(); - const QList &context() const { return m_context; } + void init(); + static OutputPaneManager *instance(); void setCloseable(bool b); bool closeable(); QWidget *buttonsWidget(); @@ -103,7 +98,7 @@ public slots: protected: void focusInEvent(QFocusEvent *e); -private slots:; +private slots: void changePage(); void showPage(bool focus); void togglePage(bool focus); @@ -112,17 +107,23 @@ private slots:; void buttonTriggered(); private: + // the only class that is allowed to create and destroy + friend class MainWindow; + + static void create(); + static void destroy(); + + OutputPaneManager(QWidget *parent = 0); + ~OutputPaneManager(); + void showPage(int idx, bool focus); void ensurePageVisible(int idx); int findIndexForPage(IOutputPane *out); - const QList m_context; QComboBox *m_widgetComboBox; QToolButton *m_clearButton; QToolButton *m_closeButton; QAction *m_closeAction; - ExtensionSystem::PluginManager *m_pluginManager; - QMap m_pageMap; int m_lastIndex; @@ -131,8 +132,6 @@ private: QWidget *m_buttonsWidget; QMap m_buttons; QMap m_actions; - - static OutputPane *m_instance; }; } // namespace Internal diff --git a/src/plugins/coreplugin/plugindialog.cpp b/src/plugins/coreplugin/plugindialog.cpp index 29ea470411c..3bd7dc2a03a 100644 --- a/src/plugins/coreplugin/plugindialog.cpp +++ b/src/plugins/coreplugin/plugindialog.cpp @@ -48,9 +48,9 @@ using namespace Core::Internal; -PluginDialog::PluginDialog(ExtensionSystem::PluginManager *manager, QWidget *parent) +PluginDialog::PluginDialog(QWidget *parent) : QDialog(parent), - m_view(new ExtensionSystem::PluginView(manager, this)) + m_view(new ExtensionSystem::PluginView(ExtensionSystem::PluginManager::instance(), this)) { QVBoxLayout *vl = new QVBoxLayout(this); vl->addWidget(m_view); diff --git a/src/plugins/coreplugin/plugindialog.h b/src/plugins/coreplugin/plugindialog.h index ace03bb3c17..808490d94c1 100644 --- a/src/plugins/coreplugin/plugindialog.h +++ b/src/plugins/coreplugin/plugindialog.h @@ -41,7 +41,6 @@ class QPushButton; QT_END_NAMESPACE namespace ExtensionSystem { -class PluginManager; class PluginSpec; class PluginView; } @@ -54,7 +53,7 @@ class PluginDialog : public QDialog Q_OBJECT public: - PluginDialog(ExtensionSystem::PluginManager *manager, QWidget *parent); + explicit PluginDialog(QWidget *parent); private slots: void updateButtons(); diff --git a/src/plugins/coreplugin/rightpane.h b/src/plugins/coreplugin/rightpane.h index 776b9fdb2bb..0eb0159be44 100644 --- a/src/plugins/coreplugin/rightpane.h +++ b/src/plugins/coreplugin/rightpane.h @@ -44,41 +44,51 @@ namespace Core { class IMode; class RightPaneWidget; -// TODO: The right pane works only for the help plugin atm. -// It can't cope with more than one plugin publishing objects they want in the right pane -// For that the API would need to be different. (Might be that instead of adding objects -// to the pool, there should be a method RightPaneWidget::setWidget(QWidget *w) -// Anyway if a second plugin wants to show something there, redesign this API +// TODO: The right pane works only for the help plugin atm. It can't cope +// with more than one plugin publishing objects they want in the right pane +// For that the API would need to be different. (Might be that instead of +// adding objects to the pool, there should be a method +// RightPaneWidget::setWidget(QWidget *w) Anyway if a second plugin wants to +// show something there, redesign this API + class CORE_EXPORT RightPanePlaceHolder : public QWidget { friend class Core::RightPaneWidget; Q_OBJECT + public: RightPanePlaceHolder(Core::IMode *mode, QWidget *parent = 0); ~RightPanePlaceHolder(); static RightPanePlaceHolder *current(); + private slots: void currentModeChanged(Core::IMode *); + private: void applyStoredSize(int width); Core::IMode *m_mode; static RightPanePlaceHolder* m_current; }; + class CORE_EXPORT BaseRightPaneWidget : public QObject { Q_OBJECT + public: BaseRightPaneWidget(QWidget *widget); ~BaseRightPaneWidget(); QWidget *widget() const; + private: QWidget *m_widget; }; + class CORE_EXPORT RightPaneWidget : public QWidget { Q_OBJECT + public: RightPaneWidget(); ~RightPaneWidget(); @@ -89,11 +99,13 @@ public: bool isShown(); void setShown(bool b); - static RightPaneWidget* instance(); + static RightPaneWidget *instance(); int storedWidth(); + protected: void resizeEvent(QResizeEvent *); + private slots: void objectAdded(QObject *obj); void aboutToRemoveObject(QObject *obj); diff --git a/src/plugins/coreplugin/styleanimator.cpp b/src/plugins/coreplugin/styleanimator.cpp index f0fda1f512c..2762cbcc383 100644 --- a/src/plugins/coreplugin/styleanimator.cpp +++ b/src/plugins/coreplugin/styleanimator.cpp @@ -54,25 +54,25 @@ void Animation::paint(QPainter *painter, const QStyleOption *option) void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) { - if (_secondaryImage.isNull() || _primaryImage.isNull()) + if (m_secondaryImage.isNull() || m_primaryImage.isNull()) return; - if (_tempImage.isNull()) - _tempImage = _secondaryImage; + if (m_tempImage.isNull()) + m_tempImage = m_secondaryImage; const int a = qRound(alpha*256); const int ia = 256 - a; - const int sw = _primaryImage.width(); - const int sh = _primaryImage.height(); - const int bpl = _primaryImage.bytesPerLine(); - switch (_primaryImage.depth()) { + const int sw = m_primaryImage.width(); + const int sh = m_primaryImage.height(); + const int bpl = m_primaryImage.bytesPerLine(); + switch (m_primaryImage.depth()) { case 32: { - uchar *mixed_data = _tempImage.bits(); - const uchar *back_data = _primaryImage.bits(); - const uchar *front_data = _secondaryImage.bits(); + uchar *mixed_data = m_tempImage.bits(); + const uchar *back_data = m_primaryImage.bits(); + const uchar *front_data = m_secondaryImage.bits(); for (int sy = 0; sy < sh; sy++) { - quint32* mixed = (quint32*)mixed_data; + quint32 *mixed = (quint32*)mixed_data; const quint32* back = (const quint32*)back_data; const quint32* front = (const quint32*)front_data; for (int sx = 0; sx < sw; sx++) { @@ -91,27 +91,28 @@ void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) default: break; } - painter->drawImage(rect, _tempImage); + painter->drawImage(rect, m_tempImage); } void Transition::paint(QPainter *painter, const QStyleOption *option) { float alpha = 1.0; - if (_duration > 0) { + if (m_duration > 0) { QTime current = QTime::currentTime(); - if (_startTime > current) - _startTime = current; + if (m_startTime > current) + m_startTime = current; - int timeDiff = _startTime.msecsTo(current); - alpha = timeDiff/(float)_duration; - if (timeDiff > _duration) { - _running = false; + int timeDiff = m_startTime.msecsTo(current); + alpha = timeDiff/(float)m_duration; + if (timeDiff > m_duration) { + m_running = false; alpha = 1.0; } } else { - _running = false; } + m_running = false; + } drawBlendedImage(painter, option->rect, alpha); } diff --git a/src/plugins/coreplugin/styleanimator.h b/src/plugins/coreplugin/styleanimator.h index 7a75056af5d..fb7248b4aa5 100644 --- a/src/plugins/coreplugin/styleanimator.h +++ b/src/plugins/coreplugin/styleanimator.h @@ -51,24 +51,24 @@ class Animation { public : - Animation() : _running(true) { } + Animation() : m_running(true) { } virtual ~Animation() { } - QWidget * widget() const { return _widget; } - bool running() const { return _running; } - const QTime &startTime() const { return _startTime; } - void setRunning(bool val) { _running = val; } - void setWidget(QWidget *widget) { _widget = widget; } - void setStartTime(const QTime &startTime) { _startTime = startTime; } + QWidget * widget() const { return m_widget; } + bool running() const { return m_running; } + const QTime &startTime() const { return m_startTime; } + void setRunning(bool val) { m_running = val; } + void setWidget(QWidget *widget) { m_widget = widget; } + void setStartTime(const QTime &startTime) { m_startTime = startTime; } virtual void paint(QPainter *painter, const QStyleOption *option); protected: void drawBlendedImage(QPainter *painter, QRect rect, float value); - QTime _startTime; - QPointer _widget; - QImage _primaryImage; - QImage _secondaryImage; - QImage _tempImage; - bool _running; + QTime m_startTime; + QPointer m_widget; + QImage m_primaryImage; + QImage m_secondaryImage; + QImage m_tempImage; + bool m_running; }; // Handles state transition animations @@ -76,13 +76,13 @@ class Transition : public Animation { public : Transition() : Animation() {} - virtual ~Transition() { } - void setDuration(int duration) { _duration = duration; } - void setStartImage(const QImage &image) { _primaryImage = image; } - void setEndImage(const QImage &image) { _secondaryImage = image; } + virtual ~Transition() {} + void setDuration(int duration) { m_duration = duration; } + void setStartImage(const QImage &image) { m_primaryImage = image; } + void setEndImage(const QImage &image) { m_secondaryImage = image; } virtual void paint(QPainter *painter, const QStyleOption *option); - int duration() const { return _duration; } - int _duration; //set time in ms to complete a state transition + int duration() const { return m_duration; } + int m_duration; //set time in ms to complete a state transition }; class StyleAnimator : public QObject diff --git a/src/plugins/coreplugin/stylehelper.h b/src/plugins/coreplugin/stylehelper.h index 3a1e8f5b4a2..15b5e6a73c5 100644 --- a/src/plugins/coreplugin/stylehelper.h +++ b/src/plugins/coreplugin/stylehelper.h @@ -69,9 +69,7 @@ public: static void menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect); // Pixmap cache should only be enabled for X11 due to slow gradients - static bool usePixmapCache() { - return true; - } + static bool usePixmapCache() { return true; } private: static QColor m_baseColor; diff --git a/src/plugins/coreplugin/tabpositionindicator.h b/src/plugins/coreplugin/tabpositionindicator.h index 55162cb838f..3dc9de1a028 100644 --- a/src/plugins/coreplugin/tabpositionindicator.h +++ b/src/plugins/coreplugin/tabpositionindicator.h @@ -36,8 +36,6 @@ #include -#define TABPOSITIONINDICATOR_WIDTH 2 - namespace Core { namespace Internal { @@ -46,6 +44,8 @@ class TabPositionIndicator : public QWidget Q_OBJECT public: + enum { TABPOSITIONINDICATOR_WIDTH = 2 }; + TabPositionIndicator(); int indicatorWidth() { return TABPOSITIONINDICATOR_WIDTH; } diff --git a/src/plugins/coreplugin/viewmanager.cpp b/src/plugins/coreplugin/viewmanager.cpp index 052e2dee522..b0663d63f4e 100644 --- a/src/plugins/coreplugin/viewmanager.cpp +++ b/src/plugins/coreplugin/viewmanager.cpp @@ -115,7 +115,8 @@ void ViewManager::saveSettings(QSettings *settings) IView *ViewManager::view(const QString &id) { - QList list = m_mainWnd->pluginManager()->getObjects(); + QList list = + ExtensionSystem::PluginManager::instance()->getObjects(); foreach (IView *view, list) { if (view->uniqueViewName() == id) return view; diff --git a/src/plugins/coreplugin/welcomemode.h b/src/plugins/coreplugin/welcomemode.h index bcd205072f8..56899a4463c 100644 --- a/src/plugins/coreplugin/welcomemode.h +++ b/src/plugins/coreplugin/welcomemode.h @@ -41,7 +41,6 @@ QT_BEGIN_NAMESPACE class QWidget; class QUrl; -class QLabel; QT_END_NAMESPACE namespace Core { @@ -77,8 +76,7 @@ public: const char* uniqueModeName() const; QList context() const; void activated(); - QString contextHelpId() const - { return QLatin1String("Qt Creator"); } + QString contextHelpId() const { return QLatin1String("Qt Creator"); } signals: void requestProject(const QString &project); diff --git a/src/plugins/cpaster/cpaster.pro b/src/plugins/cpaster/cpaster.pro index 4ecdc545371..d75a91de5a1 100644 --- a/src/plugins/cpaster/cpaster.pro +++ b/src/plugins/cpaster/cpaster.pro @@ -12,4 +12,4 @@ SOURCES += cpasterplugin.cpp \ FORMS += settingspage.ui \ pasteselect.ui -include(../../../shared/cpaster/cpaster.pri) +include(../../shared/cpaster/cpaster.pri) diff --git a/src/plugins/cppeditor/cppeditor.pro b/src/plugins/cppeditor/cppeditor.pro index 3204ddf0943..2d28c6c8b86 100644 --- a/src/plugins/cppeditor/cppeditor.pro +++ b/src/plugins/cppeditor/cppeditor.pro @@ -3,6 +3,7 @@ TARGET = CppEditor DEFINES += CPPEDITOR_LIBRARY CONFIG += help include(../../libs/utils/utils.pri) +include(../../shared/indenter/indenter.pri) include(../../qworkbenchplugin.pri) include(cppeditor_dependencies.pri) HEADERS += cppplugin.h \ diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 573c9a25466..824b7b4b1cb 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -435,15 +435,15 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) m_startPosition = findStartOfName(editor); m_completionOperator = T_EOF_SYMBOL; - int endOfExpression = m_startPosition; + int endOfOperator = m_startPosition; // Skip whitespace preceding this position - while (editor->characterAt(endOfExpression - 1).isSpace()) - --endOfExpression; + while (editor->characterAt(endOfOperator - 1).isSpace()) + --endOfOperator; - endOfExpression = startOfOperator(editor, endOfExpression, - &m_completionOperator, - /*want function call =*/ editor->position() == endOfExpression); + int endOfExpression = startOfOperator(editor, endOfOperator, + &m_completionOperator, + /*want function call =*/ true); Core::IFile *file = editor->file(); QString fileName = file->fileName(); @@ -464,6 +464,11 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) m_completionOperator = T_SIGNAL; else if (expression.endsWith(QLatin1String("SLOT"))) m_completionOperator = T_SLOT; + else if (editor->position() != endOfOperator) { + // We don't want a function completion when the cursor isn't at the opening brace + expression.clear(); + m_completionOperator = T_EOF_SYMBOL; + } } } diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 07904b8efa3..4f7e0b1a897 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -913,8 +913,9 @@ void DebuggerPlugin::readSettings() #if defined(Q_OS_WIN32) defaultCommand.append(".exe"); #endif - QString defaultScript = ICore::instance()->resourcePath() + - QLatin1String("/gdb/qt4macros"); + //QString defaultScript = ICore::instance()->resourcePath() + + // QLatin1String("/gdb/qt4macros"); + QString defaultScript; s->beginGroup(QLatin1String("DebugMode")); QByteArray ba = s->value("State", QByteArray()).toByteArray(); diff --git a/src/plugins/designer/designer.pro b/src/plugins/designer/designer.pro index 7006e656148..444eb2e7949 100644 --- a/src/plugins/designer/designer.pro +++ b/src/plugins/designer/designer.pro @@ -2,7 +2,7 @@ TEMPLATE = lib TARGET = Designer include(../../qworkbenchplugin.pri) -include(../../../shared/designerintegrationv2/designerintegration.pri) +include(../../shared/designerintegrationv2/designerintegration.pri) include(cpp/cpp.pri) include(designer_dependencies.pri) diff --git a/src/plugins/fakevim/fakevim.pro b/src/plugins/fakevim/fakevim.pro index 2c85f8c50b2..5c8ecd48429 100644 --- a/src/plugins/fakevim/fakevim.pro +++ b/src/plugins/fakevim/fakevim.pro @@ -8,7 +8,7 @@ include(../../plugins/projectexplorer/projectexplorer.pri) include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/texteditor/texteditor.pri) include(../../plugins/texteditor/cppeditor.pri) -include(../../../shared/indenter/indenter.pri) +include(../../shared/indenter/indenter.pri) # DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII QT += gui diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 9236b8930bb..3b981fa6a23 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -157,6 +158,13 @@ QDebug &operator<<(QDebug &ts, const EditOperation &op) return ts; } +QDebug &operator<<(QDebug &ts, const QList &sels) +{ + foreach (QTextEdit::ExtraSelection sel, sels) + ts << "SEL: " << sel.cursor.anchor() << sel.cursor.position(); + return ts; +} + int lineCount(const QString &text) { //return text.count(QChar(ParagraphSeparator)); @@ -166,11 +174,14 @@ int lineCount(const QString &text) class FakeVimHandler::Private { public: - Private(FakeVimHandler *parent); + Private(FakeVimHandler *parent, QWidget *widget); bool handleEvent(QKeyEvent *ev); void handleExCommand(const QString &cmd); + void setupWidget(); + void restoreWidget(); + private: friend class FakeVimHandler; static int shift(int key) { return key + 32; } @@ -190,7 +201,8 @@ private: int count() const { return mvCount() * opCount(); } int leftDist() const { return m_tc.position() - m_tc.block().position(); } int rightDist() const { return m_tc.block().length() - leftDist() - 1; } - bool atEndOfLine() const { return m_tc.atBlockEnd() && m_tc.block().length()>1; } + bool atEndOfLine() const + { return m_tc.atBlockEnd() && m_tc.block().length() > 1; } int lastPositionInDocument() const; int positionForLine(int line) const; // 1 based line, 0 based pos @@ -207,7 +219,7 @@ private: // helper functions for indenting bool isElectricCharacter(QChar c) const - { return (c == '{' || c == '}' || c == '#'); } + { return c == '{' || c == '}' || c == '#'; } int indentDist() const; void indentRegion(QTextBlock first, QTextBlock last, QChar typedChar=0); void indentCurrentLine(QChar typedChar); @@ -238,9 +250,9 @@ private: int readLineCode(QString &cmd); void selectRange(int beginLine, int endLine); - void setWidget(QWidget *ob); void enterInsertMode(); void enterCommandMode(); + void enterExMode(); void showRedMessage(const QString &msg); void showBlackMessage(const QString &msg); void notImplementedYet(); @@ -305,6 +317,11 @@ public: // extra data for '.' QString m_dotCommand; + // extra data for ';' + QString m_semicolonCount; + int m_semicolonType; // 'f', 'F', 't', 'T' + int m_semicolonKey; + // history for '/' QString lastSearchString() const; QStringList m_searchHistory; @@ -328,12 +345,18 @@ public: // for restoring cursor position int m_savedYankPosition; int m_desiredColumn; + + QPointer m_extraData; + int m_cursorWidth; }; -FakeVimHandler::Private::Private(FakeVimHandler *parent) +FakeVimHandler::Private::Private(FakeVimHandler *parent, QWidget *widget) { q = parent; + m_textedit = qobject_cast(widget); + m_plaintextedit = qobject_cast(widget); + m_mode = CommandMode; m_submode = NoSubMode; m_subsubmode = NoSubSubMode; @@ -341,13 +364,12 @@ FakeVimHandler::Private::Private(FakeVimHandler *parent) m_lastSearchForward = true; m_register = '"'; m_gflag = false; - m_textedit = 0; - m_plaintextedit = 0; m_visualMode = NoVisualMode; m_desiredColumn = 0; m_moveType = MoveInclusive; m_anchor = 0; m_savedYankPosition = 0; + m_cursorWidth = EDITOR(cursorWidth()); m_config[ConfigStartOfLine] = ConfigOn; m_config[ConfigTabStop] = "8"; @@ -403,6 +425,29 @@ bool FakeVimHandler::Private::handleEvent(QKeyEvent *ev) return handled; } +void FakeVimHandler::Private::setupWidget() +{ + enterCommandMode(); + EDITOR(installEventFilter(q)); + //EDITOR(setCursorWidth(QFontMetrics(ed->font()).width(QChar('x'))); + if (m_textedit) { + m_textedit->setLineWrapMode(QTextEdit::NoWrap); + } else if (m_plaintextedit) { + m_plaintextedit->setLineWrapMode(QPlainTextEdit::NoWrap); + } + m_wasReadOnly = EDITOR(isReadOnly()); + showBlackMessage("vi emulation mode."); + updateMiniBuffer(); +} + +void FakeVimHandler::Private::restoreWidget() +{ + //showBlackMessage(QString()); + //updateMiniBuffer(); + EDITOR(removeEventFilter(q)); + EDITOR(setReadOnly(m_wasReadOnly)); +} + bool FakeVimHandler::Private::handleKey(int key, int unmodified, const QString &text) { //qDebug() << "KEY: " << key << text << "POS: " << m_tc.position(); @@ -419,11 +464,12 @@ bool FakeVimHandler::Private::handleKey(int key, int unmodified, const QString & void FakeVimHandler::Private::finishMovement(const QString &dotCommand) { + //qDebug() << "ANCHOR: " << m_anchor; if (m_submode == FilterSubMode) { int beginLine = lineForPosition(anchor()); int endLine = lineForPosition(position()); m_tc.setPosition(qMin(anchor(), position())); - m_mode = ExMode; + enterExMode(); m_commandBuffer = QString(".,+%1!").arg(qAbs(endLine - beginLine)); m_commandHistory.append(QString()); m_commandHistoryIndex = m_commandHistory.size() - 1; @@ -443,6 +489,8 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand) m_mode = InsertMode; m_submode = NoSubMode; } else if (m_submode == DeleteSubMode) { + if (m_moveType == MoveInclusive) + moveRight(); // correct if (!dotCommand.isEmpty()) m_dotCommand = "d" + dotCommand; m_registers[m_register] = recordRemoveSelectedText(); @@ -467,10 +515,8 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand) m_tc.setPosition(startBlock.position()); moveToFirstNonBlankOnLine(); m_submode = NoSubMode; - } else if (m_moveType == MoveExclusive) { - moveLeft(); // correct - m_moveType = MoveInclusive; } + m_moveType = MoveInclusive; m_mvcount.clear(); m_opcount.clear(); m_gflag = false; @@ -489,10 +535,13 @@ void FakeVimHandler::Private::updateSelection() QTextEdit::ExtraSelection sel; sel.cursor = m_tc; sel.format = m_tc.blockCharFormat(); - //sel.format.setFontWeight(QFont::Bold); - //sel.format.setFontUnderline(true); +#if 0 + sel.format.setFontWeight(QFont::Bold); + sel.format.setFontUnderline(true); +#else sel.format.setForeground(Qt::white); sel.format.setBackground(Qt::black); +#endif int cursorPos = m_tc.position(); int anchorPos = m_marks['<']; //qDebug() << "POS: " << cursorPos << " ANCHOR: " << anchorPos; @@ -529,7 +578,8 @@ void FakeVimHandler::Private::updateSelection() } } } - emit q->selectionChanged(editor(), selections); + //qDebug() << "SELECTION: " << selections; + emit q->selectionChanged(selections); } void FakeVimHandler::Private::updateMiniBuffer() @@ -648,9 +698,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, } m_submode = NoSubMode; } else if (m_subsubmode == FtSubSubMode) { + m_semicolonType = m_subsubdata; + m_semicolonKey = key; handleFfTt(key); m_subsubmode = NoSubSubMode; - finishMovement(QString(QChar(m_subsubdata)) + QChar(key)); + finishMovement(); } else if (m_submode == ReplaceSubMode) { if (count() < rightDist() && text.size() == 1 && (text.at(0).isPrint() || text.at(0).isSpace())) { @@ -688,8 +740,22 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, } else { m_mvcount.append(QChar(key)); } + } else if (0 && key == ',') { + // FIXME: fakevim uses ',' by itself, so it is incompatible + m_subsubmode = FtSubSubMode; + // HACK: toggle 'f' <-> 'F', 't' <-> 'T' + m_subsubdata = m_semicolonType ^ 32; + handleFfTt(m_semicolonKey); + m_subsubmode = NoSubSubMode; + finishMovement(); + } else if (key == ';') { + m_subsubmode = FtSubSubMode; + m_subsubdata = m_semicolonType; + handleFfTt(m_semicolonKey); + m_subsubmode = NoSubSubMode; + finishMovement(); } else if (key == ':') { - m_mode = ExMode; + enterExMode(); m_commandBuffer.clear(); if (m_visualMode != NoVisualMode) m_commandBuffer = "'<,'>"; @@ -722,7 +788,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, } else if (key == '!' && m_visualMode == NoVisualMode) { m_submode = FilterSubMode; } else if (key == '!' && m_visualMode == VisualLineMode) { - m_mode = ExMode; + enterExMode(); m_commandBuffer = "'<,'>!"; m_commandHistory.append(QString()); m_commandHistoryIndex = m_commandHistory.size() - 1; @@ -770,9 +836,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, recordBeginGroup(); m_lastInsertion.clear(); } else if (key == 'b') { + m_moveType = MoveExclusive; moveToWordBoundary(false, false); finishMovement(); } else if (key == 'B') { + m_moveType = MoveExclusive; moveToWordBoundary(true, false); finishMovement(); } else if (key == 'c') { @@ -795,7 +863,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, m_mvcount.clear(); m_submode = DeleteSubMode; } else if (key == 'd') { - setAnchor(); + //setAnchor(); leaveVisualMode(); int beginLine = lineForPosition(m_marks['<']); int endLine = lineForPosition(m_marks['>']); @@ -809,10 +877,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, moveRight(rightDist()); finishMovement(); } else if (key == 'e') { + m_moveType = MoveInclusive; moveToWordBoundary(false, true); - m_moveType = MoveExclusive; finishMovement(); } else if (key == 'E') { + m_moveType = MoveInclusive; moveToWordBoundary(true, true); finishMovement(); } else if (key == 'f' || key == 'F') { @@ -1009,13 +1078,22 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, recordRemoveSelectedText(); } finishMovement(); - } else if (key == 'y') { + } else if (key == 'y' && m_visualMode == NoVisualMode) { m_savedYankPosition = m_tc.position(); if (atEndOfLine()) moveLeft(); recordBeginGroup(); setAnchor(); m_submode = YankSubMode; + } else if (key == 'y' && m_visualMode == VisualLineMode) { + int beginLine = lineForPosition(m_marks['<']); + int endLine = lineForPosition(m_marks['>']); + selectRange(beginLine, endLine); + m_registers[m_register] = selectedText(); + m_tc.setPosition(qMin(position(), anchor())); + moveToStartOfLine(); + leaveVisualMode(); + updateSelection(); } else if (key == 'Y') { moveToStartOfLine(); setAnchor(); @@ -1036,6 +1114,20 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified, } recordInsertText(str); recordEndGroup(); + } else if (key == control('d')) { + int sline = cursorLineOnScreen(); + // FIXME: this should use the "scroll" option, and "count" + moveDown(linesOnScreen() / 2); + moveToFirstNonBlankOnLine(); + scrollToLineInDocument(cursorLineInDocument() - sline); + finishMovement(); + } else if (key == control('u')) { + int sline = cursorLineOnScreen(); + // FIXME: this should use the "scroll" option, and "count" + moveUp(linesOnScreen() / 2); + moveToFirstNonBlankOnLine(); + scrollToLineInDocument(cursorLineInDocument() - sline); + finishMovement(); } else if (key == Key_PageDown || key == control('f')) { moveDown(count() * (linesOnScreen() - 2)); finishMovement(); @@ -1271,12 +1363,12 @@ int FakeVimHandler::Private::readLineCode(QString &cmd) void FakeVimHandler::Private::selectRange(int beginLine, int endLine) { - m_tc.setPosition(positionForLine(beginLine), MoveAnchor); + m_anchor = positionForLine(beginLine); if (endLine == linesInDocument()) { - m_tc.setPosition(positionForLine(endLine), KeepAnchor); - m_tc.movePosition(EndOfLine, KeepAnchor); + m_tc.setPosition(positionForLine(endLine), MoveAnchor); + m_tc.movePosition(EndOfLine, MoveAnchor); } else { - m_tc.setPosition(positionForLine(endLine + 1), KeepAnchor); + m_tc.setPosition(positionForLine(endLine + 1), MoveAnchor); } } @@ -1329,21 +1421,40 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0) beginLine = 0; if (endLine == -1) endLine = linesInDocument(); - //qDebug() << "LINES: " << beginLine << endLine; + qDebug() << "LINES: " << beginLine << endLine; bool forced = cmd.startsWith("w!"); QString fileName = reWrite.cap(2); if (fileName.isEmpty()) fileName = m_currentFileName; - QFile file(fileName); - bool exists = file.exists(); + QFile file1(fileName); + bool exists = file1.exists(); if (exists && !forced && !noArgs) { showRedMessage(tr("File '%1' exists (add ! to override)").arg(fileName)); - } else if (file.open(QIODevice::ReadWrite)) { + } else if (file1.open(QIODevice::ReadWrite)) { + file1.close(); + QTextCursor tc = m_tc; selectRange(beginLine, endLine); - emit q->writeFile(fileName, selectedText()); - // check by reading back - file.open(QIODevice::ReadOnly); - QByteArray ba = file.readAll(); + QString contents = selectedText(); + m_tc = tc; + qDebug() << "LINES: " << beginLine << endLine; + bool handled = false; + emit q->writeFileRequested(&handled, fileName, contents); + // nobody cared, so act ourselves + if (!handled) { + //qDebug() << "HANDLING MANUAL SAVE TO " << fileName; + QFile::remove(fileName); + QFile file2(fileName); + if (file2.open(QIODevice::ReadWrite)) { + QTextStream ts(&file2); + ts << contents; + } else { + showRedMessage(tr("Cannot open file '%1' for writing").arg(fileName)); + } + } + // check result by reading back + QFile file3(fileName); + file3.open(QIODevice::ReadOnly); + QByteArray ba = file3.readAll(); showBlackMessage(tr("\"%1\" %2 %3L, %4C written") .arg(fileName).arg(exists ? " " : " [New] ") .arg(ba.count('\n')).arg(ba.size())); @@ -1401,7 +1512,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0) QString info; foreach (const QString &key, m_config.keys()) info += key + ": " + m_config.value(key) + "\n"; - emit q->extraInformationChanged(editor(), info); + emit q->extraInformationChanged(info); } else { notImplementedYet(); } @@ -1417,7 +1528,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0) ++i; info += QString("%1 %2\n").arg(i, -8).arg(item); } - emit q->extraInformationChanged(editor(), info); + emit q->extraInformationChanged(info); } else { notImplementedYet(); } @@ -1566,8 +1677,7 @@ void FakeVimHandler::Private::moveToWordBoundary(bool simple, bool forward) int n = forward ? lastPositionInDocument() - 1 : 0; int lastClass = -1; while (true) { - forward ? moveRight() : moveLeft(); - QChar c = doc->characterAt(m_tc.position()); + QChar c = doc->characterAt(m_tc.position() + (forward ? 1 : -1)); int thisClass = charClass(c, simple); if (thisClass != lastClass && lastClass != 0) --repeat; @@ -1576,6 +1686,7 @@ void FakeVimHandler::Private::moveToWordBoundary(bool simple, bool forward) lastClass = thisClass; if (m_tc.position() == n) break; + forward ? moveRight() : moveLeft(); } } @@ -1752,6 +1863,7 @@ int FakeVimHandler::Private::lineForPosition(int pos) const void FakeVimHandler::Private::enterVisualMode(VisualMode visualMode) { + setAnchor(); m_visualMode = visualMode; m_marks['<'] = m_tc.position(); m_marks['>'] = m_tc.position(); @@ -1927,6 +2039,7 @@ void FakeVimHandler::Private::recordRemove(int position, const QString &data) void FakeVimHandler::Private::enterInsertMode() { + EDITOR(setCursorWidth(m_cursorWidth)); EDITOR(setOverwriteMode(false)); m_mode = InsertMode; m_lastInsertion.clear(); @@ -1935,23 +2048,25 @@ void FakeVimHandler::Private::enterInsertMode() void FakeVimHandler::Private::enterCommandMode() { - if (editor()) - EDITOR(setOverwriteMode(true)); + EDITOR(setCursorWidth(m_cursorWidth)); + EDITOR(setOverwriteMode(true)); m_mode = CommandMode; } +void FakeVimHandler::Private::enterExMode() +{ + EDITOR(setCursorWidth(0)); + EDITOR(setOverwriteMode(false)); + m_mode = ExMode; +} + void FakeVimHandler::Private::quit() { - showBlackMessage(QString()); + EDITOR(setCursorWidth(m_cursorWidth)); EDITOR(setOverwriteMode(false)); - q->quitRequested(editor()); + q->quitRequested(); } -void FakeVimHandler::Private::setWidget(QWidget *ob) -{ - m_textedit = qobject_cast(ob); - m_plaintextedit = qobject_cast(ob); -} /////////////////////////////////////////////////////////////////////// // @@ -1959,8 +2074,8 @@ void FakeVimHandler::Private::setWidget(QWidget *ob) // /////////////////////////////////////////////////////////////////////// -FakeVimHandler::FakeVimHandler(QObject *parent) - : QObject(parent), d(new Private(this)) +FakeVimHandler::FakeVimHandler(QWidget *widget, QObject *parent) + : QObject(parent), d(new Private(this, widget)) {} FakeVimHandler::~FakeVimHandler() @@ -1993,40 +2108,18 @@ bool FakeVimHandler::eventFilter(QObject *ob, QEvent *ev) return QObject::eventFilter(ob, ev); } -void FakeVimHandler::addWidget(QWidget *widget) +void FakeVimHandler::setupWidget() { - widget->installEventFilter(this); - d->setWidget(widget); - d->enterCommandMode(); - if (QTextEdit *ed = qobject_cast(widget)) { - //ed->setCursorWidth(QFontMetrics(ed->font()).width(QChar('x'))); - ed->setLineWrapMode(QTextEdit::NoWrap); - d->m_wasReadOnly = ed->isReadOnly(); - } else if (QPlainTextEdit *ed = qobject_cast(widget)) { - //ed->setCursorWidth(QFontMetrics(ed->font()).width(QChar('x'))); - ed->setLineWrapMode(QPlainTextEdit::NoWrap); - d->m_wasReadOnly = ed->isReadOnly(); - } - d->showBlackMessage("vi emulation mode."); - d->updateMiniBuffer(); + d->setupWidget(); } -void FakeVimHandler::removeWidget(QWidget *widget) +void FakeVimHandler::restoreWidget() { - d->setWidget(widget); - d->showBlackMessage(QString()); - d->updateMiniBuffer(); - widget->removeEventFilter(this); - if (QTextEdit *ed = qobject_cast(widget)) { - ed->setReadOnly(d->m_wasReadOnly); - } else if (QPlainTextEdit *ed = qobject_cast(widget)) { - ed->setReadOnly(d->m_wasReadOnly); - } + d->restoreWidget(); } -void FakeVimHandler::handleCommand(QWidget *widget, const QString &cmd) +void FakeVimHandler::handleCommand(const QString &cmd) { - d->setWidget(widget); d->handleExCommand(cmd); } @@ -2044,3 +2137,19 @@ void FakeVimHandler::setCurrentFileName(const QString &fileName) { d->m_currentFileName = fileName; } + +QWidget *FakeVimHandler::widget() +{ + return d->editor(); +} + +void FakeVimHandler::setExtraData(QObject *data) +{ + d->m_extraData = data; +} + +QObject *FakeVimHandler::extraData() const +{ + return d->m_extraData; +} + diff --git a/src/plugins/fakevim/fakevimhandler.h b/src/plugins/fakevim/fakevimhandler.h index bbd58781e7f..a083f346dd4 100644 --- a/src/plugins/fakevim/fakevimhandler.h +++ b/src/plugins/fakevim/fakevimhandler.h @@ -50,30 +50,35 @@ class FakeVimHandler : public QObject Q_OBJECT public: - FakeVimHandler(QObject *parent = 0); + FakeVimHandler(QWidget *widget, QObject *parent = 0); ~FakeVimHandler(); + QWidget *widget(); + + void setExtraData(QObject *data); + QObject *extraData() const; + public slots: - // The same handler can be installed on several widgets - // FIXME: good idea? - void addWidget(QWidget *widget); - void removeWidget(QWidget *widget); void setCurrentFileName(const QString &fileName); // This executes an "ex" style command taking context - // information from \p widget; - void handleCommand(QWidget *widget, const QString &cmd); - void quit(); + // information from widget; + void handleCommand(const QString &cmd); void setConfigValue(const QString &key, const QString &value); + void quit(); + + // Convenience + void setupWidget(); + void restoreWidget(); signals: void commandBufferChanged(const QString &msg); void statusDataChanged(const QString &msg); - void extraInformationChanged(QWidget *widget, const QString &msg); - void quitRequested(QWidget *widget); - void selectionChanged(QWidget *widget, - const QList &selection); - void writeFile(const QString &fileName, const QString &contents); + void extraInformationChanged(const QString &msg); + void quitRequested(); + void selectionChanged(const QList &selection); + void writeFileRequested(bool *handled, + const QString &fileName, const QString &contents); private: bool eventFilter(QObject *ob, QEvent *ev); diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index a00e3878e8e..d1ab5b40630 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -106,27 +107,26 @@ public: ~FakeVimPluginPrivate(); friend class FakeVimPlugin; - bool initialize(const QStringList &arguments, QString *error_message); + bool initialize(); void shutdown(); private slots: - void installHandler(); - void installHandler(QWidget *widget); - void removeHandler(QWidget *widget); - void showCommandBuffer(const QString &contents); - void showExtraInformation(QWidget *, const QString &msg); void editorOpened(Core::IEditor *); void editorAboutToClose(Core::IEditor *); - void changeSelection(QWidget *widget, - const QList &selections); - void writeFile(const QString &fileName, const QString &contents); + + void installHandlerOnCurrentEditor(); + void installHandler(Core::IEditor *editor); + void removeHandler(); + + void showCommandBuffer(const QString &contents); + void showExtraInformation(const QString &msg); + void changeSelection(const QList &selections); + void writeFile(bool *handled, const QString &fileName, const QString &contents); private: FakeVimPlugin *q; - FakeVimHandler *m_handler; QAction *m_installHandlerAction; Core::ICore *m_core; - Core::IFile *m_currentFile; }; } // namespace Internal @@ -135,10 +135,8 @@ private: FakeVimPluginPrivate::FakeVimPluginPrivate(FakeVimPlugin *plugin) { q = plugin; - m_handler = 0; m_installHandlerAction = 0; m_core = 0; - m_currentFile = 0; } FakeVimPluginPrivate::~FakeVimPluginPrivate() @@ -147,17 +145,10 @@ FakeVimPluginPrivate::~FakeVimPluginPrivate() void FakeVimPluginPrivate::shutdown() { - delete m_handler; - m_handler = 0; } -bool FakeVimPluginPrivate::initialize(const QStringList &arguments, QString *error_message) +bool FakeVimPluginPrivate::initialize() { - Q_UNUSED(arguments); - Q_UNUSED(error_message); - - m_handler = new FakeVimHandler; - m_core = Core::ICore::instance(); QTC_ASSERT(m_core, return false); @@ -180,7 +171,7 @@ bool FakeVimPluginPrivate::initialize(const QStringList &arguments, QString *err advancedMenu->addAction(cmd, Core::Constants::G_EDIT_EDITOR); connect(m_installHandlerAction, SIGNAL(triggered()), - this, SLOT(installHandler())); + this, SLOT(installHandlerOnCurrentEditor())); // EditorManager QObject *editorManager = m_core->editorManager(); @@ -192,105 +183,134 @@ bool FakeVimPluginPrivate::initialize(const QStringList &arguments, QString *err return true; } -void FakeVimPluginPrivate::installHandler() +void FakeVimPluginPrivate::installHandler(Core::IEditor *editor) { - if (Core::IEditor *editor = m_core->editorManager()->currentEditor()) - installHandler(editor->widget()); -} + QWidget *widget = editor->widget(); + + FakeVimHandler *handler = new FakeVimHandler(widget, this); -void FakeVimPluginPrivate::installHandler(QWidget *widget) -{ - connect(m_handler, SIGNAL(extraInformationChanged(QWidget *, QString)), - this, SLOT(showExtraInformation(QWidget *, QString))); - connect(m_handler, SIGNAL(commandBufferChanged(QString)), + connect(handler, SIGNAL(extraInformationChanged(QString)), + this, SLOT(showExtraInformation(QString))); + connect(handler, SIGNAL(commandBufferChanged(QString)), this, SLOT(showCommandBuffer(QString))); - connect(m_handler, SIGNAL(quitRequested(QWidget *)), - this, SLOT(removeHandler(QWidget *))); - connect(m_handler, - SIGNAL(selectionChanged(QWidget*,QList)), - this, SLOT(changeSelection(QWidget*,QList))); + connect(handler, SIGNAL(quitRequested()), + this, SLOT(removeHandler()), Qt::QueuedConnection); + connect(handler, SIGNAL(writeFileRequested(bool*,QString,QString)), + this, SLOT(writeFile(bool*,QString,QString))); + connect(handler, SIGNAL(selectionChanged(QList)), + this, SLOT(changeSelection(QList))); - m_handler->addWidget(widget); - TextEditor::BaseTextEditor* editor = - qobject_cast(widget); - if (editor) { - m_currentFile = editor->file(); - m_handler->setCurrentFileName(editor->file()->fileName()); - } + handler->setupWidget(); + handler->setExtraData(editor); - BaseTextEditor *bt = qobject_cast(widget); - if (bt) { + if (BaseTextEditor *bt = qobject_cast(widget)) { using namespace TextEditor; using namespace FakeVim::Constants; + handler->setCurrentFileName(editor->file()->fileName()); TabSettings settings = bt->tabSettings(); - m_handler->setConfigValue(ConfigTabStop, + handler->setConfigValue(ConfigTabStop, QString::number(settings.m_tabSize)); - m_handler->setConfigValue(ConfigShiftWidth, + handler->setConfigValue(ConfigShiftWidth, QString::number(settings.m_indentSize)); - m_handler->setConfigValue(ConfigExpandTab, + handler->setConfigValue(ConfigExpandTab, settings.m_spacesForTabs ? ConfigOn : ConfigOff); - m_handler->setConfigValue(ConfigSmartTab, + handler->setConfigValue(ConfigSmartTab, settings.m_smartBackspace ? ConfigOn : ConfigOff); - m_handler->setConfigValue(ConfigAutoIndent, + handler->setConfigValue(ConfigAutoIndent, settings.m_autoIndent ? ConfigOn : ConfigOff); } } -void FakeVimPluginPrivate::writeFile(const QString &fileName, - const QString &contents) +void FakeVimPluginPrivate::installHandlerOnCurrentEditor() { - if (m_currentFile && fileName == m_currentFile->fileName()) { - // Handle that as a special case for nicer interaction with core - m_core->fileManager()->blockFileChange(m_currentFile); - m_currentFile->save(fileName); - m_core->fileManager()->unblockFileChange(m_currentFile); - } else { - QFile file(fileName); - file.open(QIODevice::ReadWrite); - { QTextStream ts(&file); ts << contents; } - file.close(); - } + installHandler(EditorManager::instance()->currentEditor()); } -void FakeVimPluginPrivate::removeHandler(QWidget *widget) +void FakeVimPluginPrivate::writeFile(bool *handled, + const QString &fileName, const QString &contents) { - Q_UNUSED(widget); - m_handler->removeWidget(widget); + Q_UNUSED(contents); + + FakeVimHandler *handler = qobject_cast(sender()); + if (!handler) + return; + + Core::IEditor *editor = qobject_cast(handler->extraData()); + if (editor && editor->file()->fileName() == fileName) { + // Handle that as a special case for nicer interaction with core + Core::IFile *file = editor->file(); + m_core->fileManager()->blockFileChange(file); + file->save(fileName); + m_core->fileManager()->unblockFileChange(file); + *handled = true; + } +} + +void FakeVimPluginPrivate::removeHandler() +{ + if (FakeVimHandler *handler = qobject_cast(sender())) { + handler->restoreWidget(); + handler->deleteLater(); + } Core::EditorManager::instance()->hideEditorInfoBar( QLatin1String(Constants::MINI_BUFFER)); - m_currentFile = 0; } void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor) { Q_UNUSED(editor); //qDebug() << "OPENING: " << editor << editor->widget(); - //installHandler(editor->widget()); + //installHandler(editor); + +#if 1 + QSettings *s = ICore::instance()->settings(); + bool automatic = s->value("textInteractionSettings/UseVim").toBool(); + //qDebug() << "USE VIM: " << automatic; + if (automatic) + installHandler(editor); +#endif + +#if 0 + QWidget *widget = editor->widget(); + if (BaseTextEditor *bt = qobject_cast(widget)) { + InteractionSettings settings = bt->interactionSettings(); + qDebug() << "USE VIM: " << settings.m_useVim; + if (settings.m_useVim) + installHandler(editor); + } +#endif } void FakeVimPluginPrivate::editorAboutToClose(Core::IEditor *editor) { - //qDebug() << "CLOSING: " << editor << editor->widget(); - removeHandler(editor->widget()); + Q_UNUSED(editor); + //qDebug() << "CLOSING: " << editor; } void FakeVimPluginPrivate::showCommandBuffer(const QString &contents) { - Core::EditorManager::instance()->showEditorInfoBar( - QLatin1String(Constants::MINI_BUFFER), contents, - tr("Quit FakeVim"), m_handler, SLOT(quit())); + //qDebug() << "SHOW COMMAND BUFFER" << contents; + FakeVimHandler *handler = qobject_cast(sender()); + if (handler) { + Core::EditorManager::instance()->showEditorInfoBar( + QLatin1String(Constants::MINI_BUFFER), contents, + tr("Quit FakeVim"), handler, SLOT(quit())); + } } -void FakeVimPluginPrivate::showExtraInformation(QWidget *widget, const QString &text) +void FakeVimPluginPrivate::showExtraInformation(const QString &text) { - QMessageBox::information(widget, tr("FakeVim Information"), text); + FakeVimHandler *handler = qobject_cast(sender()); + if (handler) + QMessageBox::information(handler->widget(), tr("FakeVim Information"), text); } -void FakeVimPluginPrivate::changeSelection(QWidget *widget, - const QList &selection) +void FakeVimPluginPrivate::changeSelection + (const QList &selection) { - if (BaseTextEditor *bt = qobject_cast(widget)) - bt->setExtraSelections(BaseTextEditor::FakeVimSelection, selection); + if (FakeVimHandler *handler = qobject_cast(sender())) + if (BaseTextEditor *bt = qobject_cast(handler->widget())) + bt->setExtraSelections(BaseTextEditor::FakeVimSelection, selection); } @@ -309,9 +329,11 @@ FakeVimPlugin::~FakeVimPlugin() delete d; } -bool FakeVimPlugin::initialize(const QStringList &arguments, QString *error_message) +bool FakeVimPlugin::initialize(const QStringList &arguments, QString *errorMessage) { - return d->initialize(arguments, error_message); + Q_UNUSED(arguments); + Q_UNUSED(errorMessage); + return d->initialize(); } void FakeVimPlugin::shutdown() diff --git a/src/plugins/help/help.pro b/src/plugins/help/help.pro index b2e9a1dbd61..6fd810634b5 100644 --- a/src/plugins/help/help.pro +++ b/src/plugins/help/help.pro @@ -30,7 +30,7 @@ SOURCES += helpplugin.cpp \ FORMS += docsettingspage.ui \ filtersettingspage.ui RESOURCES += help.qrc -include(../../../shared/help/help.pri) +include(../../shared/help/help.pri) contains(QT_CONFIG, webkit) { QT += webkit diff --git a/src/plugins/projectexplorer/environment.cpp b/src/plugins/projectexplorer/environment.cpp index 7a767d75b2e..cfc9c2213d2 100644 --- a/src/plugins/projectexplorer/environment.cpp +++ b/src/plugins/projectexplorer/environment.cpp @@ -183,15 +183,14 @@ void Environment::clear() m_values.clear(); } -// currently it returns the string that was passed in, except -// under windows and if the executable does not end in .exe -// then it returns executable appended with .exe -// that is clearly wrong QString Environment::searchInPath(QString executable) { // qDebug()<<"looking for "< 0 0 - 521 + 551 300 @@ -35,7 +35,7 @@ - QComboBox::AdjustToMinimumContentsLength + QComboBox::AdjustToContents 30 diff --git a/src/plugins/qt4projectmanager/gdbmacrosbuildstep.cpp b/src/plugins/qt4projectmanager/gdbmacrosbuildstep.cpp index ea622415a20..507c059239e 100644 --- a/src/plugins/qt4projectmanager/gdbmacrosbuildstep.cpp +++ b/src/plugins/qt4projectmanager/gdbmacrosbuildstep.cpp @@ -65,13 +65,13 @@ void GdbMacrosBuildStep::run(QFutureInterface & fi) { QVariant v = value("clean"); if (v.isNull() || v.toBool() == false) { + addToOutputWindow("Creating gdb macros library..."); // Normal run QString dumperPath = Core::ICore::instance()->resourcePath() + "/gdbmacros/"; QStringList files; files << "gdbmacros.cpp" << "gdbmacros.pro"; - QString destDir = m_buildDirectory + "/qtc-gdbmacros/"; QDir dir; dir.mkpath(destDir); @@ -124,7 +124,6 @@ void GdbMacrosBuildStep::run(QFutureInterface & fi) qmake.start(m_qmake, QStringList()<<"-spec"<qtVersion(m_buildConfiguration)->makeCommand(), makeArguments); qmake.waitForFinished(); diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.pro b/src/plugins/qt4projectmanager/qt4projectmanager.pro index c7dc608437f..4cb8ff322b5 100644 --- a/src/plugins/qt4projectmanager/qt4projectmanager.pro +++ b/src/plugins/qt4projectmanager/qt4projectmanager.pro @@ -93,5 +93,5 @@ FORMS = qtversionmanager.ui \ qt4buildenvironmentwidget.ui RESOURCES = qt4projectmanager.qrc \ wizards/wizards.qrc -include(../../../shared/proparser/proparser.pri) +include(../../shared/proparser/proparser.pri) DEFINES += QT_NO_CAST_TO_ASCII diff --git a/src/plugins/qtscripteditor/qtscripteditor.pro b/src/plugins/qtscripteditor/qtscripteditor.pro index 1e93663ec4e..18fd16a0e40 100644 --- a/src/plugins/qtscripteditor/qtscripteditor.pro +++ b/src/plugins/qtscripteditor/qtscripteditor.pro @@ -3,10 +3,10 @@ TARGET = QtScriptEditor QT += script include(../../qworkbenchplugin.pri) -include(../../plugins/texteditor/texteditor.pri) -include(../../../shared/qscripthighlighter/qscripthighlighter.pri) -include(../../../shared/indenter/indenter.pri) include(../../plugins/coreplugin/coreplugin.pri) +include(../../plugins/texteditor/texteditor.pri) +include(../../shared/qscripthighlighter/qscripthighlighter.pri) +include(../../shared/indenter/indenter.pri) HEADERS += qtscripteditor.h \ qtscripteditorfactory.h \ diff --git a/src/plugins/quickopen/quickopenplugin.cpp b/src/plugins/quickopen/quickopenplugin.cpp index aab8bf739be..a7b6de8fbab 100644 --- a/src/plugins/quickopen/quickopenplugin.cpp +++ b/src/plugins/quickopen/quickopenplugin.cpp @@ -57,6 +57,7 @@ using namespace QuickOpen; using namespace QuickOpen::Internal; + namespace { static bool filterLessThan(const IQuickOpenFilter *first, const IQuickOpenFilter *second) { @@ -89,10 +90,12 @@ bool QuickOpenPlugin::initialize(const QStringList &, QString *) m_quickOpenToolWindow = new QuickOpenToolWindow(this); m_quickOpenToolWindow->setEnabled(false); - Core::BaseView *view = new Core::BaseView("QuickOpen.ToolWindow", - m_quickOpenToolWindow, - QList() << core->uniqueIDManager()->uniqueIdentifier(QLatin1String("QuickOpenToolWindow")), - Core::IView::First); + Core::BaseView *view = new Core::BaseView; + view->setUniqueViewName("QuickOpen.ToolWindow"); + view->setWidget(m_quickOpenToolWindow); + view->setContext(QList() << core->uniqueIDManager() + ->uniqueIdentifier(QLatin1String("QuickOpenToolWindow"))); + view->setDefaultPosition(Core::IView::First); addAutoReleasedObject(view); const QString actionId = QLatin1String("QtCreator.View.QuickOpen.ToolWindow"); diff --git a/src/plugins/resourceeditor/resourceeditor.pro b/src/plugins/resourceeditor/resourceeditor.pro index e91099d9630..5df0d635e57 100644 --- a/src/plugins/resourceeditor/resourceeditor.pro +++ b/src/plugins/resourceeditor/resourceeditor.pro @@ -6,7 +6,7 @@ qtAddLibrary(QtDesigner) include(../../qworkbenchplugin.pri) include(../../libs/utils/utils.pri) include(../../plugins/coreplugin/coreplugin.pri) -include(../../../shared/qrceditor/qrceditor.pri) +include(../../shared/qrceditor/qrceditor.pri) INCLUDEPATH += $$PWD/../../tools/utils diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp index eb6069df6d9..d782ed5ace2 100644 --- a/src/plugins/texteditor/basetextdocument.cpp +++ b/src/plugins/texteditor/basetextdocument.cpp @@ -330,7 +330,7 @@ void BaseTextDocument::cleanWhitespace(QTextCursor& cursor, bool inEntireDocumen cursor.movePosition(QTextCursor::PreviousCharacter, QTextCursor::KeepAnchor, trailing); cursor.removeSelectedText(); } - if (!m_tabSettings.isIndentationClean(blockText)) { + if (m_storageSettings.m_cleanIndentation && !m_tabSettings.isIndentationClean(blockText)) { cursor.setPosition(block.position()); int firstNonSpace = m_tabSettings.firstNonSpace(blockText); if (firstNonSpace == blockText.length()) { diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 0e058ff752e..718c1f736ab 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -2709,6 +2709,10 @@ const DisplaySettings &BaseTextEditor::displaySettings() const return d->m_displaySettings; } +const InteractionSettings &BaseTextEditor::interactionSettings() const +{ + return d->m_interactionSettings; +} void BaseTextEditor::indentOrUnindent(bool doIndent) diff --git a/src/plugins/texteditor/basetexteditor.h b/src/plugins/texteditor/basetexteditor.h index e5e79d4a4a2..83ce1538c7e 100644 --- a/src/plugins/texteditor/basetexteditor.h +++ b/src/plugins/texteditor/basetexteditor.h @@ -37,6 +37,7 @@ #include "displaysettings.h" #include "tabsettings.h" +#include "interactionsettings.h" #include "itexteditable.h" #include @@ -88,7 +89,8 @@ struct TEXTEDITOR_EXPORT Parenthesis -class TEXTEDITOR_EXPORT TextBlockUserData : public QTextBlockUserData { +class TEXTEDITOR_EXPORT TextBlockUserData : public QTextBlockUserData +{ public: enum CollapseMode { NoCollapse , CollapseThis, CollapseAfter }; @@ -382,9 +384,9 @@ public: virtual void extraAreaMouseEvent(QMouseEvent *); virtual void extraAreaLeaveEvent(QEvent *); - const TabSettings &tabSettings() const; const DisplaySettings &displaySettings() const; + const InteractionSettings &interactionSettings() const; void markBlocksAsChanged(QList blockNumbers); @@ -402,17 +404,19 @@ public: void setExtraSelections(ExtraSelectionKind kind, const QList &selections); QList extraSelections(ExtraSelectionKind kind) const; - struct BlockRange { - BlockRange():first(0), last(-1){} - BlockRange(int first_position, int last_position):first(first_position), last(last_position){} + struct BlockRange + { + BlockRange() : first(0), last(-1) {} + BlockRange(int first_position, int last_position) + : first(first_position), last(last_position) + {} int first; int last; inline bool isNull() const { return last < first; } }; // the blocks list must be sorted - void setIfdefedOutBlocks(const QList &blocks); - + void setIfdefedOutBlocks(const QList &blocks); public slots: virtual void setTabSettings(const TextEditor::TabSettings &); @@ -442,8 +446,6 @@ protected slots: virtual void slotCursorPositionChanged(); virtual void slotUpdateBlockNotify(const QTextBlock &); - - signals: void requestBlockUpdate(const QTextBlock &); void requestAutoCompletion(ITextEditable *editor, bool forced); diff --git a/src/plugins/texteditor/basetexteditor_p.h b/src/plugins/texteditor/basetexteditor_p.h index 3310b0665d2..270b7444f42 100644 --- a/src/plugins/texteditor/basetexteditor_p.h +++ b/src/plugins/texteditor/basetexteditor_p.h @@ -165,6 +165,7 @@ public: QWidget *m_extraArea; DisplaySettings m_displaySettings; + InteractionSettings m_interactionSettings; int extraAreaSelectionAnchorBlockNumber; int extraAreaToggleMarkBlockNumber; diff --git a/src/plugins/texteditor/generalsettingspage.cpp b/src/plugins/texteditor/generalsettingspage.cpp index 7be7bca1f4b..28400d10ebf 100644 --- a/src/plugins/texteditor/generalsettingspage.cpp +++ b/src/plugins/texteditor/generalsettingspage.cpp @@ -33,6 +33,7 @@ #include "displaysettings.h" #include "generalsettingspage.h" +#include "interactionsettings.h" #include "storagesettings.h" #include "tabsettings.h" #include "ui_generalsettingspage.h" @@ -53,6 +54,7 @@ struct GeneralSettingsPage::GeneralSettingsPagePrivate TabSettings m_tabSettings; StorageSettings m_storageSettings; DisplaySettings m_displaySettings; + InteractionSettings m_interactionSettings; }; GeneralSettingsPage::GeneralSettingsPagePrivate::GeneralSettingsPagePrivate @@ -63,6 +65,7 @@ GeneralSettingsPage::GeneralSettingsPagePrivate::GeneralSettingsPagePrivate m_tabSettings.fromSettings(m_parameters.settingsPrefix, s); m_storageSettings.fromSettings(m_parameters.settingsPrefix, s); m_displaySettings.fromSettings(m_parameters.settingsPrefix, s); + m_interactionSettings.fromSettings(m_parameters.settingsPrefix, s); } } @@ -106,13 +109,17 @@ void GeneralSettingsPage::apply() TabSettings newTabSettings; StorageSettings newStorageSettings; DisplaySettings newDisplaySettings; + InteractionSettings newInteractionSettings; + + settingsFromUI(newTabSettings, newStorageSettings, newDisplaySettings, + newInteractionSettings); - settingsFromUI(newTabSettings, newStorageSettings, newDisplaySettings); Core::ICore *core = Core::ICore::instance(); + QSettings *s = core->settings(); if (newTabSettings != m_d->m_tabSettings) { m_d->m_tabSettings = newTabSettings; - if (QSettings *s = core->settings()) + if (s) m_d->m_tabSettings.toSettings(m_d->m_parameters.settingsPrefix, s); emit tabSettingsChanged(newTabSettings); @@ -120,7 +127,7 @@ void GeneralSettingsPage::apply() if (newStorageSettings != m_d->m_storageSettings) { m_d->m_storageSettings = newStorageSettings; - if (QSettings *s = core->settings()) + if (s) m_d->m_storageSettings.toSettings(m_d->m_parameters.settingsPrefix, s); emit storageSettingsChanged(newStorageSettings); @@ -128,16 +135,24 @@ void GeneralSettingsPage::apply() if (newDisplaySettings != m_d->m_displaySettings) { m_d->m_displaySettings = newDisplaySettings; - if (QSettings *s = core->settings()) + if (s) m_d->m_displaySettings.toSettings(m_d->m_parameters.settingsPrefix, s); emit displaySettingsChanged(newDisplaySettings); } + + if (newInteractionSettings != m_d->m_interactionSettings) { + m_d->m_interactionSettings = newInteractionSettings; + if (s) + m_d->m_interactionSettings.toSettings(m_d->m_parameters.settingsPrefix, s); + + } } void GeneralSettingsPage::settingsFromUI(TabSettings &rc, StorageSettings &storageSettings, - DisplaySettings &displaySettings) const + DisplaySettings &displaySettings, + InteractionSettings &interactionSettings) const { rc.m_spacesForTabs = m_d->m_page.insertSpaces->isChecked(); rc.m_autoIndent = m_d->m_page.autoIndent->isChecked(); @@ -147,6 +162,7 @@ void GeneralSettingsPage::settingsFromUI(TabSettings &rc, storageSettings.m_cleanWhitespace = m_d->m_page.cleanWhitespace->isChecked(); storageSettings.m_inEntireDocument = m_d->m_page.inEntireDocument->isChecked(); + storageSettings.m_cleanIndentation = m_d->m_page.cleanIndentation->isChecked(); storageSettings.m_addFinalNewLine = m_d->m_page.addFinalNewLine->isChecked(); displaySettings.m_displayLineNumbers = m_d->m_page.displayLineNumbers->isChecked(); @@ -156,6 +172,8 @@ void GeneralSettingsPage::settingsFromUI(TabSettings &rc, displaySettings.m_visualizeWhitespace = m_d->m_page.visualizeWhitespace->isChecked(); displaySettings.m_displayFoldingMarkers = m_d->m_page.displayFoldingMarkers->isChecked(); displaySettings.m_highlightCurrentLine = m_d->m_page.highlightCurrentLine->isChecked(); + + interactionSettings.m_useVim = m_d->m_page.useVim->isChecked(); } void GeneralSettingsPage::settingsToUI() @@ -170,6 +188,7 @@ void GeneralSettingsPage::settingsToUI() StorageSettings storageSettings = m_d->m_storageSettings; m_d->m_page.cleanWhitespace->setChecked(storageSettings.m_cleanWhitespace); m_d->m_page.inEntireDocument->setChecked(storageSettings.m_inEntireDocument); + m_d->m_page.cleanIndentation->setChecked(storageSettings.m_cleanIndentation); m_d->m_page.addFinalNewLine->setChecked(storageSettings.m_addFinalNewLine); DisplaySettings displaySettings = m_d->m_displaySettings; @@ -180,6 +199,9 @@ void GeneralSettingsPage::settingsToUI() m_d->m_page.visualizeWhitespace->setChecked(displaySettings.m_visualizeWhitespace); m_d->m_page.displayFoldingMarkers->setChecked(displaySettings.m_displayFoldingMarkers); m_d->m_page.highlightCurrentLine->setChecked(displaySettings.m_highlightCurrentLine); + + InteractionSettings interactionSettings = m_d->m_interactionSettings; + m_d->m_page.useVim->setChecked(interactionSettings.m_useVim); } TabSettings GeneralSettingsPage::tabSettings() const @@ -197,6 +219,11 @@ DisplaySettings GeneralSettingsPage::displaySettings() const return m_d->m_displaySettings; } +InteractionSettings GeneralSettingsPage::interactionSettings() const +{ + return m_d->m_interactionSettings; +} + void GeneralSettingsPage::setDisplaySettings(const DisplaySettings &newDisplaySettings) { if (newDisplaySettings != m_d->m_displaySettings) { diff --git a/src/plugins/texteditor/generalsettingspage.h b/src/plugins/texteditor/generalsettingspage.h index 5eb9c0811c2..1f70fd6b0b0 100644 --- a/src/plugins/texteditor/generalsettingspage.h +++ b/src/plugins/texteditor/generalsettingspage.h @@ -45,6 +45,7 @@ namespace TextEditor { struct TabSettings; struct StorageSettings; struct DisplaySettings; +struct InteractionSettings; struct TEXTEDITOR_EXPORT GeneralSettingsPageParameters { @@ -74,6 +75,7 @@ public: TabSettings tabSettings() const; StorageSettings storageSettings() const; DisplaySettings displaySettings() const; + InteractionSettings interactionSettings() const; void setDisplaySettings(const DisplaySettings &); @@ -85,7 +87,9 @@ signals: private: void settingsFromUI(TabSettings &rc, StorageSettings &storageSettings, - DisplaySettings &displaySettings) const; + DisplaySettings &displaySettings, + InteractionSettings &interactionSettings + ) const; void settingsToUI(); struct GeneralSettingsPagePrivate; GeneralSettingsPagePrivate *m_d; diff --git a/src/plugins/texteditor/generalsettingspage.ui b/src/plugins/texteditor/generalsettingspage.ui index 140f94628d6..301ee8bdf55 100644 --- a/src/plugins/texteditor/generalsettingspage.ui +++ b/src/plugins/texteditor/generalsettingspage.ui @@ -7,15 +7,15 @@ 0 0 514 - 427 + 475 Form - - - + + + Tab/Indent Settings @@ -171,8 +171,8 @@ - - + + Storage Settings @@ -214,6 +214,36 @@ + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 30 + 20 + + + + + + + + false + + + Clean indentation + + + + + @@ -224,8 +254,8 @@ - - + + Display Settings @@ -289,15 +319,31 @@ - - + + + + Interaction Settings + + + + + + Use "vi" style editing + + + + + + + + Qt::Vertical - 351 - 0 + 20 + 8 @@ -322,6 +368,12 @@ + + cleanWhitespace + toggled(bool) + cleanIndentation + setEnabled(bool) + showWrapColumn toggled(bool) diff --git a/src/plugins/texteditor/interactionsettings.cpp b/src/plugins/texteditor/interactionsettings.cpp new file mode 100644 index 00000000000..368bc3ff615 --- /dev/null +++ b/src/plugins/texteditor/interactionsettings.cpp @@ -0,0 +1,73 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#include "interactionsettings.h" + +#include +#include + +namespace TextEditor { + +static const char *useVimKey = "UseVim"; +static const char *groupPostfix = "InteractionSettings"; + +InteractionSettings::InteractionSettings() + : m_useVim(false) +{ +} + +void InteractionSettings::toSettings(const QString &category, QSettings *s) const +{ + QString group = QLatin1String(groupPostfix); + if (!category.isEmpty()) + group.insert(0, category); + s->beginGroup(group); + s->setValue(QLatin1String(useVimKey), m_useVim); + s->endGroup(); +} + +void InteractionSettings::fromSettings(const QString &category, const QSettings *s) +{ + QString group = QLatin1String(groupPostfix); + if (!category.isEmpty()) + group.insert(0, category); + group += QLatin1Char('/'); + m_useVim = s->value(group + QLatin1String(useVimKey), m_useVim).toBool(); +} + +bool InteractionSettings::equals(const InteractionSettings &ts) const +{ + return m_useVim == ts.m_useVim; +} + +} // namespace TextEditor diff --git a/src/plugins/texteditor/interactionsettings.h b/src/plugins/texteditor/interactionsettings.h new file mode 100644 index 00000000000..fc1ad0fe836 --- /dev/null +++ b/src/plugins/texteditor/interactionsettings.h @@ -0,0 +1,62 @@ +/*************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Qt Software Information (qt-info@nokia.com) +** +** +** Non-Open Source Usage +** +** Licensees may use this file in accordance with the Qt Beta Version +** License Agreement, Agreement version 2.2 provided with the Software or, +** alternatively, in accordance with the terms contained in a written +** agreement between you and Nokia. +** +** GNU General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the packaging +** of this file. Please review the following information to ensure GNU +** General Public Licensing requirements will be met: +** +** http://www.fsf.org/licensing/licenses/info/GPLv2.html and +** http://www.gnu.org/copyleft/gpl.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt GPL Exception +** version 1.3, included in the file GPL_EXCEPTION.txt in this package. +** +***************************************************************************/ + +#ifndef INTERACTIONSETTINGS_H +#define INTERACTIONSETTINGS_H + +#include "texteditor_global.h" + +QT_BEGIN_NAMESPACE +class QSettings; +QT_END_NAMESPACE + +namespace TextEditor { + +struct TEXTEDITOR_EXPORT InteractionSettings +{ + InteractionSettings(); + + void toSettings(const QString &category, QSettings *s) const; + void fromSettings(const QString &category, const QSettings *s); + + bool equals(const InteractionSettings &ts) const; + + bool m_useVim; +}; + +inline bool operator==(const InteractionSettings &t1, const InteractionSettings &t2) { return t1.equals(t2); } +inline bool operator!=(const InteractionSettings &t1, const InteractionSettings &t2) { return !t1.equals(t2); } + +} // namespace TextEditor + +#endif // INTERACTIONSETTINGS_H diff --git a/src/plugins/texteditor/linenumberfilter.cpp b/src/plugins/texteditor/linenumberfilter.cpp index cb02b0f8088..d8d2ea6cbda 100644 --- a/src/plugins/texteditor/linenumberfilter.cpp +++ b/src/plugins/texteditor/linenumberfilter.cpp @@ -43,10 +43,9 @@ using namespace QuickOpen; using namespace TextEditor; using namespace TextEditor::Internal; -LineNumberFilter::LineNumberFilter(EditorManager *editorManager, QObject *parent): - IQuickOpenFilter(parent) +LineNumberFilter::LineNumberFilter(QObject *parent) + : IQuickOpenFilter(parent) { - m_editorManager = editorManager; setShortcutString("l"); setIncludedByDefault(true); } @@ -65,17 +64,19 @@ void LineNumberFilter::accept(FilterEntry selection) const { ITextEditor *editor = currentTextEditor(); if (editor) { - m_editorManager->ensureEditorManagerVisible(); - m_editorManager->addCurrentPositionToNavigationHistory(true); + Core::EditorManager *editorManager = Core::EditorManager::instance(); + editorManager->ensureEditorManagerVisible(); + editorManager->addCurrentPositionToNavigationHistory(true); editor->gotoLine(selection.internalData.toInt()); - m_editorManager->addCurrentPositionToNavigationHistory(); + editorManager->addCurrentPositionToNavigationHistory(); editor->widget()->setFocus(); } } ITextEditor *LineNumberFilter::currentTextEditor() const { - if (!m_editorManager->currentEditor()) + Core::EditorManager *editorManager = Core::EditorManager::instance(); + if (!editorManager->currentEditor()) return 0; - return qobject_cast(m_editorManager->currentEditor()); + return qobject_cast(editorManager->currentEditor()); } diff --git a/src/plugins/texteditor/linenumberfilter.h b/src/plugins/texteditor/linenumberfilter.h index bc29b1db374..7ee8a6f6d5d 100644 --- a/src/plugins/texteditor/linenumberfilter.h +++ b/src/plugins/texteditor/linenumberfilter.h @@ -38,13 +38,7 @@ #include #include -#include #include -#include - -namespace Core { -class EditorManager; -} namespace TextEditor { @@ -57,7 +51,8 @@ class LineNumberFilter : public QuickOpen::IQuickOpenFilter Q_OBJECT public: - LineNumberFilter(Core::EditorManager *editorManager, QObject *parent = 0); + explicit LineNumberFilter(QObject *parent = 0); + QString trName() const { return tr("Line in current document"); } QString name() const { return "Line in current document"; } QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::High; } @@ -67,8 +62,6 @@ public: private: ITextEditor *currentTextEditor() const; - - Core::EditorManager *m_editorManager; }; } // namespace Internal diff --git a/src/plugins/texteditor/storagesettings.cpp b/src/plugins/texteditor/storagesettings.cpp index b92b4973450..c14a28ae6a4 100644 --- a/src/plugins/texteditor/storagesettings.cpp +++ b/src/plugins/texteditor/storagesettings.cpp @@ -41,12 +41,14 @@ namespace TextEditor { static const char * const cleanWhitespaceKey = "cleanWhitespace"; static const char * const inEntireDocumentKey = "inEntireDocument"; static const char * const addFinalNewLineKey = "addFinalNewLine"; +static const char * const cleanIndentationKey = "cleanIndentation"; static const char * const groupPostfix = "StorageSettings"; StorageSettings::StorageSettings() : m_cleanWhitespace(true), m_inEntireDocument(false), - m_addFinalNewLine(true) + m_addFinalNewLine(true), + m_cleanIndentation(true) { } @@ -59,6 +61,7 @@ void StorageSettings::toSettings(const QString &category, QSettings *s) const s->setValue(QLatin1String(cleanWhitespaceKey), m_cleanWhitespace); s->setValue(QLatin1String(inEntireDocumentKey), m_inEntireDocument); s->setValue(QLatin1String(addFinalNewLineKey), m_addFinalNewLine); + s->setValue(QLatin1String(cleanIndentationKey), m_cleanIndentation); s->endGroup(); } @@ -71,13 +74,15 @@ void StorageSettings::fromSettings(const QString &category, const QSettings *s) m_cleanWhitespace = s->value(group + QLatin1String(cleanWhitespaceKey), m_cleanWhitespace).toBool(); m_inEntireDocument = s->value(group + QLatin1String(inEntireDocumentKey), m_inEntireDocument).toBool(); m_addFinalNewLine = s->value(group + QLatin1String(addFinalNewLineKey), m_addFinalNewLine).toBool(); + m_cleanIndentation = s->value(group + QLatin1String(cleanIndentationKey), m_cleanIndentation).toBool(); } bool StorageSettings::equals(const StorageSettings &ts) const { return m_addFinalNewLine == ts.m_addFinalNewLine && m_cleanWhitespace == ts.m_cleanWhitespace - && m_inEntireDocument == ts.m_inEntireDocument; + && m_inEntireDocument == ts.m_inEntireDocument + && m_cleanIndentation == ts.m_cleanIndentation; } } // namespace TextEditor diff --git a/src/plugins/texteditor/storagesettings.h b/src/plugins/texteditor/storagesettings.h index d90b462d321..4fca30b284d 100644 --- a/src/plugins/texteditor/storagesettings.h +++ b/src/plugins/texteditor/storagesettings.h @@ -54,6 +54,7 @@ struct TEXTEDITOR_EXPORT StorageSettings bool m_cleanWhitespace; bool m_inEntireDocument; bool m_addFinalNewLine; + bool m_cleanIndentation; }; inline bool operator==(const StorageSettings &t1, const StorageSettings &t2) { return t1.equals(t2); } diff --git a/src/plugins/texteditor/tabsettings.cpp b/src/plugins/texteditor/tabsettings.cpp index 46d4100112f..5e61d0b4b8a 100644 --- a/src/plugins/texteditor/tabsettings.cpp +++ b/src/plugins/texteditor/tabsettings.cpp @@ -33,18 +33,18 @@ #include "tabsettings.h" +#include #include #include #include #include -#include -static const char* spacesForTabsKey = "SpacesForTabs"; -static const char* smartBackspaceKey = "SmartBackspace"; -static const char* autoIndentKey = "AutoIndent"; -static const char* tabSizeKey = "TabSize"; -static const char* indentSizeKey = "IndentSize"; -static const char* groupPostfix = "TabSettings"; +static const char *spacesForTabsKey = "SpacesForTabs"; +static const char *smartBackspaceKey = "SmartBackspace"; +static const char *autoIndentKey = "AutoIndent"; +static const char *tabSizeKey = "TabSize"; +static const char *indentSizeKey = "IndentSize"; +static const char *groupPostfix = "TabSettings"; namespace TextEditor { diff --git a/src/plugins/texteditor/texteditor.pro b/src/plugins/texteditor/texteditor.pro index 59c9cc4bb41..56c39604fb4 100644 --- a/src/plugins/texteditor/texteditor.pro +++ b/src/plugins/texteditor/texteditor.pro @@ -13,6 +13,7 @@ SOURCES += texteditorplugin.cpp \ completionsupport.cpp \ completionwidget.cpp \ fontsettingspage.cpp \ + interactionsettings.cpp \ tabsettings.cpp \ storagesettings.cpp \ displaysettings.cpp \ @@ -37,6 +38,7 @@ HEADERS += texteditorplugin.h \ texteditoractionhandler.h \ fontsettingspage.h \ icompletioncollector.h \ + interactionsettings.h \ texteditorconstants.h \ tabsettings.h \ storagesettings.h \ diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 1e6a47e47d4..765a4de2f11 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -42,6 +42,7 @@ #include "plaintexteditorfactory.h" #include "plaintexteditor.h" #include "storagesettings.h" +#include "interactionsettings.h" #include #include @@ -104,7 +105,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe addAutoReleasedObject(m_wizard); - m_settings = new TextEditorSettings(this, this); + m_settings = new TextEditorSettings(this); // Add plain text editor factory m_editorFactory = new PlainTextEditorFactory; @@ -112,7 +113,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe // Goto line functionality for quick open Core::ICore *core = Core::ICore::instance(); - m_lineNumberFilter = new LineNumberFilter(core->editorManager()); + m_lineNumberFilter = new LineNumberFilter; addAutoReleasedObject(m_lineNumberFilter); int contextId = core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR); diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp index ea61d571725..999ad0d8ae7 100644 --- a/src/plugins/texteditor/texteditorsettings.cpp +++ b/src/plugins/texteditor/texteditorsettings.cpp @@ -51,8 +51,7 @@ using namespace TextEditor::Constants; TextEditorSettings *TextEditorSettings::m_instance = 0; -TextEditorSettings::TextEditorSettings(Internal::TextEditorPlugin *plugin, - QObject *parent) +TextEditorSettings::TextEditorSettings(QObject *parent) : QObject(parent) { QTC_ASSERT(!m_instance, return); diff --git a/src/plugins/texteditor/texteditorsettings.h b/src/plugins/texteditor/texteditorsettings.h index fda32d20fae..efaec3176b2 100644 --- a/src/plugins/texteditor/texteditorsettings.h +++ b/src/plugins/texteditor/texteditorsettings.h @@ -47,10 +47,6 @@ struct TabSettings; struct StorageSettings; struct DisplaySettings; -namespace Internal { -class TextEditorPlugin; -} - /** * This class provides a central place for basic text editor settings. These * settings include font settings, tab settings, storage settings and display @@ -61,7 +57,7 @@ class TEXTEDITOR_EXPORT TextEditorSettings : public QObject Q_OBJECT public: - TextEditorSettings(Internal::TextEditorPlugin *plugin, QObject *parent); + explicit TextEditorSettings(QObject *parent); ~TextEditorSettings(); static TextEditorSettings *instance(); diff --git a/src/qworkbenchlibrary.pri b/src/qworkbenchlibrary.pri index 389d513eec9..a8af3d7edbd 100644 --- a/src/qworkbenchlibrary.pri +++ b/src/qworkbenchlibrary.pri @@ -7,7 +7,7 @@ win32 { DESTDIR = $$IDE_LIBRARY_PATH -include(../rpath.pri) +include(rpath.pri) TARGET = $$qtLibraryTarget($$TARGET) diff --git a/src/rpath.pri b/src/rpath.pri index e6812dbc23a..8b026982c96 100644 --- a/src/rpath.pri +++ b/src/rpath.pri @@ -9,5 +9,3 @@ macx { QMAKE_LFLAGS += -Wl,-z,origin \'-Wl,-rpath,$${IDE_PLUGIN_RPATH}\' QMAKE_RPATHDIR = } - - diff --git a/shared/cpaster/cgi.cpp b/src/shared/cpaster/cgi.cpp similarity index 100% rename from shared/cpaster/cgi.cpp rename to src/shared/cpaster/cgi.cpp diff --git a/shared/cpaster/cgi.h b/src/shared/cpaster/cgi.h similarity index 100% rename from shared/cpaster/cgi.h rename to src/shared/cpaster/cgi.h diff --git a/shared/cpaster/cpaster.pri b/src/shared/cpaster/cpaster.pri similarity index 100% rename from shared/cpaster/cpaster.pri rename to src/shared/cpaster/cpaster.pri diff --git a/shared/cpaster/fetcher.cpp b/src/shared/cpaster/fetcher.cpp similarity index 100% rename from shared/cpaster/fetcher.cpp rename to src/shared/cpaster/fetcher.cpp diff --git a/shared/cpaster/fetcher.h b/src/shared/cpaster/fetcher.h similarity index 100% rename from shared/cpaster/fetcher.h rename to src/shared/cpaster/fetcher.h diff --git a/shared/cpaster/poster.cpp b/src/shared/cpaster/poster.cpp similarity index 100% rename from shared/cpaster/poster.cpp rename to src/shared/cpaster/poster.cpp diff --git a/shared/cpaster/poster.h b/src/shared/cpaster/poster.h similarity index 100% rename from shared/cpaster/poster.h rename to src/shared/cpaster/poster.h diff --git a/shared/cpaster/splitter.cpp b/src/shared/cpaster/splitter.cpp similarity index 100% rename from shared/cpaster/splitter.cpp rename to src/shared/cpaster/splitter.cpp diff --git a/shared/cpaster/splitter.h b/src/shared/cpaster/splitter.h similarity index 100% rename from shared/cpaster/splitter.h rename to src/shared/cpaster/splitter.h diff --git a/shared/cpaster/view.cpp b/src/shared/cpaster/view.cpp similarity index 100% rename from shared/cpaster/view.cpp rename to src/shared/cpaster/view.cpp diff --git a/shared/cpaster/view.h b/src/shared/cpaster/view.h similarity index 100% rename from shared/cpaster/view.h rename to src/shared/cpaster/view.h diff --git a/shared/cpaster/view.ui b/src/shared/cpaster/view.ui similarity index 100% rename from shared/cpaster/view.ui rename to src/shared/cpaster/view.ui diff --git a/shared/cplusplus/AST.cpp b/src/shared/cplusplus/AST.cpp similarity index 100% rename from shared/cplusplus/AST.cpp rename to src/shared/cplusplus/AST.cpp diff --git a/shared/cplusplus/AST.h b/src/shared/cplusplus/AST.h similarity index 100% rename from shared/cplusplus/AST.h rename to src/shared/cplusplus/AST.h diff --git a/shared/cplusplus/ASTVisitor.cpp b/src/shared/cplusplus/ASTVisitor.cpp similarity index 100% rename from shared/cplusplus/ASTVisitor.cpp rename to src/shared/cplusplus/ASTVisitor.cpp diff --git a/shared/cplusplus/ASTVisitor.h b/src/shared/cplusplus/ASTVisitor.h similarity index 100% rename from shared/cplusplus/ASTVisitor.h rename to src/shared/cplusplus/ASTVisitor.h diff --git a/shared/cplusplus/ASTfwd.h b/src/shared/cplusplus/ASTfwd.h similarity index 100% rename from shared/cplusplus/ASTfwd.h rename to src/shared/cplusplus/ASTfwd.h diff --git a/shared/cplusplus/Array.cpp b/src/shared/cplusplus/Array.cpp similarity index 100% rename from shared/cplusplus/Array.cpp rename to src/shared/cplusplus/Array.cpp diff --git a/shared/cplusplus/Array.h b/src/shared/cplusplus/Array.h similarity index 100% rename from shared/cplusplus/Array.h rename to src/shared/cplusplus/Array.h diff --git a/shared/cplusplus/CPlusPlusForwardDeclarations.h b/src/shared/cplusplus/CPlusPlusForwardDeclarations.h similarity index 100% rename from shared/cplusplus/CPlusPlusForwardDeclarations.h rename to src/shared/cplusplus/CPlusPlusForwardDeclarations.h diff --git a/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp similarity index 100% rename from shared/cplusplus/CheckDeclaration.cpp rename to src/shared/cplusplus/CheckDeclaration.cpp diff --git a/shared/cplusplus/CheckDeclaration.h b/src/shared/cplusplus/CheckDeclaration.h similarity index 100% rename from shared/cplusplus/CheckDeclaration.h rename to src/shared/cplusplus/CheckDeclaration.h diff --git a/shared/cplusplus/CheckDeclarator.cpp b/src/shared/cplusplus/CheckDeclarator.cpp similarity index 100% rename from shared/cplusplus/CheckDeclarator.cpp rename to src/shared/cplusplus/CheckDeclarator.cpp diff --git a/shared/cplusplus/CheckDeclarator.h b/src/shared/cplusplus/CheckDeclarator.h similarity index 100% rename from shared/cplusplus/CheckDeclarator.h rename to src/shared/cplusplus/CheckDeclarator.h diff --git a/shared/cplusplus/CheckExpression.cpp b/src/shared/cplusplus/CheckExpression.cpp similarity index 100% rename from shared/cplusplus/CheckExpression.cpp rename to src/shared/cplusplus/CheckExpression.cpp diff --git a/shared/cplusplus/CheckExpression.h b/src/shared/cplusplus/CheckExpression.h similarity index 100% rename from shared/cplusplus/CheckExpression.h rename to src/shared/cplusplus/CheckExpression.h diff --git a/shared/cplusplus/CheckName.cpp b/src/shared/cplusplus/CheckName.cpp similarity index 100% rename from shared/cplusplus/CheckName.cpp rename to src/shared/cplusplus/CheckName.cpp diff --git a/shared/cplusplus/CheckName.h b/src/shared/cplusplus/CheckName.h similarity index 100% rename from shared/cplusplus/CheckName.h rename to src/shared/cplusplus/CheckName.h diff --git a/shared/cplusplus/CheckSpecifier.cpp b/src/shared/cplusplus/CheckSpecifier.cpp similarity index 100% rename from shared/cplusplus/CheckSpecifier.cpp rename to src/shared/cplusplus/CheckSpecifier.cpp diff --git a/shared/cplusplus/CheckSpecifier.h b/src/shared/cplusplus/CheckSpecifier.h similarity index 100% rename from shared/cplusplus/CheckSpecifier.h rename to src/shared/cplusplus/CheckSpecifier.h diff --git a/shared/cplusplus/CheckStatement.cpp b/src/shared/cplusplus/CheckStatement.cpp similarity index 100% rename from shared/cplusplus/CheckStatement.cpp rename to src/shared/cplusplus/CheckStatement.cpp diff --git a/shared/cplusplus/CheckStatement.h b/src/shared/cplusplus/CheckStatement.h similarity index 100% rename from shared/cplusplus/CheckStatement.h rename to src/shared/cplusplus/CheckStatement.h diff --git a/shared/cplusplus/Control.cpp b/src/shared/cplusplus/Control.cpp similarity index 100% rename from shared/cplusplus/Control.cpp rename to src/shared/cplusplus/Control.cpp diff --git a/shared/cplusplus/Control.h b/src/shared/cplusplus/Control.h similarity index 100% rename from shared/cplusplus/Control.h rename to src/shared/cplusplus/Control.h diff --git a/shared/cplusplus/CoreTypes.cpp b/src/shared/cplusplus/CoreTypes.cpp similarity index 100% rename from shared/cplusplus/CoreTypes.cpp rename to src/shared/cplusplus/CoreTypes.cpp diff --git a/shared/cplusplus/CoreTypes.h b/src/shared/cplusplus/CoreTypes.h similarity index 100% rename from shared/cplusplus/CoreTypes.h rename to src/shared/cplusplus/CoreTypes.h diff --git a/shared/cplusplus/DiagnosticClient.cpp b/src/shared/cplusplus/DiagnosticClient.cpp similarity index 100% rename from shared/cplusplus/DiagnosticClient.cpp rename to src/shared/cplusplus/DiagnosticClient.cpp diff --git a/shared/cplusplus/DiagnosticClient.h b/src/shared/cplusplus/DiagnosticClient.h similarity index 100% rename from shared/cplusplus/DiagnosticClient.h rename to src/shared/cplusplus/DiagnosticClient.h diff --git a/shared/cplusplus/FullySpecifiedType.cpp b/src/shared/cplusplus/FullySpecifiedType.cpp similarity index 100% rename from shared/cplusplus/FullySpecifiedType.cpp rename to src/shared/cplusplus/FullySpecifiedType.cpp diff --git a/shared/cplusplus/FullySpecifiedType.h b/src/shared/cplusplus/FullySpecifiedType.h similarity index 100% rename from shared/cplusplus/FullySpecifiedType.h rename to src/shared/cplusplus/FullySpecifiedType.h diff --git a/shared/cplusplus/Keywords.cpp b/src/shared/cplusplus/Keywords.cpp similarity index 100% rename from shared/cplusplus/Keywords.cpp rename to src/shared/cplusplus/Keywords.cpp diff --git a/shared/cplusplus/Keywords.kwgen b/src/shared/cplusplus/Keywords.kwgen similarity index 100% rename from shared/cplusplus/Keywords.kwgen rename to src/shared/cplusplus/Keywords.kwgen diff --git a/shared/cplusplus/Lexer.cpp b/src/shared/cplusplus/Lexer.cpp similarity index 100% rename from shared/cplusplus/Lexer.cpp rename to src/shared/cplusplus/Lexer.cpp diff --git a/shared/cplusplus/Lexer.h b/src/shared/cplusplus/Lexer.h similarity index 100% rename from shared/cplusplus/Lexer.h rename to src/shared/cplusplus/Lexer.h diff --git a/shared/cplusplus/LiteralTable.cpp b/src/shared/cplusplus/LiteralTable.cpp similarity index 100% rename from shared/cplusplus/LiteralTable.cpp rename to src/shared/cplusplus/LiteralTable.cpp diff --git a/shared/cplusplus/LiteralTable.h b/src/shared/cplusplus/LiteralTable.h similarity index 100% rename from shared/cplusplus/LiteralTable.h rename to src/shared/cplusplus/LiteralTable.h diff --git a/shared/cplusplus/Literals.cpp b/src/shared/cplusplus/Literals.cpp similarity index 100% rename from shared/cplusplus/Literals.cpp rename to src/shared/cplusplus/Literals.cpp diff --git a/shared/cplusplus/Literals.h b/src/shared/cplusplus/Literals.h similarity index 100% rename from shared/cplusplus/Literals.h rename to src/shared/cplusplus/Literals.h diff --git a/shared/cplusplus/MemoryPool.cpp b/src/shared/cplusplus/MemoryPool.cpp similarity index 100% rename from shared/cplusplus/MemoryPool.cpp rename to src/shared/cplusplus/MemoryPool.cpp diff --git a/shared/cplusplus/MemoryPool.h b/src/shared/cplusplus/MemoryPool.h similarity index 100% rename from shared/cplusplus/MemoryPool.h rename to src/shared/cplusplus/MemoryPool.h diff --git a/shared/cplusplus/Name.cpp b/src/shared/cplusplus/Name.cpp similarity index 100% rename from shared/cplusplus/Name.cpp rename to src/shared/cplusplus/Name.cpp diff --git a/shared/cplusplus/Name.h b/src/shared/cplusplus/Name.h similarity index 100% rename from shared/cplusplus/Name.h rename to src/shared/cplusplus/Name.h diff --git a/shared/cplusplus/NameVisitor.cpp b/src/shared/cplusplus/NameVisitor.cpp similarity index 100% rename from shared/cplusplus/NameVisitor.cpp rename to src/shared/cplusplus/NameVisitor.cpp diff --git a/shared/cplusplus/NameVisitor.h b/src/shared/cplusplus/NameVisitor.h similarity index 100% rename from shared/cplusplus/NameVisitor.h rename to src/shared/cplusplus/NameVisitor.h diff --git a/shared/cplusplus/Names.cpp b/src/shared/cplusplus/Names.cpp similarity index 100% rename from shared/cplusplus/Names.cpp rename to src/shared/cplusplus/Names.cpp diff --git a/shared/cplusplus/Names.h b/src/shared/cplusplus/Names.h similarity index 100% rename from shared/cplusplus/Names.h rename to src/shared/cplusplus/Names.h diff --git a/shared/cplusplus/ObjectiveCAtKeywords.cpp b/src/shared/cplusplus/ObjectiveCAtKeywords.cpp similarity index 100% rename from shared/cplusplus/ObjectiveCAtKeywords.cpp rename to src/shared/cplusplus/ObjectiveCAtKeywords.cpp diff --git a/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp similarity index 99% rename from shared/cplusplus/Parser.cpp rename to src/shared/cplusplus/Parser.cpp index eefa3d5b9fe..085c8cb54ef 100644 --- a/shared/cplusplus/Parser.cpp +++ b/src/shared/cplusplus/Parser.cpp @@ -2556,24 +2556,12 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node) return parseQtMethod(node); default: { - unsigned startOfName = cursor(); NameAST *name = 0; - if (parseName(name)) { - if (LA() == T_IDENTIFIER || tok().isLiteral() || (tok().isOperator() && LA() != T_LPAREN && - LA() != T_LBRACKET)) { - rewind(startOfName); - parseName(name, false); - } - // literal - // identifier ? - // identifier - // identifier - // identifier rparen - // lparen type rparen identifier [[cast-expression]] - + if (parseNameId(name)) { node = name; return true; } + break; } // default } // switch @@ -2581,6 +2569,23 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node) return false; } +bool Parser::parseNameId(NameAST *&name) +{ + unsigned start = cursor(); + if (! parseName(name)) + return false; + + if (LA() == T_IDENTIFIER || + tok().isLiteral() || + (tok().isOperator() && LA() != T_LPAREN && LA() != T_LBRACKET)) + { + rewind(start); + return parseName(name, false); + } + + return true; +} + bool Parser::parseNestedExpression(ExpressionAST *&node) { if (LA() == T_LPAREN) { @@ -2763,7 +2768,7 @@ bool Parser::parsePostfixExpression(ExpressionAST *&node) ast->access_token = consumeToken(); if (LA() == T_TEMPLATE) ast->template_token = consumeToken(); - if (! parseName(ast->member_name)) + if (! parseNameId(ast->member_name)) _translationUnit->error(cursor(), "expected unqualified-id before token `%s'", tok().spell()); *postfix_ptr = ast; diff --git a/shared/cplusplus/Parser.h b/src/shared/cplusplus/Parser.h similarity index 99% rename from shared/cplusplus/Parser.h rename to src/shared/cplusplus/Parser.h index 75fad457fad..d99d8d27fc0 100644 --- a/shared/cplusplus/Parser.h +++ b/src/shared/cplusplus/Parser.h @@ -141,6 +141,7 @@ public: bool parseMultiplicativeExpression(ExpressionAST *&node); bool parseTemplateId(NameAST *&node); bool parseClassOrNamespaceName(NameAST *&node); + bool parseNameId(NameAST *&node); bool parseName(NameAST *&node, bool acceptTemplateId = true); bool parseNestedNameSpecifier(NestedNameSpecifierAST *&node, bool acceptTemplateId); bool parseNestedNameSpecifierOpt(NestedNameSpecifierAST *&name, bool acceptTemplateId); diff --git a/shared/cplusplus/PrettyPrinter.cpp b/src/shared/cplusplus/PrettyPrinter.cpp similarity index 100% rename from shared/cplusplus/PrettyPrinter.cpp rename to src/shared/cplusplus/PrettyPrinter.cpp diff --git a/shared/cplusplus/PrettyPrinter.h b/src/shared/cplusplus/PrettyPrinter.h similarity index 100% rename from shared/cplusplus/PrettyPrinter.h rename to src/shared/cplusplus/PrettyPrinter.h diff --git a/shared/cplusplus/Scope.cpp b/src/shared/cplusplus/Scope.cpp similarity index 100% rename from shared/cplusplus/Scope.cpp rename to src/shared/cplusplus/Scope.cpp diff --git a/shared/cplusplus/Scope.h b/src/shared/cplusplus/Scope.h similarity index 100% rename from shared/cplusplus/Scope.h rename to src/shared/cplusplus/Scope.h diff --git a/shared/cplusplus/Semantic.cpp b/src/shared/cplusplus/Semantic.cpp similarity index 100% rename from shared/cplusplus/Semantic.cpp rename to src/shared/cplusplus/Semantic.cpp diff --git a/shared/cplusplus/Semantic.h b/src/shared/cplusplus/Semantic.h similarity index 100% rename from shared/cplusplus/Semantic.h rename to src/shared/cplusplus/Semantic.h diff --git a/shared/cplusplus/SemanticCheck.cpp b/src/shared/cplusplus/SemanticCheck.cpp similarity index 100% rename from shared/cplusplus/SemanticCheck.cpp rename to src/shared/cplusplus/SemanticCheck.cpp diff --git a/shared/cplusplus/SemanticCheck.h b/src/shared/cplusplus/SemanticCheck.h similarity index 100% rename from shared/cplusplus/SemanticCheck.h rename to src/shared/cplusplus/SemanticCheck.h diff --git a/shared/cplusplus/Symbol.cpp b/src/shared/cplusplus/Symbol.cpp similarity index 100% rename from shared/cplusplus/Symbol.cpp rename to src/shared/cplusplus/Symbol.cpp diff --git a/shared/cplusplus/Symbol.h b/src/shared/cplusplus/Symbol.h similarity index 100% rename from shared/cplusplus/Symbol.h rename to src/shared/cplusplus/Symbol.h diff --git a/shared/cplusplus/SymbolVisitor.cpp b/src/shared/cplusplus/SymbolVisitor.cpp similarity index 100% rename from shared/cplusplus/SymbolVisitor.cpp rename to src/shared/cplusplus/SymbolVisitor.cpp diff --git a/shared/cplusplus/SymbolVisitor.h b/src/shared/cplusplus/SymbolVisitor.h similarity index 100% rename from shared/cplusplus/SymbolVisitor.h rename to src/shared/cplusplus/SymbolVisitor.h diff --git a/shared/cplusplus/Symbols.cpp b/src/shared/cplusplus/Symbols.cpp similarity index 100% rename from shared/cplusplus/Symbols.cpp rename to src/shared/cplusplus/Symbols.cpp diff --git a/shared/cplusplus/Symbols.h b/src/shared/cplusplus/Symbols.h similarity index 100% rename from shared/cplusplus/Symbols.h rename to src/shared/cplusplus/Symbols.h diff --git a/shared/cplusplus/Token.cpp b/src/shared/cplusplus/Token.cpp similarity index 100% rename from shared/cplusplus/Token.cpp rename to src/shared/cplusplus/Token.cpp diff --git a/shared/cplusplus/Token.h b/src/shared/cplusplus/Token.h similarity index 100% rename from shared/cplusplus/Token.h rename to src/shared/cplusplus/Token.h diff --git a/shared/cplusplus/TranslationUnit.cpp b/src/shared/cplusplus/TranslationUnit.cpp similarity index 100% rename from shared/cplusplus/TranslationUnit.cpp rename to src/shared/cplusplus/TranslationUnit.cpp diff --git a/shared/cplusplus/TranslationUnit.h b/src/shared/cplusplus/TranslationUnit.h similarity index 100% rename from shared/cplusplus/TranslationUnit.h rename to src/shared/cplusplus/TranslationUnit.h diff --git a/shared/cplusplus/Type.cpp b/src/shared/cplusplus/Type.cpp similarity index 100% rename from shared/cplusplus/Type.cpp rename to src/shared/cplusplus/Type.cpp diff --git a/shared/cplusplus/Type.h b/src/shared/cplusplus/Type.h similarity index 100% rename from shared/cplusplus/Type.h rename to src/shared/cplusplus/Type.h diff --git a/shared/cplusplus/TypeVisitor.cpp b/src/shared/cplusplus/TypeVisitor.cpp similarity index 100% rename from shared/cplusplus/TypeVisitor.cpp rename to src/shared/cplusplus/TypeVisitor.cpp diff --git a/shared/cplusplus/TypeVisitor.h b/src/shared/cplusplus/TypeVisitor.h similarity index 100% rename from shared/cplusplus/TypeVisitor.h rename to src/shared/cplusplus/TypeVisitor.h diff --git a/shared/cplusplus/cplusplus.pri b/src/shared/cplusplus/cplusplus.pri similarity index 100% rename from shared/cplusplus/cplusplus.pri rename to src/shared/cplusplus/cplusplus.pri diff --git a/shared/designerintegrationv2/README.txt b/src/shared/designerintegrationv2/README.txt similarity index 100% rename from shared/designerintegrationv2/README.txt rename to src/shared/designerintegrationv2/README.txt diff --git a/shared/designerintegrationv2/designerintegration.pri b/src/shared/designerintegrationv2/designerintegration.pri similarity index 100% rename from shared/designerintegrationv2/designerintegration.pri rename to src/shared/designerintegrationv2/designerintegration.pri diff --git a/shared/designerintegrationv2/formresizer.cpp b/src/shared/designerintegrationv2/formresizer.cpp similarity index 100% rename from shared/designerintegrationv2/formresizer.cpp rename to src/shared/designerintegrationv2/formresizer.cpp diff --git a/shared/designerintegrationv2/formresizer.h b/src/shared/designerintegrationv2/formresizer.h similarity index 100% rename from shared/designerintegrationv2/formresizer.h rename to src/shared/designerintegrationv2/formresizer.h diff --git a/shared/designerintegrationv2/sizehandlerect.cpp b/src/shared/designerintegrationv2/sizehandlerect.cpp similarity index 100% rename from shared/designerintegrationv2/sizehandlerect.cpp rename to src/shared/designerintegrationv2/sizehandlerect.cpp diff --git a/shared/designerintegrationv2/sizehandlerect.h b/src/shared/designerintegrationv2/sizehandlerect.h similarity index 100% rename from shared/designerintegrationv2/sizehandlerect.h rename to src/shared/designerintegrationv2/sizehandlerect.h diff --git a/shared/designerintegrationv2/widgethost.cpp b/src/shared/designerintegrationv2/widgethost.cpp similarity index 100% rename from shared/designerintegrationv2/widgethost.cpp rename to src/shared/designerintegrationv2/widgethost.cpp diff --git a/shared/designerintegrationv2/widgethost.h b/src/shared/designerintegrationv2/widgethost.h similarity index 100% rename from shared/designerintegrationv2/widgethost.h rename to src/shared/designerintegrationv2/widgethost.h diff --git a/shared/designerintegrationv2/widgethostconstants.h b/src/shared/designerintegrationv2/widgethostconstants.h similarity index 100% rename from shared/designerintegrationv2/widgethostconstants.h rename to src/shared/designerintegrationv2/widgethostconstants.h diff --git a/shared/help/bookmarkdialog.ui b/src/shared/help/bookmarkdialog.ui similarity index 100% rename from shared/help/bookmarkdialog.ui rename to src/shared/help/bookmarkdialog.ui diff --git a/shared/help/bookmarkmanager.cpp b/src/shared/help/bookmarkmanager.cpp similarity index 100% rename from shared/help/bookmarkmanager.cpp rename to src/shared/help/bookmarkmanager.cpp diff --git a/shared/help/bookmarkmanager.h b/src/shared/help/bookmarkmanager.h similarity index 100% rename from shared/help/bookmarkmanager.h rename to src/shared/help/bookmarkmanager.h diff --git a/shared/help/contentwindow.cpp b/src/shared/help/contentwindow.cpp similarity index 100% rename from shared/help/contentwindow.cpp rename to src/shared/help/contentwindow.cpp diff --git a/shared/help/contentwindow.h b/src/shared/help/contentwindow.h similarity index 100% rename from shared/help/contentwindow.h rename to src/shared/help/contentwindow.h diff --git a/shared/help/filternamedialog.cpp b/src/shared/help/filternamedialog.cpp similarity index 100% rename from shared/help/filternamedialog.cpp rename to src/shared/help/filternamedialog.cpp diff --git a/shared/help/filternamedialog.h b/src/shared/help/filternamedialog.h similarity index 100% rename from shared/help/filternamedialog.h rename to src/shared/help/filternamedialog.h diff --git a/shared/help/filternamedialog.ui b/src/shared/help/filternamedialog.ui similarity index 100% rename from shared/help/filternamedialog.ui rename to src/shared/help/filternamedialog.ui diff --git a/shared/help/help.pri b/src/shared/help/help.pri similarity index 100% rename from shared/help/help.pri rename to src/shared/help/help.pri diff --git a/shared/help/helpviewer.cpp b/src/shared/help/helpviewer.cpp similarity index 100% rename from shared/help/helpviewer.cpp rename to src/shared/help/helpviewer.cpp diff --git a/shared/help/helpviewer.h b/src/shared/help/helpviewer.h similarity index 100% rename from shared/help/helpviewer.h rename to src/shared/help/helpviewer.h diff --git a/shared/help/indexwindow.cpp b/src/shared/help/indexwindow.cpp similarity index 100% rename from shared/help/indexwindow.cpp rename to src/shared/help/indexwindow.cpp diff --git a/shared/help/indexwindow.h b/src/shared/help/indexwindow.h similarity index 100% rename from shared/help/indexwindow.h rename to src/shared/help/indexwindow.h diff --git a/shared/help/topicchooser.cpp b/src/shared/help/topicchooser.cpp similarity index 100% rename from shared/help/topicchooser.cpp rename to src/shared/help/topicchooser.cpp diff --git a/shared/help/topicchooser.h b/src/shared/help/topicchooser.h similarity index 100% rename from shared/help/topicchooser.h rename to src/shared/help/topicchooser.h diff --git a/shared/help/topicchooser.ui b/src/shared/help/topicchooser.ui similarity index 100% rename from shared/help/topicchooser.ui rename to src/shared/help/topicchooser.ui diff --git a/shared/indenter/README b/src/shared/indenter/README similarity index 100% rename from shared/indenter/README rename to src/shared/indenter/README diff --git a/shared/indenter/constants.cpp b/src/shared/indenter/constants.cpp similarity index 100% rename from shared/indenter/constants.cpp rename to src/shared/indenter/constants.cpp diff --git a/shared/indenter/indenter.h b/src/shared/indenter/indenter.h similarity index 100% rename from shared/indenter/indenter.h rename to src/shared/indenter/indenter.h diff --git a/shared/indenter/indenter.pri b/src/shared/indenter/indenter.pri similarity index 100% rename from shared/indenter/indenter.pri rename to src/shared/indenter/indenter.pri diff --git a/shared/indenter/indenter_impl.h b/src/shared/indenter/indenter_impl.h similarity index 100% rename from shared/indenter/indenter_impl.h rename to src/shared/indenter/indenter_impl.h diff --git a/shared/indenter/test/main.cpp b/src/shared/indenter/test/main.cpp similarity index 100% rename from shared/indenter/test/main.cpp rename to src/shared/indenter/test/main.cpp diff --git a/shared/indenter/test/test.pro b/src/shared/indenter/test/test.pro similarity index 100% rename from shared/indenter/test/test.pro rename to src/shared/indenter/test/test.pro diff --git a/shared/namespace_global.h b/src/shared/namespace_global.h similarity index 100% rename from shared/namespace_global.h rename to src/shared/namespace_global.h diff --git a/shared/proparser/abstractproitemvisitor.h b/src/shared/proparser/abstractproitemvisitor.h similarity index 100% rename from shared/proparser/abstractproitemvisitor.h rename to src/shared/proparser/abstractproitemvisitor.h diff --git a/shared/proparser/images/append.png b/src/shared/proparser/images/append.png similarity index 100% rename from shared/proparser/images/append.png rename to src/shared/proparser/images/append.png diff --git a/shared/proparser/images/other.png b/src/shared/proparser/images/other.png similarity index 100% rename from shared/proparser/images/other.png rename to src/shared/proparser/images/other.png diff --git a/shared/proparser/images/profile.png b/src/shared/proparser/images/profile.png similarity index 100% rename from shared/proparser/images/profile.png rename to src/shared/proparser/images/profile.png diff --git a/shared/proparser/images/remove.png b/src/shared/proparser/images/remove.png similarity index 100% rename from shared/proparser/images/remove.png rename to src/shared/proparser/images/remove.png diff --git a/shared/proparser/images/scope.png b/src/shared/proparser/images/scope.png similarity index 100% rename from shared/proparser/images/scope.png rename to src/shared/proparser/images/scope.png diff --git a/shared/proparser/images/set.png b/src/shared/proparser/images/set.png similarity index 100% rename from shared/proparser/images/set.png rename to src/shared/proparser/images/set.png diff --git a/shared/proparser/images/value.png b/src/shared/proparser/images/value.png similarity index 100% rename from shared/proparser/images/value.png rename to src/shared/proparser/images/value.png diff --git a/shared/proparser/procommandmanager.cpp b/src/shared/proparser/procommandmanager.cpp similarity index 100% rename from shared/proparser/procommandmanager.cpp rename to src/shared/proparser/procommandmanager.cpp diff --git a/shared/proparser/procommandmanager.h b/src/shared/proparser/procommandmanager.h similarity index 100% rename from shared/proparser/procommandmanager.h rename to src/shared/proparser/procommandmanager.h diff --git a/shared/proparser/proeditor.cpp b/src/shared/proparser/proeditor.cpp similarity index 100% rename from shared/proparser/proeditor.cpp rename to src/shared/proparser/proeditor.cpp diff --git a/shared/proparser/proeditor.h b/src/shared/proparser/proeditor.h similarity index 100% rename from shared/proparser/proeditor.h rename to src/shared/proparser/proeditor.h diff --git a/shared/proparser/proeditor.ui b/src/shared/proparser/proeditor.ui similarity index 100% rename from shared/proparser/proeditor.ui rename to src/shared/proparser/proeditor.ui diff --git a/shared/proparser/proeditormodel.cpp b/src/shared/proparser/proeditormodel.cpp similarity index 100% rename from shared/proparser/proeditormodel.cpp rename to src/shared/proparser/proeditormodel.cpp diff --git a/shared/proparser/proeditormodel.h b/src/shared/proparser/proeditormodel.h similarity index 100% rename from shared/proparser/proeditormodel.h rename to src/shared/proparser/proeditormodel.h diff --git a/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp similarity index 100% rename from shared/proparser/profileevaluator.cpp rename to src/shared/proparser/profileevaluator.cpp diff --git a/shared/proparser/profileevaluator.h b/src/shared/proparser/profileevaluator.h similarity index 100% rename from shared/proparser/profileevaluator.h rename to src/shared/proparser/profileevaluator.h diff --git a/shared/proparser/proiteminfo.cpp b/src/shared/proparser/proiteminfo.cpp similarity index 100% rename from shared/proparser/proiteminfo.cpp rename to src/shared/proparser/proiteminfo.cpp diff --git a/shared/proparser/proiteminfo.h b/src/shared/proparser/proiteminfo.h similarity index 100% rename from shared/proparser/proiteminfo.h rename to src/shared/proparser/proiteminfo.h diff --git a/shared/proparser/proiteminfo.xml b/src/shared/proparser/proiteminfo.xml similarity index 100% rename from shared/proparser/proiteminfo.xml rename to src/shared/proparser/proiteminfo.xml diff --git a/shared/proparser/proitems.cpp b/src/shared/proparser/proitems.cpp similarity index 100% rename from shared/proparser/proitems.cpp rename to src/shared/proparser/proitems.cpp diff --git a/shared/proparser/proitems.h b/src/shared/proparser/proitems.h similarity index 100% rename from shared/proparser/proitems.h rename to src/shared/proparser/proitems.h diff --git a/shared/proparser/proparser.pri b/src/shared/proparser/proparser.pri similarity index 100% rename from shared/proparser/proparser.pri rename to src/shared/proparser/proparser.pri diff --git a/shared/proparser/proparser.qrc b/src/shared/proparser/proparser.qrc similarity index 100% rename from shared/proparser/proparser.qrc rename to src/shared/proparser/proparser.qrc diff --git a/shared/proparser/proparserutils.h b/src/shared/proparser/proparserutils.h similarity index 100% rename from shared/proparser/proparserutils.h rename to src/shared/proparser/proparserutils.h diff --git a/shared/proparser/prowriter.cpp b/src/shared/proparser/prowriter.cpp similarity index 100% rename from shared/proparser/prowriter.cpp rename to src/shared/proparser/prowriter.cpp diff --git a/shared/proparser/prowriter.h b/src/shared/proparser/prowriter.h similarity index 100% rename from shared/proparser/prowriter.h rename to src/shared/proparser/prowriter.h diff --git a/shared/proparser/proxml.cpp b/src/shared/proparser/proxml.cpp similarity index 100% rename from shared/proparser/proxml.cpp rename to src/shared/proparser/proxml.cpp diff --git a/shared/proparser/proxml.h b/src/shared/proparser/proxml.h similarity index 100% rename from shared/proparser/proxml.h rename to src/shared/proparser/proxml.h diff --git a/shared/proparser/valueeditor.cpp b/src/shared/proparser/valueeditor.cpp similarity index 100% rename from shared/proparser/valueeditor.cpp rename to src/shared/proparser/valueeditor.cpp diff --git a/shared/proparser/valueeditor.h b/src/shared/proparser/valueeditor.h similarity index 100% rename from shared/proparser/valueeditor.h rename to src/shared/proparser/valueeditor.h diff --git a/shared/proparser/valueeditor.ui b/src/shared/proparser/valueeditor.ui similarity index 100% rename from shared/proparser/valueeditor.ui rename to src/shared/proparser/valueeditor.ui diff --git a/shared/qrceditor/qrceditor.cpp b/src/shared/qrceditor/qrceditor.cpp similarity index 100% rename from shared/qrceditor/qrceditor.cpp rename to src/shared/qrceditor/qrceditor.cpp diff --git a/shared/qrceditor/qrceditor.h b/src/shared/qrceditor/qrceditor.h similarity index 100% rename from shared/qrceditor/qrceditor.h rename to src/shared/qrceditor/qrceditor.h diff --git a/shared/qrceditor/qrceditor.pri b/src/shared/qrceditor/qrceditor.pri similarity index 100% rename from shared/qrceditor/qrceditor.pri rename to src/shared/qrceditor/qrceditor.pri diff --git a/shared/qrceditor/qrceditor.ui b/src/shared/qrceditor/qrceditor.ui similarity index 100% rename from shared/qrceditor/qrceditor.ui rename to src/shared/qrceditor/qrceditor.ui diff --git a/shared/qrceditor/resourcefile.cpp b/src/shared/qrceditor/resourcefile.cpp similarity index 100% rename from shared/qrceditor/resourcefile.cpp rename to src/shared/qrceditor/resourcefile.cpp diff --git a/shared/qrceditor/resourcefile_p.h b/src/shared/qrceditor/resourcefile_p.h similarity index 100% rename from shared/qrceditor/resourcefile_p.h rename to src/shared/qrceditor/resourcefile_p.h diff --git a/shared/qrceditor/resourceview.cpp b/src/shared/qrceditor/resourceview.cpp similarity index 100% rename from shared/qrceditor/resourceview.cpp rename to src/shared/qrceditor/resourceview.cpp diff --git a/shared/qrceditor/resourceview.h b/src/shared/qrceditor/resourceview.h similarity index 100% rename from shared/qrceditor/resourceview.h rename to src/shared/qrceditor/resourceview.h diff --git a/shared/qrceditor/test/main.cpp b/src/shared/qrceditor/test/main.cpp similarity index 100% rename from shared/qrceditor/test/main.cpp rename to src/shared/qrceditor/test/main.cpp diff --git a/shared/qrceditor/test/mainwindow.cpp b/src/shared/qrceditor/test/mainwindow.cpp similarity index 100% rename from shared/qrceditor/test/mainwindow.cpp rename to src/shared/qrceditor/test/mainwindow.cpp diff --git a/shared/qrceditor/test/mainwindow.h b/src/shared/qrceditor/test/mainwindow.h similarity index 100% rename from shared/qrceditor/test/mainwindow.h rename to src/shared/qrceditor/test/mainwindow.h diff --git a/shared/qrceditor/test/test.pro b/src/shared/qrceditor/test/test.pro similarity index 100% rename from shared/qrceditor/test/test.pro rename to src/shared/qrceditor/test/test.pro diff --git a/shared/qrceditor/undocommands.cpp b/src/shared/qrceditor/undocommands.cpp similarity index 100% rename from shared/qrceditor/undocommands.cpp rename to src/shared/qrceditor/undocommands.cpp diff --git a/shared/qrceditor/undocommands_p.h b/src/shared/qrceditor/undocommands_p.h similarity index 100% rename from shared/qrceditor/undocommands_p.h rename to src/shared/qrceditor/undocommands_p.h diff --git a/shared/qscripthighlighter/README b/src/shared/qscripthighlighter/README similarity index 100% rename from shared/qscripthighlighter/README rename to src/shared/qscripthighlighter/README diff --git a/shared/qscripthighlighter/qscripthighlighter.cpp b/src/shared/qscripthighlighter/qscripthighlighter.cpp similarity index 100% rename from shared/qscripthighlighter/qscripthighlighter.cpp rename to src/shared/qscripthighlighter/qscripthighlighter.cpp diff --git a/shared/qscripthighlighter/qscripthighlighter.h b/src/shared/qscripthighlighter/qscripthighlighter.h similarity index 100% rename from shared/qscripthighlighter/qscripthighlighter.h rename to src/shared/qscripthighlighter/qscripthighlighter.h diff --git a/shared/qscripthighlighter/qscripthighlighter.pri b/src/shared/qscripthighlighter/qscripthighlighter.pri similarity index 100% rename from shared/qscripthighlighter/qscripthighlighter.pri rename to src/shared/qscripthighlighter/qscripthighlighter.pri diff --git a/shared/qscripthighlighter/test/main.cpp b/src/shared/qscripthighlighter/test/main.cpp similarity index 100% rename from shared/qscripthighlighter/test/main.cpp rename to src/shared/qscripthighlighter/test/main.cpp diff --git a/shared/qscripthighlighter/test/test.pro b/src/shared/qscripthighlighter/test/test.pro similarity index 100% rename from shared/qscripthighlighter/test/test.pro rename to src/shared/qscripthighlighter/test/test.pro diff --git a/shared/qtextended_integration.h b/src/shared/qtextended_integration.h similarity index 100% rename from shared/qtextended_integration.h rename to src/shared/qtextended_integration.h diff --git a/shared/qtlockedfile/README.txt b/src/shared/qtlockedfile/README.txt similarity index 100% rename from shared/qtlockedfile/README.txt rename to src/shared/qtlockedfile/README.txt diff --git a/shared/qtlockedfile/namespace.patch b/src/shared/qtlockedfile/namespace.patch similarity index 100% rename from shared/qtlockedfile/namespace.patch rename to src/shared/qtlockedfile/namespace.patch diff --git a/shared/qtlockedfile/qtlockedfile.cpp b/src/shared/qtlockedfile/qtlockedfile.cpp similarity index 100% rename from shared/qtlockedfile/qtlockedfile.cpp rename to src/shared/qtlockedfile/qtlockedfile.cpp diff --git a/shared/qtlockedfile/qtlockedfile.h b/src/shared/qtlockedfile/qtlockedfile.h similarity index 100% rename from shared/qtlockedfile/qtlockedfile.h rename to src/shared/qtlockedfile/qtlockedfile.h diff --git a/shared/qtlockedfile/qtlockedfile.pri b/src/shared/qtlockedfile/qtlockedfile.pri similarity index 100% rename from shared/qtlockedfile/qtlockedfile.pri rename to src/shared/qtlockedfile/qtlockedfile.pri diff --git a/shared/qtlockedfile/qtlockedfile_unix.cpp b/src/shared/qtlockedfile/qtlockedfile_unix.cpp similarity index 100% rename from shared/qtlockedfile/qtlockedfile_unix.cpp rename to src/shared/qtlockedfile/qtlockedfile_unix.cpp diff --git a/shared/qtlockedfile/qtlockedfile_win.cpp b/src/shared/qtlockedfile/qtlockedfile_win.cpp similarity index 100% rename from shared/qtlockedfile/qtlockedfile_win.cpp rename to src/shared/qtlockedfile/qtlockedfile_win.cpp diff --git a/shared/qtsingleapplication/README.txt b/src/shared/qtsingleapplication/README.txt similarity index 100% rename from shared/qtsingleapplication/README.txt rename to src/shared/qtsingleapplication/README.txt diff --git a/shared/qtsingleapplication/namespace.patch b/src/shared/qtsingleapplication/namespace.patch similarity index 100% rename from shared/qtsingleapplication/namespace.patch rename to src/shared/qtsingleapplication/namespace.patch diff --git a/shared/qtsingleapplication/qtlocalpeer.cpp b/src/shared/qtsingleapplication/qtlocalpeer.cpp similarity index 100% rename from shared/qtsingleapplication/qtlocalpeer.cpp rename to src/shared/qtsingleapplication/qtlocalpeer.cpp diff --git a/shared/qtsingleapplication/qtlocalpeer.h b/src/shared/qtsingleapplication/qtlocalpeer.h similarity index 100% rename from shared/qtsingleapplication/qtlocalpeer.h rename to src/shared/qtsingleapplication/qtlocalpeer.h diff --git a/shared/qtsingleapplication/qtsingleapplication.cpp b/src/shared/qtsingleapplication/qtsingleapplication.cpp similarity index 100% rename from shared/qtsingleapplication/qtsingleapplication.cpp rename to src/shared/qtsingleapplication/qtsingleapplication.cpp diff --git a/shared/qtsingleapplication/qtsingleapplication.h b/src/shared/qtsingleapplication/qtsingleapplication.h similarity index 100% rename from shared/qtsingleapplication/qtsingleapplication.h rename to src/shared/qtsingleapplication/qtsingleapplication.h diff --git a/shared/qtsingleapplication/qtsingleapplication.pri b/src/shared/qtsingleapplication/qtsingleapplication.pri similarity index 100% rename from shared/qtsingleapplication/qtsingleapplication.pri rename to src/shared/qtsingleapplication/qtsingleapplication.pri diff --git a/shared/qtsingleapplication/qtsinglecoreapplication.cpp b/src/shared/qtsingleapplication/qtsinglecoreapplication.cpp similarity index 100% rename from shared/qtsingleapplication/qtsinglecoreapplication.cpp rename to src/shared/qtsingleapplication/qtsinglecoreapplication.cpp diff --git a/shared/qtsingleapplication/qtsinglecoreapplication.h b/src/shared/qtsingleapplication/qtsinglecoreapplication.h similarity index 100% rename from shared/qtsingleapplication/qtsinglecoreapplication.h rename to src/shared/qtsingleapplication/qtsinglecoreapplication.h diff --git a/shared/qtsingleapplication/qtsinglecoreapplication.pri b/src/shared/qtsingleapplication/qtsinglecoreapplication.pri similarity index 100% rename from shared/qtsingleapplication/qtsinglecoreapplication.pri rename to src/shared/qtsingleapplication/qtsinglecoreapplication.pri diff --git a/shared/scriptwrapper/README b/src/shared/scriptwrapper/README similarity index 100% rename from shared/scriptwrapper/README rename to src/shared/scriptwrapper/README diff --git a/shared/scriptwrapper/interface_wrap_helpers.h b/src/shared/scriptwrapper/interface_wrap_helpers.h similarity index 100% rename from shared/scriptwrapper/interface_wrap_helpers.h rename to src/shared/scriptwrapper/interface_wrap_helpers.h diff --git a/shared/scriptwrapper/scriptwrapper.pri b/src/shared/scriptwrapper/scriptwrapper.pri similarity index 100% rename from shared/scriptwrapper/scriptwrapper.pri rename to src/shared/scriptwrapper/scriptwrapper.pri diff --git a/shared/scriptwrapper/wrap_helpers.h b/src/shared/scriptwrapper/wrap_helpers.h similarity index 100% rename from shared/scriptwrapper/wrap_helpers.h rename to src/shared/scriptwrapper/wrap_helpers.h diff --git a/src/tools/qtlibspatcher/qtlibspatchermain.cpp b/src/tools/qtlibspatcher/qtlibspatchermain.cpp index 975e58c971a..c3ff6a0387e 100644 --- a/src/tools/qtlibspatcher/qtlibspatchermain.cpp +++ b/src/tools/qtlibspatcher/qtlibspatchermain.cpp @@ -46,7 +46,7 @@ "Trolltech/Code_less_create_more/Troll/4.4.3"; #else const char * const oldSourceBase = "/home/berlin/dev/qt-4.4.3-temp/qt-x11-opensource-src-4.4.3"; - const char * const oldInstallBase = "/home/berlin/dev/qt-4.4.3-shipping"; + const char * const oldInstallBase = "/home/berlin/dev/qt-4.4.3-shipping/qt"; #endif diff --git a/tests/manual/fakevim/main.cpp b/tests/manual/fakevim/main.cpp index dfa1350e559..2de37c10733 100644 --- a/tests/manual/fakevim/main.cpp +++ b/tests/manual/fakevim/main.cpp @@ -17,21 +17,26 @@ class Proxy : public QObject Q_OBJECT public: - Proxy() : QObject(0) {} + Proxy(QWidget *widget, QObject *parent = 0) + : QObject(parent), m_widget(widget) + {} public slots: - void changeSelection(QWidget *w, const QList &s) + void changeSelection(const QList &s) { - if (QPlainTextEdit *ed = qobject_cast(w)) + if (QPlainTextEdit *ed = qobject_cast(m_widget)) ed->setExtraSelections(s); - else if (QTextEdit *ed = qobject_cast(w)) + else if (QTextEdit *ed = qobject_cast(m_widget)) ed->setExtraSelections(s); } - void changeExtraInformation(QWidget *w, const QString &info) + void changeExtraInformation(const QString &info) { - QMessageBox::information(w, "Information", info); + QMessageBox::information(m_widget, "Information", info); } + +private: + QWidget *m_widget; }; int main(int argc, char *argv[]) @@ -45,24 +50,28 @@ int main(int argc, char *argv[]) QString title; bool usePlainTextEdit = args.size() < 2; if (usePlainTextEdit) { - widget = new QPlainTextEdit; + QPlainTextEdit *w = new QPlainTextEdit; + w->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); title = "PlainTextEdit"; + widget = w; } else { - widget = new QTextEdit; + QTextEdit *w = new QTextEdit; + w->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); title = "TextEdit"; + widget = w; } - widget->resize(450, 350); + widget->setObjectName("Editor"); + //widget->resize(450, 350); widget->setFocus(); - Proxy proxy; + Proxy proxy(widget); - - FakeVimHandler handler; + FakeVimHandler handler(widget, 0); QMainWindow mw; mw.setWindowTitle("Fakevim (" + title + ")"); mw.setCentralWidget(widget); - mw.resize(500, 650); + mw.resize(600, 650); mw.move(0, 0); mw.show(); @@ -77,18 +86,18 @@ int main(int argc, char *argv[]) QObject::connect(&handler, SIGNAL(commandBufferChanged(QString)), mw.statusBar(), SLOT(showMessage(QString))); - QObject::connect(&handler, SIGNAL(quitRequested(QWidget *)), + QObject::connect(&handler, SIGNAL(quitRequested()), &app, SLOT(quit())); QObject::connect(&handler, - SIGNAL(selectionChanged(QWidget*,QList)), - &proxy, SLOT(changeSelection(QWidget*,QList))); + SIGNAL(selectionChanged(QList)), + &proxy, SLOT(changeSelection(QList))); QObject::connect(&handler, - SIGNAL(extraInformationChanged(QWidget*,QString)), - &proxy, SLOT(changeExtraInformation(QWidget*,QString))); + SIGNAL(extraInformationChanged(QString)), + &proxy, SLOT(changeExtraInformation(QString))); - handler.addWidget(widget); + handler.setupWidget(); if (args.size() >= 1) - handler.handleCommand(widget, "r " + args.at(0)); + handler.handleCommand("r " + args.at(0)); return app.exec(); }