Commit de6d6150 authored by dt's avatar dt
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents ef1693e9 bbfc1013
#!/bin/bash
#!/bin/sh
bindir=$(dirname "$0")
libdir=$(cd ${bindir}/../lib ; pwd)
LD_LIBRARY_PATH="${libdir}" "${bindir}/qtcreator.bin" ${1+"$@"}
LD_LIBRARY_PATH="${libdir}:${LD_LIBRARY_PATH}" "${bindir}/qtcreator.bin" ${1+"$@"}
......@@ -123,7 +123,6 @@ HEADERS += mainwindow.h \
iversioncontrol.h \
iview.h \
ifilewizardextension.h \
viewmanagerinterface.h \
icorelistener.h \
versiondialog.h \
scriptmanager/metatypedeclarations.h \
......
......@@ -803,10 +803,7 @@ void MainWindow::openFiles(const QStringList &fileNames)
void MainWindow::setFocusToEditor()
{
QWidget *focusWidget = qApp->focusWidget();
// ### Duplicated code from EditMode::makeSureEditorManagerVisible
IMode *currentMode = m_coreImpl->modeManager()->currentMode();
if (currentMode && currentMode->uniqueModeName() != QLatin1String(Constants::MODE_EDIT) &&
currentMode->uniqueModeName() != QLatin1String("GdbDebugger.Mode.Debug"))
if (!EditorManager::instance()->isVisible())
{
m_coreImpl->modeManager()->activateMode(QLatin1String(Constants::MODE_EDIT));
}
......@@ -814,11 +811,23 @@ void MainWindow::setFocusToEditor()
if (IEditor *editor = m_editorManager->currentEditor())
editor->widget()->setFocus();
if (focusWidget && focusWidget == qApp->focusWidget()) {
if (FindToolBarPlaceHolder::getCurrent())
FindToolBarPlaceHolder::getCurrent()->hide();
OutputPaneManager::instance()->slotHide();
RightPaneWidget::instance()->setShown(false);
bool focusWasAlreadyInEditor = (focusWidget && focusWidget == qApp->focusWidget());
if (focusWasAlreadyInEditor) {
bool stuffVisible =
(FindToolBarPlaceHolder::getCurrent() &&
FindToolBarPlaceHolder::getCurrent()->isVisible())
|| (OutputPanePlaceHolder::getCurrent() &&
OutputPanePlaceHolder::getCurrent()->isVisible())
|| (RightPanePlaceHolder::current() &&
RightPanePlaceHolder::current()->isVisible());
if (stuffVisible) {
if (FindToolBarPlaceHolder::getCurrent())
FindToolBarPlaceHolder::getCurrent()->hide();
OutputPaneManager::instance()->slotHide();
RightPaneWidget::instance()->setShown(false);
} else {
m_coreImpl->modeManager()->activateMode(QLatin1String(Constants::MODE_EDIT));
}
}
}
......
......@@ -47,8 +47,8 @@
using namespace Core;
using namespace Core::Internal;
ViewManager::ViewManager(MainWindow *mainWnd) :
ViewManagerInterface(mainWnd),
ViewManager::ViewManager(MainWindow *mainWnd)
: QObject(mainWnd),
m_mainWnd(mainWnd)
{
for (int i = 0; i < 3; ++i) {
......
......@@ -30,8 +30,6 @@
#ifndef VIEWMANAGER_H
#define VIEWMANAGER_H
#include "viewmanagerinterface.h"
#include <QtCore/QMap>
#include <QtGui/QWidget>
......@@ -45,15 +43,14 @@ QT_END_NAMESPACE
namespace Core {
class UniqueIDManager;
class IView;
namespace Internal {
class MainWindow;
class NavigationWidget;
class ViewManager
: public Core::ViewManagerInterface
class ViewManager : public QObject
{
Q_OBJECT
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
**
**************************************************************************/
#ifndef VIEWMANAGERINTERFACE_H
#define VIEWMANAGERINTERFACE_H
#include <coreplugin/core_global.h>
#include <QtCore/QObject>
#include <QtGui/QKeySequence>
QT_BEGIN_NAMESPACE
class QIcon;
class QString;
QT_END_NAMESPACE
namespace Core {
class IView;
class CORE_EXPORT ViewManagerInterface
: public QObject
{
Q_OBJECT
public:
ViewManagerInterface(QObject *parent = 0) : QObject(parent) { }
virtual ~ViewManagerInterface() { }
// returns the view @p id
virtual IView * view(const QString & id) = 0;
};
} // namespace Core
#endif // VIEWMANAGERINTERFACE_H
......@@ -187,7 +187,6 @@ protected:
QByteArray tryIncludeFile(QString &fileName, IncludeType type);
void mergeEnvironment(CPlusPlus::Document::Ptr doc);
void mergeEnvironment(CPlusPlus::Document::Ptr doc, QSet<QString> *processed);
virtual void macroAdded(const Macro &macro);
virtual void startExpandingMacro(unsigned offset,
......@@ -212,6 +211,7 @@ private:
QSet<QString> m_included;
Document::Ptr m_currentDoc;
QSet<QString> m_todo;
QSet<QString> m_processed;
};
} // namespace Internal
......@@ -270,7 +270,10 @@ void CppPreprocessor::run(const QString &fileName)
}
void CppPreprocessor::resetEnvironment()
{ env.reset(); }
{
env.reset();
m_processed.clear();
}
bool CppPreprocessor::includeFile(const QString &absoluteFilePath, QByteArray *result)
{
......@@ -413,28 +416,22 @@ void CppPreprocessor::stopExpandingMacro(unsigned, const Macro &)
}
void CppPreprocessor::mergeEnvironment(Document::Ptr doc)
{
QSet<QString> processed;
mergeEnvironment(doc, &processed);
}
void CppPreprocessor::mergeEnvironment(Document::Ptr doc, QSet<QString> *processed)
{
if (! doc)
return;
const QString fn = doc->fileName();
if (processed->contains(fn))
if (m_processed.contains(fn))
return;
processed->insert(fn);
m_processed.insert(fn);
foreach (const Document::Include &incl, doc->includes()) {
QString includedFile = incl.fileName();
if (Document::Ptr includedDoc = snapshot.value(includedFile))
mergeEnvironment(includedDoc, processed);
mergeEnvironment(includedDoc);
else
run(includedFile);
}
......
......@@ -88,5 +88,5 @@ DEFINES += USE_MODEL_TEST=1
win32 {
include(win/win.pri)
CONFIG(cdbdebugger):include(cdb\cdb.pri)
CONFIG(cdbdebugger):include(cdb/cdb.pri)
}
......@@ -85,7 +85,7 @@
<enum>QFrame::Plain</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
......@@ -96,7 +96,7 @@
<x>0</x>
<y>0</y>
<width>601</width>
<height>157</height>
<height>154</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
......
......@@ -198,12 +198,18 @@ public:
bool m_invertNext;
int m_skipLevel;
bool m_cumulative;
bool m_isFirstVariableValue;
QString m_lastVarName;
ProVariable::VariableOperator m_variableOperator;
QString m_origfile;
QString m_oldPath; // To restore the current path to the path
QStack<ProFile*> m_profileStack; // To handle 'include(a.pri), so we can track back to 'a.pro' when finished with 'a.pri'
// we need the following two variables for handling
// CONFIG = foo bar $$CONFIG
QHash<QString, QStringList> m_tempValuemap; // used while evaluating (variable operator value1 value2 ...)
QHash<const ProFile*, QHash<QString, QStringList> > m_tempFilevaluemap; // used while evaluating (variable operator value1 value2 ...)
QHash<QString, QStringList> m_valuemap; // VariableName must be us-ascii, the content however can be non-us-ascii.
QHash<const ProFile*, QHash<QString, QStringList> > m_filevaluemap; // Variables per include file
QHash<QString, QString> m_properties;
......@@ -229,6 +235,7 @@ ProFileEvaluator::Private::Private(ProFileEvaluator *q_)
m_condition = ConditionFalse;
m_invertNext = false;
m_skipLevel = 0;
m_isFirstVariableValue = true;
}
bool ProFileEvaluator::Private::read(ProFile *pro)
......@@ -556,12 +563,17 @@ bool ProFileEvaluator::Private::visitBeginProVariable(ProVariable *variable)
{
m_lastVarName = variable->variable();
m_variableOperator = variable->variableOperator();
m_isFirstVariableValue = true;
m_tempValuemap = m_valuemap;
m_tempFilevaluemap = m_filevaluemap;
return true;
}
bool ProFileEvaluator::Private::visitEndProVariable(ProVariable *variable)
{
Q_UNUSED(variable);
m_valuemap = m_tempValuemap;
m_filevaluemap = m_tempFilevaluemap;
m_lastVarName.clear();
return true;
}
......@@ -702,8 +714,8 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
if (varName == QLatin1String("TARGET")
&& m_lineNo == m_prevLineNo
&& currentProFile() == m_prevProFile) {
QStringList targets = m_valuemap.value(QLatin1String("TARGET"));
m_valuemap.remove(QLatin1String("TARGET"));
QStringList targets = m_tempValuemap.value(QLatin1String("TARGET"));
m_tempValuemap.remove(QLatin1String("TARGET"));
QStringList lastTarget(targets.takeLast());
lastTarget << v.join(QLatin1String(" "));
targets.push_back(lastTarget.join(QLatin1String(" ")));
......@@ -740,25 +752,30 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
case ProVariable::SetOperator: // =
if (!m_cumulative) {
if (!m_skipLevel) {
m_valuemap[varName] = v;
m_filevaluemap[currentProFile()][varName] = v;
if (m_isFirstVariableValue) {
m_tempValuemap[varName] = v;
m_tempFilevaluemap[currentProFile()][varName] = v;
} else { // handle lines "CONFIG = foo bar"
m_tempValuemap[varName] += v;
m_tempFilevaluemap[currentProFile()][varName] += v;
}
}
} else {
// We are greedy for values.
m_valuemap[varName] += v;
m_filevaluemap[currentProFile()][varName] += v;
m_tempValuemap[varName] += v;
m_tempFilevaluemap[currentProFile()][varName] += v;
}
break;
case ProVariable::UniqueAddOperator: // *=
if (!m_skipLevel || m_cumulative) {
insertUnique(&m_valuemap, varName, v);
insertUnique(&m_filevaluemap[currentProFile()], varName, v);
insertUnique(&m_tempValuemap, varName, v);
insertUnique(&m_tempFilevaluemap[currentProFile()], varName, v);
}
break;
case ProVariable::AddOperator: // +=
if (!m_skipLevel || m_cumulative) {
m_valuemap[varName] += v;
m_filevaluemap[currentProFile()][varName] += v;
m_tempValuemap[varName] += v;
m_tempFilevaluemap[currentProFile()][varName] += v;
}
break;
case ProVariable::RemoveOperator: // -=
......@@ -766,16 +783,16 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
if (!m_skipLevel) {
// the insertUnique is a hack for the moment to fix the
// CONFIG -= app_bundle problem on Mac (add it to a variable -CONFIG as was done before)
if (removeEach(&m_valuemap, varName, v) == 0)
insertUnique(&m_valuemap, QString("-%1").arg(varName), v);
if (removeEach(&m_filevaluemap[currentProFile()], varName, v) == 0)
insertUnique(&m_filevaluemap[currentProFile()], QString("-%1").arg(varName), v);
if (removeEach(&m_tempValuemap, varName, v) == 0)
insertUnique(&m_tempValuemap, QString("-%1").arg(varName), v);
if (removeEach(&m_tempFilevaluemap[currentProFile()], varName, v) == 0)
insertUnique(&m_tempFilevaluemap[currentProFile()], QString("-%1").arg(varName), v);
}
} else if (!m_skipLevel) {
// the insertUnique is a hack for the moment to fix the
// CONFIG -= app_bundle problem on Mac (add it to a variable -CONFIG as was done before)
insertUnique(&m_valuemap, QString("-%1").arg(varName), v);
insertUnique(&m_filevaluemap[currentProFile()], QString("-%1").arg(varName), v);
insertUnique(&m_tempValuemap, QString("-%1").arg(varName), v);
insertUnique(&m_tempFilevaluemap[currentProFile()], QString("-%1").arg(varName), v);
} else {
// We are stingy with our values, too.
}
......@@ -812,13 +829,14 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
if (!m_skipLevel || m_cumulative) {
// We could make a union of modified and unmodified values,
// but this will break just as much as it fixes, so leave it as is.
replaceInList(&m_valuemap[varName], regexp, replace, global);
replaceInList(&m_filevaluemap[currentProFile()][varName], regexp, replace, global);
replaceInList(&m_tempValuemap[varName], regexp, replace, global);
replaceInList(&m_tempFilevaluemap[currentProFile()][varName], regexp, replace, global);
}
}
break;
}
m_isFirstVariableValue = false;
return true;
}
......
#include <PreprocessorEnvironment.h>
#include <PreprocessorClient.h>
#include <pp.h>
#include <QFile>
#include <iostream>
using namespace CPlusPlus;
int main()
{
Client *client = 0;
Environment env;
Preprocessor preprocess(client, &env);
QFile in;
if (! in.open(stdin, QFile::ReadOnly))
return 0;
const QByteArray source = in.readAll();
const QByteArray preprocessedCode = preprocess("<stdin>", source);
std::cout << preprocessedCode.constData();
return 0;
}
QT = core
macx:CONFIG -= app_bundle
TARGET = pp
include(../../../src/libs/cplusplus/cplusplus-lib.pri)
# Input
SOURCES += main.cpp
unix {
debug:OBJECTS_DIR = $${OUT_PWD}/.obj/debug-shared
release:OBJECTS_DIR = $${OUT_PWD}/.obj/release-shared
debug:MOC_DIR = $${OUT_PWD}/.moc/debug-shared
release:MOC_DIR = $${OUT_PWD}/.moc/release-shared
RCC_DIR = $${OUT_PWD}/.rcc/
UI_DIR = $${OUT_PWD}/.uic/
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment