forked from qt-creator/qt-creator
Merge branch '1.2' of git@scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
@@ -37,9 +37,8 @@ DATA_DIRS = \
|
||||
FILES += $$files
|
||||
}
|
||||
|
||||
copy2build.target = $$IDE_DATA_PATH
|
||||
copy2build.input = FILES
|
||||
copy2build.output = ${QMAKE_FUNC_FILE_IN_stripSrcDir}
|
||||
copy2build.output = $$IDE_DATA_PATH/${QMAKE_FUNC_FILE_IN_stripSrcDir}
|
||||
isEmpty(vcproj):copy2build.variable_out = PRE_TARGETDEPS
|
||||
copy2build.commands = $$QMAKE_COPY \"${QMAKE_FILE_IN}\" \"${QMAKE_FILE_OUT}\"
|
||||
copy2build.name = COPY ${QMAKE_FILE_IN}
|
||||
|
||||
@@ -23,9 +23,8 @@ CONFIG -= qt
|
||||
QT =
|
||||
LIBS =
|
||||
|
||||
updateqm.target = $$IDE_DATA_PATH/translations
|
||||
updateqm.input = TS_FILES
|
||||
updateqm.output = ${QMAKE_FILE_BASE}.qm
|
||||
updateqm.output = $$IDE_DATA_PATH/translations/${QMAKE_FILE_BASE}.qm
|
||||
isEmpty(vcproj):updateqm.variable_out = PRE_TARGETDEPS
|
||||
updateqm.commands = $$LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT}
|
||||
updateqm.name = LRELEASE ${QMAKE_FILE_IN}
|
||||
|
||||
@@ -499,7 +499,9 @@ void EditorManager::handleContextChange(Core::IContext *context)
|
||||
|
||||
void EditorManager::setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory)
|
||||
{
|
||||
setCurrentView(0);
|
||||
if (editor)
|
||||
setCurrentView(0);
|
||||
|
||||
if (m_d->m_currentEditor == editor)
|
||||
return;
|
||||
if (m_d->m_currentEditor && !ignoreNavigationHistory)
|
||||
@@ -535,7 +537,10 @@ void EditorManager::setCurrentView(Core::Internal::SplitterOrView *view)
|
||||
|
||||
Core::Internal::SplitterOrView *EditorManager::currentView() const
|
||||
{
|
||||
return m_d->m_currentView;
|
||||
SplitterOrView *view = m_d->m_currentView;
|
||||
if (!view)
|
||||
view = m_d->m_splitter->findView(m_d->m_currentEditor);
|
||||
return view;
|
||||
}
|
||||
|
||||
QList<IEditor *> EditorManager::editorsForFileName(const QString &filename) const
|
||||
@@ -555,14 +560,6 @@ IEditor *EditorManager::currentEditor() const
|
||||
}
|
||||
|
||||
|
||||
// SLOT connected to action
|
||||
// since this is potentially called in the event handler of the editor
|
||||
// we simply postpone it with a single shot timer
|
||||
void EditorManager::closeEditor()
|
||||
{
|
||||
closeEditor(m_d->m_currentEditor);
|
||||
}
|
||||
|
||||
void EditorManager::emptyView(Core::Internal::EditorView *view)
|
||||
{
|
||||
if (!view)
|
||||
@@ -619,13 +616,6 @@ void EditorManager::closeView(Core::Internal::EditorView *view)
|
||||
updateEditorHistory();
|
||||
}
|
||||
|
||||
void EditorManager::closeEditor(Core::IEditor *editor)
|
||||
{
|
||||
if (!editor)
|
||||
return;
|
||||
closeEditors(QList<IEditor *>() << editor);
|
||||
}
|
||||
|
||||
QList<IEditor*>
|
||||
EditorManager::editorsForFiles(QList<IFile*> files) const
|
||||
{
|
||||
@@ -674,10 +664,39 @@ void EditorManager::closeOtherEditors()
|
||||
closeEditors(editors, true);
|
||||
}
|
||||
|
||||
|
||||
// SLOT connected to action
|
||||
// since this is potentially called in the event handler of the editor
|
||||
// we simply postpone it with a single shot timer
|
||||
void EditorManager::closeEditor()
|
||||
{
|
||||
closeEditor(m_d->m_currentEditor);
|
||||
}
|
||||
|
||||
void EditorManager::closeEditor(Core::IEditor *editor)
|
||||
{
|
||||
if (!editor)
|
||||
return;
|
||||
closeEditors(QList<IEditor *>() << editor);
|
||||
}
|
||||
|
||||
void EditorManager::closeEditor(const QModelIndex &index)
|
||||
{
|
||||
IEditor *editor = index.data(Qt::UserRole).value<Core::IEditor*>();
|
||||
if (editor)
|
||||
closeEditor(editor);
|
||||
else
|
||||
m_d->m_editorModel->removeEditor(index);
|
||||
}
|
||||
|
||||
|
||||
bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askAboutModifiedEditors)
|
||||
{
|
||||
if (editorsToClose.isEmpty())
|
||||
return true;
|
||||
|
||||
SplitterOrView *currentSplitterOrView = currentView();
|
||||
|
||||
bool closingFailed = false;
|
||||
QList<IEditor*> acceptedEditors;
|
||||
//ask all core listeners to check whether the editor can be closed
|
||||
@@ -719,8 +738,7 @@ bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askA
|
||||
foreach(IEditor *editor, acceptedEditors)
|
||||
acceptedEditors += m_d->m_editorModel->duplicatesFor(editor);
|
||||
|
||||
QList<EditorView*> currentViews;
|
||||
EditorView *currentView = 0;
|
||||
QList<EditorView*> closedViews;
|
||||
|
||||
// remove the editors
|
||||
foreach (IEditor *editor, acceptedEditors) {
|
||||
@@ -733,39 +751,22 @@ bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askA
|
||||
|
||||
removeEditor(editor);
|
||||
if (SplitterOrView *view = m_d->m_splitter->findView(editor)) {
|
||||
if (editor == view->view()->currentEditor()) {
|
||||
currentViews += view->view();
|
||||
if (editor == m_d->m_currentEditor)
|
||||
currentView = view->view();
|
||||
}
|
||||
if (editor == view->view()->currentEditor())
|
||||
closedViews += view->view();
|
||||
view->view()->removeEditor(editor);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (EditorView *view, currentViews) {
|
||||
foreach (EditorView *view, closedViews) {
|
||||
IEditor *newCurrent = view->currentEditor();
|
||||
#if 0
|
||||
if (!newCurrent)
|
||||
newCurrent = pickUnusedEditor();
|
||||
if (!newCurrent) {
|
||||
// pick the first one that can be duplicated
|
||||
foreach (IEditor *e, m_d->m_editorHistory) {
|
||||
if (e->duplicateSupported()) {
|
||||
newCurrent = e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (!newCurrent && view == m_d->m_view)
|
||||
newCurrent = pickUnusedEditor();
|
||||
#endif
|
||||
if (newCurrent) {
|
||||
activateEditor(view, newCurrent, NoActivate);
|
||||
} else {
|
||||
QModelIndex idx = m_d->m_editorModel->firstRestoredEditor();
|
||||
if (idx.isValid())
|
||||
activateEditor(idx, view);
|
||||
activateEditor(idx, view, NoActivate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -775,17 +776,60 @@ bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askA
|
||||
delete editor;
|
||||
}
|
||||
|
||||
if (currentView) {
|
||||
setCurrentView(m_d->m_splitter->findView(currentView));
|
||||
if (IEditor *e = currentView->currentEditor())
|
||||
activateEditor(currentView, e);
|
||||
else
|
||||
emit currentEditorChanged(0);
|
||||
if (currentSplitterOrView) {
|
||||
if (IEditor *editor = currentSplitterOrView->editor())
|
||||
activateEditor(currentSplitterOrView->view(), editor);
|
||||
}
|
||||
|
||||
if (!currentEditor())
|
||||
emit currentEditorChanged(0);
|
||||
|
||||
return !closingFailed;
|
||||
}
|
||||
|
||||
void EditorManager::closeDuplicate(Core::IEditor *editor)
|
||||
{
|
||||
|
||||
IEditor *original = editor;
|
||||
if (m_d->m_editorModel->isDuplicate(editor))
|
||||
original= m_d->m_editorModel->originalForDuplicate(editor);
|
||||
QList<IEditor *> duplicates = m_d->m_editorModel->duplicatesFor(original);
|
||||
|
||||
if (duplicates.isEmpty()) {
|
||||
closeEditor(editor);
|
||||
return;
|
||||
}
|
||||
|
||||
if (original== editor)
|
||||
m_d->m_editorModel->makeOriginal(duplicates.first());
|
||||
|
||||
SplitterOrView *currentSplitterOrView = currentView();
|
||||
|
||||
emit editorAboutToClose(editor);
|
||||
|
||||
EditorView *view = m_d->m_splitter->findView(editor)->view();
|
||||
removeEditor(editor);
|
||||
view->removeEditor(editor);
|
||||
|
||||
IEditor *newCurrent = view->currentEditor();
|
||||
if (!newCurrent)
|
||||
newCurrent = pickUnusedEditor();
|
||||
if (newCurrent) {
|
||||
activateEditor(view, newCurrent, NoActivate);
|
||||
} else {
|
||||
QModelIndex idx = m_d->m_editorModel->firstRestoredEditor();
|
||||
if (idx.isValid())
|
||||
activateEditor(idx, view, NoActivate);
|
||||
}
|
||||
|
||||
emit editorsClosed(QList<IEditor*>() << editor);
|
||||
delete editor;
|
||||
if (currentSplitterOrView) {
|
||||
if (IEditor *currentEditor = currentSplitterOrView->editor())
|
||||
activateEditor(currentSplitterOrView->view(), currentEditor);
|
||||
}
|
||||
}
|
||||
|
||||
IEditor *EditorManager::pickUnusedEditor() const
|
||||
{
|
||||
foreach (IEditor *editor, m_d->m_editorHistory) {
|
||||
@@ -797,65 +841,19 @@ IEditor *EditorManager::pickUnusedEditor() const
|
||||
}
|
||||
|
||||
|
||||
void EditorManager::closeEditor(const QModelIndex &index)
|
||||
{
|
||||
IEditor *editor = index.data(Qt::UserRole).value<Core::IEditor*>();
|
||||
if (editor)
|
||||
closeEditor(editor);
|
||||
else
|
||||
m_d->m_editorModel->removeEditor(index);
|
||||
}
|
||||
|
||||
void EditorManager::activateEditor(const QModelIndex &index, Internal::EditorView *view)
|
||||
void EditorManager::activateEditor(const QModelIndex &index, Internal::EditorView *view, OpenEditorFlags flags)
|
||||
{
|
||||
IEditor *editor = index.data(Qt::UserRole).value<IEditor*>();
|
||||
if (editor) {
|
||||
if (view)
|
||||
activateEditor(view, editor);
|
||||
else
|
||||
activateEditor(editor);
|
||||
activateEditor(view, editor, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
if (view)
|
||||
setCurrentView(m_d->m_splitter->findView(view));
|
||||
|
||||
QString fileName = index.data(Qt::UserRole + 1).toString();
|
||||
QByteArray kind = index.data(Qt::UserRole + 2).toByteArray();
|
||||
openEditor(fileName, kind);
|
||||
}
|
||||
|
||||
void EditorManager::activateEditor(IEditor *editor, OpenEditorFlags flags)
|
||||
{
|
||||
SplitterOrView *splitterOrView = m_d->m_currentView;
|
||||
if (splitterOrView && splitterOrView->splitter())
|
||||
splitterOrView = 0; // safety if currentView gets out of sync
|
||||
setCurrentView(0);
|
||||
if (!editor)
|
||||
return;
|
||||
|
||||
SplitterOrView *place = m_d->m_splitter->findView(editor);
|
||||
if (place && !place->isSplitter()) {
|
||||
splitterOrView = place;
|
||||
}
|
||||
|
||||
|
||||
if (!splitterOrView)
|
||||
splitterOrView = m_d->m_splitter->findEmptyView();
|
||||
|
||||
if (!splitterOrView && m_d->m_currentEditor) {
|
||||
splitterOrView = m_d->m_splitter->findView(m_d->m_currentEditor);
|
||||
if (splitterOrView && !splitterOrView->isVisible()) // safety if currentEditor gets out of sync
|
||||
splitterOrView = 0;
|
||||
}
|
||||
|
||||
if (!splitterOrView)
|
||||
splitterOrView = m_d->m_splitter->findFirstView();
|
||||
if (!splitterOrView) {
|
||||
splitterOrView = m_d->m_splitter;
|
||||
}
|
||||
|
||||
activateEditor(splitterOrView->view(), editor, flags);
|
||||
openEditor(fileName, kind, flags);
|
||||
}
|
||||
|
||||
Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core::IEditor *editor)
|
||||
@@ -868,13 +866,11 @@ Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core
|
||||
sourceView->view()->removeEditor(editor);
|
||||
view->addEditor(editor);
|
||||
view->setCurrentEditor(editor);
|
||||
#if 0
|
||||
if (!sourceView->editor()) {
|
||||
if (IEditor *replacement = pickUnusedEditor()) {
|
||||
sourceView->view()->addEditor(replacement);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return editor;
|
||||
} else if (duplicateSupported) {
|
||||
editor = duplicateEditor(editor);
|
||||
@@ -887,9 +883,17 @@ Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core
|
||||
return editor;
|
||||
}
|
||||
|
||||
void EditorManager::activateEditor(Core::IEditor *editor, OpenEditorFlags flags)
|
||||
{
|
||||
activateEditor(0, editor, flags);
|
||||
}
|
||||
|
||||
void EditorManager::activateEditor(Core::Internal::EditorView *view, Core::IEditor *editor, OpenEditorFlags flags)
|
||||
{
|
||||
Q_ASSERT(view) ;
|
||||
if (!view)
|
||||
view = currentView()->view();
|
||||
|
||||
Q_ASSERT(view);
|
||||
|
||||
if (!editor && !m_d->m_currentEditor) {
|
||||
setCurrentEditor(0, (flags & IgnoreNavigationHistory));
|
||||
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
QList<IEditor*> openedEditors() const;
|
||||
|
||||
Internal::EditorModel *openedEditorsModel() const;
|
||||
void activateEditor(const QModelIndex &index, Internal::EditorView *view = 0);
|
||||
void activateEditor(const QModelIndex &index, Internal::EditorView *view = 0, OpenEditorFlags = 0);
|
||||
void closeEditor(const QModelIndex &index);
|
||||
|
||||
|
||||
@@ -235,9 +235,10 @@ private:
|
||||
Core::IEditor *duplicateEditor(IEditor *editor);
|
||||
void setCurrentEditor(IEditor *editor, bool ignoreNavigationHistory = false);
|
||||
void setCurrentView(Core::Internal::SplitterOrView *view);
|
||||
Core::Internal::SplitterOrView *currentView() const;
|
||||
void activateEditor(Core::Internal::EditorView *view, Core::IEditor *editor, OpenEditorFlags flags = 0);
|
||||
Core::Internal::SplitterOrView *currentView() const;
|
||||
void closeEditor(Core::IEditor *editor);
|
||||
void closeDuplicate(Core::IEditor *editor);
|
||||
void closeView(Core::Internal::EditorView *view);
|
||||
void emptyView(Core::Internal::EditorView *view);
|
||||
Core::Internal::EditorView *currentEditorView();
|
||||
|
||||
@@ -571,12 +571,9 @@ bool EditorView::hasEditor(IEditor *editor) const
|
||||
void EditorView::closeView()
|
||||
{
|
||||
EditorManager *em = CoreImpl::instance()->editorManager();
|
||||
#if 1
|
||||
if (IEditor *editor = currentEditor())
|
||||
em->closeEditor(editor);
|
||||
#else
|
||||
em->closeView(this);
|
||||
#endif
|
||||
if (IEditor *editor = currentEditor()) {
|
||||
em->closeDuplicate(editor);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorView::removeEditor(IEditor *editor)
|
||||
@@ -943,7 +940,7 @@ void SplitterOrView::split(Qt::Orientation orientation)
|
||||
|
||||
m_view->removeEditor(e);
|
||||
m_splitter->addWidget(new SplitterOrView(e));
|
||||
#if 0
|
||||
#if 1
|
||||
if (e->duplicateSupported()) {
|
||||
Core::IEditor *duplicate = em->duplicateEditor(e);
|
||||
m_splitter->addWidget(new SplitterOrView(duplicate));
|
||||
@@ -967,7 +964,7 @@ void SplitterOrView::split(Qt::Orientation orientation)
|
||||
}
|
||||
|
||||
em->setCurrentView(view);
|
||||
#if 0
|
||||
#if 1
|
||||
if (e)
|
||||
em->activateEditor(e);
|
||||
#endif
|
||||
|
||||
@@ -20,7 +20,6 @@ QToolButton, QPushButton, QComboBox {
|
||||
border-width: 4;
|
||||
padding: 0px 6px;
|
||||
font-size: 12px;
|
||||
font-family: lucida sans, dejavu sans, sans serif;
|
||||
}
|
||||
|
||||
*{
|
||||
@@ -265,7 +264,6 @@ QToolButton:pressed {
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>lucida sans ,dejavu sans ,sans serif</family>
|
||||
<pointsize>-1</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -302,7 +300,6 @@ QToolButton:pressed {
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>lucida sans ,dejavu sans ,sans serif</family>
|
||||
<pointsize>-1</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
@@ -333,7 +330,6 @@ QToolButton:pressed {
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>lucida sans ,dejavu sans ,sans serif</family>
|
||||
<pointsize>-1</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
|
||||
@@ -114,15 +114,14 @@ bool FormClassWizardParameters::generateCpp(QString *header, QString *source, in
|
||||
headerStr << ", private " << uiClassName;
|
||||
}
|
||||
headerStr << " {\n" << namespaceIndent << indent << "Q_OBJECT\n"
|
||||
<< namespaceIndent << indent << "Q_DISABLE_COPY(" << unqualifiedClassName << ")\n"
|
||||
<< namespaceIndent << "public:\n"
|
||||
<< namespaceIndent << indent << "explicit " << unqualifiedClassName << "(QWidget *parent = 0);\n";
|
||||
<< namespaceIndent << indent << unqualifiedClassName << "(QWidget *parent = 0);\n";
|
||||
if (embedding == PointerAggregatedUiClass)
|
||||
headerStr << namespaceIndent << indent << "virtual ~" << unqualifiedClassName << "();\n";
|
||||
headerStr << namespaceIndent << indent << "~" << unqualifiedClassName << "();\n";
|
||||
// retranslation
|
||||
if (languageChange)
|
||||
headerStr << '\n' << namespaceIndent << "protected:\n"
|
||||
<< namespaceIndent << indent << "virtual void changeEvent(QEvent *e);\n";
|
||||
<< namespaceIndent << indent << "void changeEvent(QEvent *e);\n";
|
||||
// Member variable
|
||||
if (embedding != InheritedUiClass) {
|
||||
headerStr << '\n' << namespaceIndent << "private:\n"
|
||||
|
||||
@@ -349,7 +349,10 @@ QString FindToolBar::getReplaceText()
|
||||
void FindToolBar::setFindText(const QString &text)
|
||||
{
|
||||
disconnect(m_ui.findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(invokeFindIncremental()));
|
||||
m_ui.findEdit->setText(text);
|
||||
if (hasFindFlag(IFindSupport::FindRegularExpression))
|
||||
m_ui.findEdit->setText(QRegExp::escape(text));
|
||||
else
|
||||
m_ui.findEdit->setText(text);
|
||||
connect(m_ui.findEdit, SIGNAL(textChanged(const QString&)), this, SLOT(invokeFindIncremental()));
|
||||
}
|
||||
|
||||
|
||||
@@ -171,14 +171,11 @@ static QStringList readLines(const QString &absoluteFileName)
|
||||
|
||||
void GenericProject::parseProject(RefreshOptions options)
|
||||
{
|
||||
if (options & Files) {
|
||||
if (options & Files)
|
||||
m_files = convertToAbsoluteFiles(readLines(filesFileName()));
|
||||
m_files.removeDuplicates();
|
||||
}
|
||||
|
||||
if (options & Configuration) {
|
||||
m_projectIncludePaths = readLines(includesFileName());
|
||||
m_projectIncludePaths.removeDuplicates();
|
||||
m_projectIncludePaths = convertToAbsoluteFiles(readLines(includesFileName()));
|
||||
|
||||
QSettings projectInfo(m_fileName, QSettings::IniFormat);
|
||||
m_generated = convertToAbsoluteFiles(projectInfo.value(QLatin1String("generated")).toStringList());
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "removefiledialog.h"
|
||||
#include "ui_removefiledialog.h"
|
||||
|
||||
#include <QtCore/QDir>
|
||||
|
||||
using namespace ProjectExplorer::Internal;
|
||||
|
||||
RemoveFileDialog::RemoveFileDialog(const QString &filePath, QWidget *parent) :
|
||||
@@ -37,7 +39,7 @@ RemoveFileDialog::RemoveFileDialog(const QString &filePath, QWidget *parent) :
|
||||
m_ui(new Ui::RemoveFileDialog)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->fileNameLabel->setText(filePath);
|
||||
m_ui->fileNameLabel->setText(QDir::toNativeSeparators(filePath));
|
||||
|
||||
// TODO
|
||||
m_ui->removeVCCheckBox->setVisible(false);
|
||||
|
||||
@@ -113,12 +113,11 @@ void LibraryParameters::generateCode(QtProjectParameters:: Type t,
|
||||
// Is this a QObject (plugin)
|
||||
const bool inheritsQObject = t == QtProjectParameters::Qt4Plugin;
|
||||
if (inheritsQObject) {
|
||||
headerStr << namespaceIndent << indent << "Q_OBJECT\n"
|
||||
<< namespaceIndent << indent << "Q_DISABLE_COPY(" << unqualifiedClassName << ")\n";
|
||||
headerStr << namespaceIndent << indent << "Q_OBJECT\n";
|
||||
}
|
||||
headerStr << namespaceIndent << "public:\n";
|
||||
if (inheritsQObject) {
|
||||
headerStr << namespaceIndent << indent << "explicit " << unqualifiedClassName << "(QObject *parent = 0);\n";
|
||||
headerStr << namespaceIndent << indent << unqualifiedClassName << "(QObject *parent = 0);\n";
|
||||
} else {
|
||||
headerStr << namespaceIndent << indent << unqualifiedClassName << "();\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user