Commit a91a7e40 authored by hjk's avatar hjk

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

parents a331218e 3670b1a4
......@@ -73,7 +73,12 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
}
QStringList xtermArgs;
xtermArgs << "-e" << (QCoreApplication::applicationDirPath() + "/qtcreator_process_stub")
xtermArgs << "-e"
#ifdef Q_OS_MAC
<< (QCoreApplication::applicationDirPath() + "/../Resources/qtcreator_process_stub")
#else
<< (QCoreApplication::applicationDirPath() + "/qtcreator_process_stub")
#endif
<< (m_debug ? "debug" : "exec")
<< m_stubServer.fullServerName()
<< tr("Press <RETURN> to close this window...")
......
IDE_BUILD_TREE=../../../
include(../../qworkbench.pri)
TEMPLATE = app
TARGET = qtcreator_process_stub
DESTDIR = ../../../bin
macx {
DESTDIR = $$IDE_BUILD_TREE/bin/$${IDE_APP_TARGET}.app/Contents/Resources
} else {
DESTDIR = ../../../bin
}
CONFIG += warn_on console use_c_linker
CONFIG -= qt app_bundle
......
......@@ -174,7 +174,7 @@ int main()
the Windows kernel runs amok when we attempt this.
So instead we start a debugged process, eat all the initial
debug events, suspend the process and detach from it. If gdb
tries to attach *now*, everthing goes smoothly. Yay. */
tries to attach *now*, everything goes smoothly. Yay. */
if (creationFlags & DEBUG_ONLY_THIS_PROCESS) {
do {
if (!WaitForDebugEvent (&dbev, INFINITE))
......
......@@ -38,9 +38,6 @@
#endif
#include "designerconstants.h"
#if QT_VERSION < 0x040500
# include "settings.h"
#endif
#include <coreplugin/icore.h>
#include <coreplugin/mimedatabase.h>
......
......@@ -173,7 +173,10 @@ FormEditorW::FormEditorW() :
m_core(Core::ICore::instance()),
m_initStage(RegisterPlugins),
m_actionGroupEditMode(0),
m_actionPrint(0)
m_actionPrint(0),
m_actionPreview(0),
m_actionGroupPreviewInStyle(0),
m_actionAboutPlugins(0)
{
if (Designer::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO;
......@@ -250,10 +253,14 @@ void FormEditorW::fullInit()
}
}
if (m_actionAboutPlugins)
m_actionAboutPlugins->setEnabled(true);
if (Designer::Constants::Internal::debug) {
qDebug() << Q_FUNC_INFO << initTime->elapsed() << "ms";
delete initTime;
}
m_initStage = FullyInitialized;
}
......@@ -439,6 +446,15 @@ void FormEditorW::setupActions()
QAction *actionFormSettings = m_fwm->actionShowFormWindowSettingsDialog();
addToolAction(actionFormSettings, am, globalcontext, QLatin1String("FormEditor.FormSettings"), mformtools);
#if QT_VERSION > 0x040500
createSeparator(this, am, globalcontext, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator4"));
m_actionAboutPlugins = new QAction(tr("About Qt Designer plugins...."), this);
addToolAction(m_actionAboutPlugins, am, globalcontext,
QLatin1String("FormEditor.AboutPlugins"), mformtools);
connect(m_actionAboutPlugins, SIGNAL(triggered()), m_fwm, SLOT(aboutPlugins()));
m_actionAboutPlugins->setEnabled(false);
#endif
// FWM
connect(m_fwm, SIGNAL(activeFormWindowChanged(QDesignerFormWindowInterface *)), this, SLOT(activeFormWindowChanged(QDesignerFormWindowInterface *)));
}
......
......@@ -157,6 +157,7 @@ private:
QAction *m_actionPrint;
QAction *m_actionPreview;
QActionGroup *m_actionGroupPreviewInStyle;
QAction *m_actionAboutPlugins;
QList<int> m_context;
......
......@@ -1121,7 +1121,7 @@ void ProjectExplorerPlugin::setCurrent(Project *project, QString filePath, Node
if (node)
filePath = node->path();
else
node = m_session->nodeForFile(filePath);
node = m_session->nodeForFile(filePath, project);
Core::ICore *core = Core::ICore::instance();
......
......@@ -65,10 +65,9 @@ ProjectWindow::ProjectWindow(QWidget *parent) : QWidget(parent)
m_projectExplorer = ProjectExplorerPlugin::instance();
m_session = m_projectExplorer->session();
connect(m_session, SIGNAL(sessionLoaded()), this, SLOT(restoreStatus()));
connect(m_session, SIGNAL(aboutToSaveSession()), this, SLOT(saveStatus()));
m_treeWidget = new QTreeWidget(this);
m_treeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
m_treeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
m_treeWidget->setFrameStyle(QFrame::NoFrame);
m_treeWidget->setRootIsDecorated(false);
m_treeWidget->header()->setResizeMode(QHeaderView::ResizeToContents);
......@@ -79,7 +78,7 @@ ProjectWindow::ProjectWindow(QWidget *parent) : QWidget(parent)
);
connect(m_treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
this, SLOT(handleItem(QTreeWidgetItem*, int)), Qt::QueuedConnection);
this, SLOT(handleItem(QTreeWidgetItem*, int)));
connect(m_treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem *)),
this, SLOT(handleCurrentItemChanged(QTreeWidgetItem*)));
......@@ -116,10 +115,14 @@ ProjectWindow::ProjectWindow(QWidget *parent) : QWidget(parent)
topLayout->setSpacing(0);
topLayout->addWidget(splitter);
connect(m_session, SIGNAL(sessionLoaded()), this, SLOT(updateTreeWidget()));
connect(m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), this, SLOT(updateTreeWidget()));
connect(m_session, SIGNAL(projectAdded(ProjectExplorer::Project*)), this, SLOT(updateTreeWidget()));
connect(m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)), this, SLOT(updateTreeWidget()));
connect(m_session, SIGNAL(sessionLoaded()), this, SLOT(restoreStatus()));
connect(m_session, SIGNAL(aboutToSaveSession()), this, SLOT(saveStatus()));
connect(m_session, SIGNAL(startupProjectChanged(ProjectExplorer::Project*)), this, SLOT(updateTreeWidgetStatupProjectChanged(ProjectExplorer::Project*)));
connect(m_session, SIGNAL(projectAdded(ProjectExplorer::Project*)), this, SLOT(updateTreeWidgetProjectAdded(ProjectExplorer::Project*)));
connect(m_session, SIGNAL(projectRemoved(ProjectExplorer::Project*)), this, SLOT(updateTreeWidgetProjectRemoved(ProjectExplorer::Project*)));
connect(m_session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)), this, SLOT(updateTreeWidgetAboutToRemoveProject(ProjectExplorer::Project*)));
}
ProjectWindow::~ProjectWindow()
......@@ -128,12 +131,21 @@ ProjectWindow::~ProjectWindow()
void ProjectWindow::restoreStatus()
{
m_panelsTabWidget->setFocus();
if (!m_treeWidget->currentItem() && m_treeWidget->topLevelItemCount()) {
m_treeWidget->setCurrentItem(m_treeWidget->topLevelItem(0), 0, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
}
const QVariant lastPanel = m_session->value(QLatin1String("ProjectWindow/Panel"));
if (lastPanel.isValid()) {
const int index = lastPanel.toInt();
if (index < m_panelsTabWidget->count())
m_panelsTabWidget->setCurrentIndex(index);
}
if ((m_panelsTabWidget->currentIndex() == -1) && m_panelsTabWidget->count())
m_panelsTabWidget->setCurrentIndex(0);
}
void ProjectWindow::saveStatus()
......@@ -172,52 +184,69 @@ void ProjectWindow::showProperties(ProjectExplorer::Project *project, const QMod
}
}
void ProjectWindow::updateTreeWidget()
void ProjectWindow::updateTreeWidgetStatupProjectChanged(ProjectExplorer::Project *startupProject)
{
// This setFocus prevents a crash, which I (daniel) spend the better part of a day tracking down.
// To explain: Consider the case that a widget on either the build or run settings has Focus
// Us clearing the m_treewidget will emit a currentItemChanged(0) signal
// Which is connected to showProperties
// showProperties will now remove the widget that has focus from m_panelsTabWidget, so the treewidget
// gets focus, which will in focusIn select the first entry (due to QTreeWidget::clear() implementation,
// there are still items in the model) which emits another currentItemChanged() signal
// That one runs fully thorough and deletes all widgets, even that one that we are currently removing
// from m_panelsTabWidget.
// To prevent that, we simply prevent the focus switching....
QWidget *focusWidget = qApp->focusWidget();
while (focusWidget) {
if (focusWidget == this) {
m_treeWidget->setFocus();
break;
int count = m_treeWidget->topLevelItemCount();
for (int i = 0; i < count; ++i) {
QTreeWidgetItem *item = m_treeWidget->topLevelItem(i);
if (Project *project = findProject(item->text(2))) {
bool checked = (startupProject == project);
if (item->checkState(1) != (checked ? Qt::Checked : Qt::Unchecked))
item->setCheckState(1, checked ? Qt::Checked : Qt::Unchecked);
} else {
item->setCheckState(1, Qt::Unchecked);
}
focusWidget = focusWidget->parentWidget();
}
m_treeWidget->clear();
}
foreach(Project *project, m_session->projects()) {
const QFileInfo fileInfo(project->file()->fileName());
void ProjectWindow::updateTreeWidgetProjectAdded(ProjectExplorer::Project *projectAdded)
{
int position = m_session->projects().indexOf(projectAdded);
const QFileInfo fileInfo(projectAdded->file()->fileName());
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, fileInfo.baseName());
item->setIcon(0, Core::FileIconProvider::instance()->icon(fileInfo));
item->setText(2, fileInfo.filePath());
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, fileInfo.baseName());
item->setIcon(0, Core::FileIconProvider::instance()->icon(fileInfo));
item->setText(2, fileInfo.filePath());
if (project->isApplication()) {
bool checked = (m_session->startupProject() == project);
item->setCheckState(1, checked ? Qt::Checked : Qt::Unchecked);
}
if (projectAdded->isApplication()) {
bool checked = (m_session->startupProject() == projectAdded);
item->setCheckState(1, checked ? Qt::Checked : Qt::Unchecked);
}
m_treeWidget->addTopLevelItem(item);
m_treeWidget->insertTopLevelItem(position, item);
}
void ProjectWindow::updateTreeWidgetAboutToRemoveProject(ProjectExplorer::Project *projectRemoved) {
int count = m_treeWidget->topLevelItemCount();
for (int i = 0; i < count; ++i) {
QTreeWidgetItem *item = m_treeWidget->topLevelItem(i);
if (item->text(2) == QFileInfo(projectRemoved->file()->fileName()).filePath()) {
if (m_treeWidget->currentItem() == item) {
m_treeWidget->setCurrentItem(0);
}
}
}
}
void ProjectWindow::updateTreeWidgetProjectRemoved(ProjectExplorer::Project *projectRemoved)
{
int count = m_treeWidget->topLevelItemCount();
for (int i = 0; i < count; ++i) {
QTreeWidgetItem *item = m_treeWidget->topLevelItem(i);
if (item->text(2) == QFileInfo(projectRemoved->file()->fileName()).filePath()) {
QTreeWidgetItem *it = m_treeWidget->takeTopLevelItem(i);
delete it;
break;
}
}
}
Project *ProjectWindow::findProject(const QString &path) const
{
QList<Project*> projects = m_session->projects();
foreach (Project* project, projects)
if (project->file()->fileName() == path)
if (QFileInfo(project->file()->fileName()).filePath() == path)
return project;
return 0;
}
......@@ -232,22 +261,26 @@ void ProjectWindow::handleCurrentItemChanged(QTreeWidgetItem *current)
showProperties(project, QModelIndex());
return;
}
} else {
showProperties(0, QModelIndex());
}
}
void ProjectWindow::handleItem(QTreeWidgetItem *item, int column)
{
if (!item || column != 1) // startup project
return;
const QString path = item->text(2);
Project *project = findProject(path);
if (project && project->isApplication()) {
if (!(item->checkState(1) == Qt::Checked)) {
item->setCheckState(1, Qt::Checked); // uncheck not supported
} else {
if (!(item->checkState(1) == Qt::Checked)) { // is now unchecked
if (m_session->startupProject() == project) {
item->setCheckState(1, Qt::Checked); // uncheck not supported
}
} else { // is now checked
m_session->setStartupProject(project);
}
}
......
......@@ -62,6 +62,12 @@ private slots:
void saveStatus();
void updateTreeWidget();
void updateTreeWidgetStatupProjectChanged(ProjectExplorer::Project *startupProject);
void updateTreeWidgetProjectAdded(ProjectExplorer::Project *addedProject);
void updateTreeWidgetProjectRemoved(ProjectExplorer::Project *removedProject);
void updateTreeWidgetAboutToRemoveProject(ProjectExplorer::Project *removedProject);
void handleItem(QTreeWidgetItem *item, int column);
void handleCurrentItemChanged(QTreeWidgetItem *);
......
......@@ -826,10 +826,12 @@ Project *SessionManager::projectForNode(Node *node) const
return project;
}
Node *SessionManager::nodeForFile(const QString &fileName) const
Node *SessionManager::nodeForFile(const QString &fileName, Project *project) const
{
Node *node = 0;
if (Project *project = projectForFile(fileName)) {
if (!project)
project = projectForFile(fileName);
if (project) {
FindNodesForFileVisitor findNodes(fileName);
project->rootProjectNode()->accept(&findNodes);
......
......@@ -144,7 +144,7 @@ public:
SessionNode *sessionNode() const;
Project *projectForNode(ProjectExplorer::Node *node) const;
Node *nodeForFile(const QString &fileName) const;
Node *nodeForFile(const QString &fileName, Project *project = 0) const;
Project *projectForFile(const QString &fileName) const;
......
......@@ -299,7 +299,7 @@ void Qt4RunConfiguration::updateCachedValues()
}
#if defined (Q_OS_MAC)
if (!reader->values("-CONFIG").contains("app_bundle")) {
if (reader->values("CONFIG").contains("app_bundle")) {
destDir += QLatin1Char('/')
+ "${QMAKE_TARGET}"
+ QLatin1String(".app/Contents/MacOS");
......
......@@ -781,18 +781,9 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
case ProVariable::RemoveOperator: // -=
if (!m_cumulative) {
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_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);
removeEach(&m_tempValuemap, varName, v);
removeEach(&m_tempFilevaluemap[currentProFile()], 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_tempValuemap, QString("-%1").arg(varName), v);
insertUnique(&m_tempFilevaluemap[currentProFile()], QString("-%1").arg(varName), v);
} else {
// We are stingy with our values, too.
}
......@@ -987,11 +978,9 @@ QString ProFileEvaluator::Private::currentDirectory() const
QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &str)
{
bool fOK;
bool *ok = &fOK;
QStringList ret;
if (ok)
*ok = true;
// if (ok)
// *ok = true;
if (str.isEmpty())
return ret;
......@@ -1007,7 +996,10 @@ QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &s
const ushort DOT = '.';
const ushort SPACE = ' ';
const ushort TAB = '\t';
const ushort SINGLEQUOTE = '\'';
const ushort DOUBLEQUOTE = '"';
ushort unicode, quote = 0;
const QChar *str_data = str.data();
const int str_len = str.length();
......@@ -1017,126 +1009,105 @@ QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &s
int replaced = 0;
QString current;
for (int i = 0; i < str_len; ++i) {
ushort c = str_data[i].unicode();
unicode = str_data[i].unicode();
const int start_var = i;
if (c == BACKSLASH) {
bool escape = false;
const char *symbols = "[]{}()$\\";
for (const char *s = symbols; *s; ++s) {
if (str_data[i+1] == (ushort)*s) {
i++;
escape = true;
if (!(replaced++))
current = str.left(start_var);
current.append(str.at(i));
break;
}
}
if (!escape && replaced)
current.append(QChar(c));
continue;
}
if (c == SPACE || c == TAB) {
c = 0;
if (!current.isEmpty()) {
unquote(&current);
ret.append(current);
current.clear();
}
} else if (c == DOLLAR && str_len > i+2) {
c = str_data[++i].unicode();
if (c == DOLLAR) {
if (unicode == DOLLAR && str_len > i+2) {
unicode = str_data[++i].unicode();
if (unicode == DOLLAR) {
term = 0;
var.clear();
args.clear();
enum { VAR, ENVIRON, FUNCTION, PROPERTY } var_type = VAR;
c = str_data[++i].unicode();
if (c == LSQUARE) {
c = str_data[++i].unicode();
unicode = str_data[++i].unicode();
if (unicode == LSQUARE) {
unicode = str_data[++i].unicode();
term = RSQUARE;
var_type = PROPERTY;
} else if (c == LCURLY) {
c = str_data[++i].unicode();
} else if (unicode == LCURLY) {
unicode = str_data[++i].unicode();
var_type = VAR;
term = RCURLY;
} else if (c == LPAREN) {
c = str_data[++i].unicode();
} else if (unicode == LPAREN) {
unicode = str_data[++i].unicode();
var_type = ENVIRON;
term = RPAREN;
}
while (1) {
if (!(c & (0xFF<<8)) &&
c != DOT && c != UNDERSCORE &&
(c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && (c < '0' || c > '9'))
forever {
if (!(unicode & (0xFF<<8)) &&
unicode != DOT && unicode != UNDERSCORE &&
//unicode != SINGLEQUOTE && unicode != DOUBLEQUOTE &&
(unicode < 'a' || unicode > 'z') && (unicode < 'A' || unicode > 'Z') &&
(unicode < '0' || unicode > '9'))
break;
var.append(QChar(c));
var.append(QChar(unicode));
if (++i == str_len)
break;
c = str_data[i].unicode();
unicode = str_data[i].unicode();
// at this point, i points to either the 'term' or 'next' character (which is in unicode)
}
if (var_type == VAR && c == LPAREN) {
if (var_type == VAR && unicode == LPAREN) {
var_type = FUNCTION;
int depth = 0;
while (1) {
forever {
if (++i == str_len)
break;
c = str_data[i].unicode();
if (c == LPAREN) {
unicode = str_data[i].unicode();
if (unicode == LPAREN) {
depth++;
} else if (c == RPAREN) {
} else if (unicode == RPAREN) {
if (!depth)
break;
--depth;
}
args.append(QChar(c));
args.append(QChar(unicode));
}
if (i < str_len-1)
c = str_data[++i].unicode();
if (++i < str_len)
unicode = str_data[i].unicode();
else
c = 0;
unicode = 0;
// at this point i is pointing to the 'next' character (which is in unicode)
// this might actually be a term character since you can do $${func()}
}
if (term) {
if (c != term) {
if (unicode != term) {
q->logMessage(format("Missing %1 terminator [found %2]")
.arg(QChar(term)).arg(QChar(c)));
if (ok)
*ok = false;
.arg(QChar(term))
.arg(unicode ? QString(unicode) : QString::fromLatin1(("end-of-line"))));
// if (ok)
// *ok = false;
return QStringList();
}
c = 0;
} else if (i > str_len-1) {
c = 0;
} else {
// move the 'cursor' back to the last char of the thing we were looking at
--i;
}
// since i never points to the 'next' character, there is no reason for this to be set
unicode = 0;
QStringList replacement;
if (var_type == ENVIRON) {
replacement << QString::fromLocal8Bit(qgetenv(var.toLocal8Bit().constData()));
replacement = split_value_list(QString::fromLocal8Bit(qgetenv(var.toLatin1().constData())));
} else if (var_type == PROPERTY) {
replacement << propertyValue(var);
//if (prop)
// replacement = QStringList(prop->value(var));
} else if (var_type == FUNCTION) {
replacement << evaluateExpandFunction(var, args);
} else if (var_type == VAR) {
replacement += values(var);
replacement = values(var);
}
if (!(replaced++) && start_var)
current = str.left(start_var);
if (!replacement.isEmpty()) {
/* If a list is beteen two strings make sure it expands in such a way
* that the string to the left is prepended to the first string and
* the string to the right is appended to the last string, example:
* LIST = a b c
* V3 = x/$$LIST/f.cpp
* message($$member(V3,0)) # Outputs "x/a"
* message($$member(V3,1)) # Outputs "b"
* message($$member(V3,2)) # Outputs "c/f.cpp"
*/
current.append(replacement.at(0));
for (int i = 1; i < replacement.count(); ++i) {
unquote(&current);
ret.append(current);
current = replacement.at(i);
if (quote) {
current += replacement.join(QString(Option::field_sep));
} else {
current += replacement.takeFirst();
if (!replacement.isEmpty()) {
if (!current.isEmpty())
ret.append(current);
current = replacement.takeLast();
if (!replacement.isEmpty())
ret += replacement;
}
}
}
} else {
......@@ -1144,17 +1115,43 @@ QStringList ProFileEvaluator::Private::expandVariableReferences(const QString &s
current.append(QLatin1Char('$'));
}