Commit da0e9a58 authored by Roberto Raggi's avatar Roberto Raggi
Browse files

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

parents f6ff04a7 f98b937b
......@@ -10,19 +10,29 @@ git log --pretty=oneline v1.1.0..v1.2.0
This release introduces source and binary incompatible changes to the plugin
API, so if you created your own custom plugins these need to be adapted.
General:
* Reworked Welcome Screen
* Speed improvement: Store large amounts of persistent data
(e.g. locator cache) in an SQLite database.
Editing
* Added option to allow alphabetical method combo box
* Introduced Block highlighting
* Improved code folding markers
* Further improvements to FakeVim mode
* Make it possible to disable Ctrl+Click navigation
* Added optional XCode-style tab indentation
Building and Running
Debugging
* Added Windows Console Debugger support
* Added Windows Console Debugger support (x86 and AMD64)
* Added command line options to attach to process ids
* Further improved dumpers; do additional memory checking on Windows to
avoid crashes for speedup
* Changed method of dumper loading on Windows, enabling it for MinGW 64
* Make it possible to disable breakpoints
Wizards
Designer
......@@ -33,8 +43,30 @@ Version control plugins
* Made svn detection recognize TortoiseSVN using "_svn" as directory
* Fixed perforce configuration checking, made it use the settings correctly
Documentation
* Added tutorial on how to create an application from scratch using Creator
I18N
* Added infrastructure for translations
* Added German translation
Platform Specific
Windows
* Show native path separators
* Experimental support for the Microsoft C++ compilers from Windows SDKs
or VS 2005/2008 (x86 and AMD64)
Mac
Linux
Other Unixes
* Made Qt Creator less dependant on Linux specific defines
Additional credits go to:
* axasia <axasia@gmail.com> (japanese translation)
* Christian Hoenig <christian@hoenig.cc> ("Build Project Only" submenu and build project dependencies, various patches)
* Enrico Ros <enrico.ros@gmail.com> (italian translation)
* Joel Nordell <joel.nordell@chloridepower.com> (XCode-style tab behavior, various patches)
* Serge Ratke <dev.serge.ratke@gmx.de> (copy lines up/down by Ctrl+Alt+Up/Down)
......@@ -136,9 +136,19 @@ QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
else
scopes = resolveNestedNameSpecifier(q, visibleScopes);
// ### expand the scopes.
QList<Scope *> expanded;
foreach (Scope *scope, scopes) {
expanded.append(scope);
for (unsigned i = 0; i < scope->symbolCount(); ++i) {
Symbol *member = scope->symbolAt(i);
if (ScopedSymbol *scopedSymbol = member->asScopedSymbol())
expandEnumOrAnonymousSymbol(scopedSymbol, &expanded);
}
}
return resolve(q->unqualifiedNameId(), scopes, mode);
return resolve(q->unqualifiedNameId(), expanded, mode);
}
QList<Symbol *> LookupContext::resolveOperatorNameId(OperatorNameId *opId,
......@@ -301,6 +311,31 @@ QList<Scope *> LookupContext::visibleScopes(const QPair<FullySpecifiedType, Symb
return scopes;
}
void LookupContext::expandEnumOrAnonymousSymbol(ScopedSymbol *scopedSymbol,
QList<Scope *> *expandedScopes) const
{
if (! scopedSymbol || expandedScopes->contains(scopedSymbol->members()))
return;
Scope *members = scopedSymbol->members();
if (scopedSymbol->isEnum())
expandedScopes->append(members);
else if (! scopedSymbol->name() && (scopedSymbol->isClass() || scopedSymbol->isNamespace())) {
// anonymous class or namespace
expandedScopes->append(members);
for (unsigned i = 0; i < members->symbolCount(); ++i) {
Symbol *member = members->symbolAt(i);
if (ScopedSymbol *nested = member->asScopedSymbol()) {
expandEnumOrAnonymousSymbol(nested, expandedScopes);
}
}
}
}
QList<Scope *> LookupContext::expand(const QList<Scope *> &scopes) const
{
QList<Scope *> expanded;
......
......@@ -114,6 +114,9 @@ public:
const QList<Scope *> &visibleScopes,
QList<Scope *> *expandedScopes) const;
void expandEnumOrAnonymousSymbol(ScopedSymbol *scopedSymbol,
QList<Scope *> *expandedScopes) const;
private:
QList<Symbol *> resolveQualifiedNameId(QualifiedNameId *q,
const QList<Scope *> &visibleScopes,
......
#include "treewidgetcolumnstretcher.h"
#include <QtGui/QTreeWidget>
#include <QtGui/QHideEvent>
#include <QtGui/QHeaderView>
using namespace Core::Utils;
TreeWidgetColumnStretcher::TreeWidgetColumnStretcher(QTreeWidget *treeWidget, int columnToStretch)
: QObject(treeWidget->header()), m_columnToStretch(columnToStretch)
{
parent()->installEventFilter(this);
QHideEvent fake;
TreeWidgetColumnStretcher::eventFilter(parent(), &fake);
}
bool TreeWidgetColumnStretcher::eventFilter(QObject *obj, QEvent *ev)
{
if (obj == parent()) {
if (ev->type() == QEvent::Show) {
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
for (int i = 0; i < hv->count(); ++i)
hv->setResizeMode(i, QHeaderView::Interactive);
} else if (ev->type() == QEvent::Hide) {
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
for (int i = 0; i < hv->count(); ++i)
hv->setResizeMode(i, i == m_columnToStretch ? QHeaderView::Stretch : QHeaderView::ResizeToContents);
} else if (ev->type() == QEvent::Resize) {
QHeaderView *hv = qobject_cast<QHeaderView*>(obj);
if (hv->resizeMode(m_columnToStretch) == QHeaderView::Interactive) {
QResizeEvent *re = static_cast<QResizeEvent*>(ev);
int diff = re->size().width() - re->oldSize().width() ;
hv->resizeSection(m_columnToStretch, qMax(32, hv->sectionSize(1) + diff));
}
}
}
return false;
}
/**************************************************************************
**
** 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 TREEWIDGETCOLUMNSTRETCHER_H
#define TREEWIDGETCOLUMNSTRETCHER_H
#include "utils_global.h"
#include <QObject>
QT_BEGIN_NAMESPACE
class QTreeWidget;
QT_END_NAMESPACE
namespace Core {
namespace Utils {
/*
The class fixes QTreeWidget to resize all columns to contents, except one
stretching column. As opposed to standard QTreeWidget, all columns are
still interactively resizable.
*/
class QTCREATOR_UTILS_EXPORT TreeWidgetColumnStretcher : public QObject
{
int m_columnToStretch;
public:
TreeWidgetColumnStretcher(QTreeWidget *treeWidget, int columnToStretch);
bool eventFilter(QObject *obj, QEvent *ev);
};
} // namespace Utils
} // namespace Core
#endif // TREEWIDGETCOLUMNSTRETCHER_H
TEMPLATE = lib
TARGET = Utils
QT += gui network
QT += gui \
network
DEFINES += QTCREATOR_UTILS_LIBRARY
include(../../qtcreatorlibrary.pri)
SOURCES += \
reloadpromptutils.cpp \
SOURCES += reloadpromptutils.cpp \
settingsutils.cpp \
filesearch.cpp \
pathchooser.cpp \
......@@ -30,19 +27,16 @@ SOURCES += \
submitfieldwidget.cpp \
consoleprocess.cpp \
uncommentselection.cpp \
parameteraction.cpp
win32 {
parameteraction.cpp \
treewidgetcolumnstretcher.cpp
win32 {
SOURCES += abstractprocess_win.cpp \
consoleprocess_win.cpp \
winutils.cpp
consoleprocess_win.cpp \
winutils.cpp
HEADERS += winutils.h
} else {
SOURCES += consoleprocess_unix.cpp
}
HEADERS += \
utils_global.h \
else:SOURCES += consoleprocess_unix.cpp
HEADERS += utils_global.h \
reloadpromptutils.h \
settingsutils.h \
filesearch.h \
......@@ -68,11 +62,10 @@ HEADERS += \
synchronousprocess.h \
submitfieldwidget.h \
uncommentselection.h \
parameteraction.h
parameteraction.h \
treewidgetcolumnstretcher.h
FORMS += filewizardpage.ui \
projectintropage.ui \
newclasswidget.ui \
submiteditorwidget.ui
projectintropage.ui \
newclasswidget.ui \
submiteditorwidget.ui
RESOURCES += utils.qrc
......@@ -278,7 +278,7 @@ public:
QToolBar *toolBar() { return m_toolBar; }
bool temporaryEditor() const { return false; }
bool isTemporary() const { return false; }
signals:
void changed();
......
......@@ -37,6 +37,8 @@
#include "filemanager.h"
#include "icore.h"
#include "uniqueidmanager.h"
#include <utils/treewidgetcolumnstretcher.h>
#include <QtGui/QKeyEvent>
#include <QtGui/QShortcut>
......@@ -111,10 +113,7 @@ QWidget *ShortcutSettings::createPage(QWidget *parent)
this, SLOT(commandChanged(QTreeWidgetItem *)));
connect(m_page->shortcutEdit, SIGNAL(textChanged(QString)), this, SLOT(keyChanged()));
QHeaderView *hv = m_page->commandList->header();
hv->resizeSection(0, 210);
hv->resizeSection(1, 110);
hv->setStretchLastSection(true);
new Core::Utils::TreeWidgetColumnStretcher(m_page->commandList, 1);
commandChanged(0);
......
......@@ -1014,7 +1014,7 @@ void EditorManager::addEditor(IEditor *editor, bool isDuplicate)
m_d->m_editorModel->addEditor(editor, isDuplicate);
if (!isDuplicate) {
m_d->m_core->fileManager()->addFile(editor->file());
if (!editor->temporaryEditor()) {
if (!editor->isTemporary()) {
m_d->m_core->fileManager()->addToRecentFiles(editor->file()->fileName());
}
}
......@@ -1147,17 +1147,21 @@ bool EditorManager::openExternalEditor(const QString &fileName, const QString &e
QStringList EditorManager::getOpenFileNames() const
{
QString dir;
static QString dir = QDir::homePath();
if (m_d->fileFilters.isEmpty())
m_d->fileFilters = formatFileFilters(m_d->m_core, &m_d->selectedFilter);
if (IEditor *curEditor = currentEditor()) {
const QFileInfo fi(curEditor->file()->fileName());
QString currentFile = ICore::instance()->fileManager()->currentFile();
if (!currentFile.isEmpty()) {
const QFileInfo fi(currentFile);
dir = fi.absolutePath();
}
return QFileDialog::getOpenFileNames(m_d->m_core->mainWindow(), tr("Open File"),
QStringList files = QFileDialog::getOpenFileNames(m_d->m_core->mainWindow(), tr("Open File"),
dir, m_d->fileFilters, &m_d->selectedFilter);
if (!files.isEmpty())
dir = QFileInfo(files.at(0)).absolutePath();
return files;
}
void EditorManager::ensureEditorManagerVisible()
......@@ -1281,7 +1285,7 @@ bool EditorManager::saveFile(IEditor *editor)
m_d->m_core->fileManager()->unblockFileChange(file);
}
if (success && !editor->temporaryEditor())
if (success && !editor->isTemporary())
m_d->m_core->fileManager()->addToRecentFiles(editor->file()->fileName());
return success;
......@@ -1376,7 +1380,7 @@ bool EditorManager::saveFileAs(IEditor *editor)
m_d->m_core->fileManager()->unblockFileChange(editor->file());
editor->file()->checkPermissions();
if (success && !editor->temporaryEditor())
if (success && !editor->isTemporary())
m_d->m_core->fileManager()->addToRecentFiles(editor->file()->fileName());
updateActions();
......
......@@ -63,7 +63,7 @@ public:
virtual int currentLine() const { return 0; }
virtual int currentColumn() const { return 0; }
virtual bool temporaryEditor() const = 0;
virtual bool isTemporary() const = 0;
virtual QToolBar *toolBar() = 0;
......
......@@ -897,7 +897,7 @@ bool MainWindow::showOptionsDialog(const QString &category,
void MainWindow::saveAll()
{
m_fileManager->saveModifiedFiles(m_fileManager->modifiedFiles());
m_fileManager->saveModifiedFilesSilently(m_fileManager->modifiedFiles());
emit m_coreImpl->saveSettingsRequested();
}
......
......@@ -40,6 +40,7 @@ ProgressBar::ProgressBar(QWidget *parent)
: QProgressBar(parent), m_error(false)
{
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
setMouseTracking(true);
}
ProgressBar::~ProgressBar()
......@@ -88,6 +89,11 @@ void ProgressBar::mousePressEvent(QMouseEvent *event)
QProgressBar::mousePressEvent(event);
}
void ProgressBar::mouseMoveEvent(QMouseEvent *)
{
update();
}
void ProgressBar::paintEvent(QPaintEvent *)
{
// TODO move font into stylehelper
......@@ -117,13 +123,20 @@ void ProgressBar::paintEvent(QPaintEvent *)
p.setPen(QColor(255, 255, 255, 70));
p.drawLine(0, 1, size().width(), 1);
QRect textRect = rect();
textRect.setHeight(h+5);
p.setPen(QColor(30, 30, 30, 80));
p.drawText(textRect, Qt::AlignHCenter | Qt::AlignBottom, m_title);
p.translate(0, -1);
p.setPen(StyleHelper::panelTextColor());
p.drawText(QPoint(7, h+1), m_title);
p.drawText(textRect, Qt::AlignHCenter | Qt::AlignBottom, m_title);
p.translate(0, 1);
m_progressHeight = h-4;
m_progressHeight += ((m_progressHeight % 2) + 1) % 2; // make odd
// draw outer rect
QRect rect(INDENT, h+6, size().width()-2*INDENT-m_progressHeight+1, m_progressHeight-1);
QRect rect(INDENT - 1, h+6, size().width()-2*INDENT, m_progressHeight-1);
p.setPen(StyleHelper::panelTextColor());
p.drawRect(rect);
......@@ -131,7 +144,7 @@ void ProgressBar::paintEvent(QPaintEvent *)
QColor c = StyleHelper::panelTextColor();
c.setAlpha(180);
p.setPen(Qt::NoPen);
p.setBrush(c);
QRect inner = rect.adjusted(2, 2, -1, -1);
inner.adjust(0, 0, qRound((percent - 1) * inner.width()), 0);
if (m_error) {
......@@ -142,19 +155,34 @@ void ProgressBar::paintEvent(QPaintEvent *)
if (inner.width() < 10)
inner.adjust(0, 0, 10 - inner.width(), 0);
} else if (value() == maximum()) {
QColor green(140, 255, 140, 180);
p.setBrush(green);
c = QColor(120, 245, 90, 180);
}
QLinearGradient grad(inner.topLeft(), inner.bottomLeft());
grad.setColorAt(0, c.lighter(114));
grad.setColorAt(0.5, c.lighter(104));
grad.setColorAt(0.51, c.darker(108));
grad.setColorAt(1, c.darker(120));
p.setBrush(grad);
p.drawRect(inner);
if (value() < maximum() && !m_error) {
// draw cancel thingy
// TODO this is quite ugly at the moment
p.setPen(StyleHelper::panelTextColor());
p.setBrush(QBrush(Qt::NoBrush));
QRect cancelRect(size().width()-INDENT-m_progressHeight+3, h+6+1, m_progressHeight-3, m_progressHeight-3);
QColor cancelOutline = StyleHelper::panelTextColor();
p.setPen(cancelOutline);
QRect cancelRect(rect.right() - m_progressHeight + 2, rect.top(), m_progressHeight-1, rect.height());
if (cancelRect.contains(mapFromGlobal(QCursor::pos())))
p.setBrush(QColor(230, 90, 40, 190));
else
p.setBrush(Qt::NoBrush);
p.drawRect(cancelRect);
p.setPen(c);
p.setPen(QPen(QColor(0, 0, 0, 70), 3));
p.drawLine(cancelRect.center()+QPoint(-1,-1), cancelRect.center()+QPoint(+3,+3));
p.drawLine(cancelRect.center()+QPoint(+3,-1), cancelRect.center()+QPoint(-1,+3));
p.setPen(StyleHelper::panelTextColor());
p.drawLine(cancelRect.center()+QPoint(-1,-1), cancelRect.center()+QPoint(+3,+3));
p.drawLine(cancelRect.center()+QPoint(+3,-1), cancelRect.center()+QPoint(-1,+3));
}
......
......@@ -49,6 +49,7 @@ public:
bool hasError() const;
QSize sizeHint() const;
void paintEvent(QPaintEvent *);
void mouseMoveEvent(QMouseEvent *);
signals:
void clicked();
......
......@@ -890,10 +890,6 @@ void CPPEditor::contextMenuEvent(QContextMenuEvent *e)
foreach (QAction *action, contextMenu->actions())
menu->addAction(action);
QAction *reformatDocument = new QAction(tr("Reformat Document"), menu);
connect(reformatDocument, SIGNAL(triggered()), this, SLOT(reformatDocument()));
menu->addAction(reformatDocument);
menu->exec(e->globalPos());
delete menu;
}
......
......@@ -69,7 +69,7 @@ public:
Core::IEditor *duplicate(QWidget *parent);
const char *kind() const;
bool temporaryEditor() const { return false; }
bool isTemporary() const { return false; }
private:
QList<int> m_context;
......
......@@ -291,6 +291,10 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent)
m_group.insert(theDebuggerAction(MaximalStackDepth),
m_ui.spinBoxMaximalStackDepth);
#ifdef USE_REVERSE_DEBUGGING
m_ui.checkBoxEnableReverseDebugging->hide();
#endif
return w;
}
......@@ -594,6 +598,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
am->actionContainer(ProjectExplorer::Constants::M_DEBUG);
Core::Command *cmd = 0;
cmd = am->registerAction(m_manager->m_continueAction,
ProjectExplorer::Constants::DEBUG, QList<int>() << m_gdbRunningContext);
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
cmd = am->registerAction(m_startExternalAction,
Constants::STARTEXTERNAL, globalcontext);
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
......@@ -605,19 +613,16 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
cmd = am->registerAction(m_attachCoreAction,
Constants::ATTACHCORE, globalcontext);
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
/*
cmd = am->registerAction(m_attachTcfAction,
Constants::ATTACHTCF, globalcontext);
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
*/
cmd = am->registerAction(m_startRemoteAction,
Constants::ATTACHREMOTE, globalcontext);
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
cmd = am->registerAction(m_manager->m_continueAction,
ProjectExplorer::Constants::DEBUG, QList<int>() << m_gdbRunningContext);
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
cmd = am->registerAction(m_detachAction,
Constants::DETACH, globalcontext);
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
......@@ -681,10 +686,12 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
Constants::JUMP_TO_LINE, debuggercontext);
mdebug->addAction(cmd);
#ifdef USE_REVERSE_DEBUGGING
cmd = am->registerAction(m_manager->m_reverseDirectionAction,
Constants::REVERSE, debuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::REVERSE_KEY));
mdebug->addAction(cmd);
#endif
sep = new QAction(this);
sep->setSeparator(true);
......@@ -830,8 +837,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
debugToolBar->addSeparator();
debugToolBar->addAction(am->command(Constants::STEPI)->action());
debugToolBar->addAction(am->command(Constants::NEXTI)->action());
#ifdef USE_REVERSE_DEBUGGING
debugToolBar->addSeparator();
debugToolBar->addAction(am->command(Constants::REVERSE)->action());
#endif
debugToolBar->addSeparator();
debugToolBar->addWidget(new QLabel(tr("Threads:")));
......
......@@ -79,7 +79,7 @@ public:
QToolBar *toolBar();
QByteArray saveState() const;
bool restoreState(const QByteArray &state);
virtual bool temporaryEditor() const { return false; }
virtual bool isTemporary() const { return false; }
// ContextInterface
virtual QList<int> context() const;
......
......@@ -63,7 +63,7 @@ public:
bool duplicateSupported() const { return true; }