forked from qt-creator/qt-creator
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
@@ -40,123 +40,45 @@
|
|||||||
#include <QtGui/QCheckBox>
|
#include <QtGui/QCheckBox>
|
||||||
#include <QtGui/QPushButton>
|
#include <QtGui/QPushButton>
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(Core::IFile*);
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Core::Internal;
|
using namespace Core::Internal;
|
||||||
|
|
||||||
FileItem::FileItem(QTreeWidget *tree, bool supportOpen, bool open, const QString &text)
|
SaveItemsDialog::SaveItemsDialog(QWidget *parent,
|
||||||
: QTreeWidgetItem(tree)
|
QList<IFile *> items)
|
||||||
{
|
: QDialog(parent)
|
||||||
m_saveCheckBox = createCheckBox(tree, 0);
|
|
||||||
m_saveCheckBox->setChecked(true);
|
|
||||||
|
|
||||||
QFileInfo fi(text);
|
|
||||||
QString name = fi.fileName();
|
|
||||||
if (open)
|
|
||||||
name.append(tr(" [ReadOnly]"));
|
|
||||||
|
|
||||||
if (supportOpen) {
|
|
||||||
m_sccCheckBox = createCheckBox(tree, 1);
|
|
||||||
m_sccCheckBox->setEnabled(open);
|
|
||||||
m_sccCheckBox->setChecked(open);
|
|
||||||
connect(m_saveCheckBox, SIGNAL(stateChanged(int)),
|
|
||||||
this, SLOT(updateSCCCheckBox()));
|
|
||||||
setText(2, name);
|
|
||||||
setToolTip(2, text);
|
|
||||||
} else {
|
|
||||||
m_sccCheckBox = 0;
|
|
||||||
setText(2, name);
|
|
||||||
setToolTip(2, text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QCheckBox *FileItem::createCheckBox(QTreeWidget *tree, int column)
|
|
||||||
{
|
|
||||||
QWidget *w = new QWidget();
|
|
||||||
QHBoxLayout *l = new QHBoxLayout(w);
|
|
||||||
l->setMargin(0);
|
|
||||||
l->setSpacing(0);
|
|
||||||
QCheckBox *box = new QCheckBox(w);
|
|
||||||
l->addWidget(box);
|
|
||||||
l->setAlignment(box, Qt::AlignCenter);
|
|
||||||
w->setLayout(l);
|
|
||||||
tree->setItemWidget(this, column, w);
|
|
||||||
return box;
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileItem::updateSCCCheckBox()
|
|
||||||
{
|
|
||||||
if (!m_saveCheckBox->isChecked()) {
|
|
||||||
m_sccCheckBox->setEnabled(false);
|
|
||||||
m_sccCheckBox->setChecked(false);
|
|
||||||
} else {
|
|
||||||
m_sccCheckBox->setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FileItem::shouldBeSaved() const
|
|
||||||
{
|
|
||||||
return m_saveCheckBox->isChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileItem::setShouldBeSaved(bool s)
|
|
||||||
{
|
|
||||||
m_saveCheckBox->setChecked(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FileItem::shouldBeOpened() const
|
|
||||||
{
|
|
||||||
if (m_sccCheckBox)
|
|
||||||
return m_sccCheckBox->isChecked();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SaveItemsDialog::SaveItemsDialog(MainWindow *mainWindow,
|
|
||||||
QMap<IFile*, QString> items)
|
|
||||||
: QDialog(mainWindow)
|
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
QPushButton *uncheckButton = m_ui.buttonBox->addButton(tr("Uncheck All"),
|
QPushButton *discardButton = m_ui.buttonBox->addButton(tr("Don't Save"), QDialogButtonBox::DestructiveRole);
|
||||||
QDialogButtonBox::ActionRole);
|
m_ui.buttonBox->button(QDialogButtonBox::Save)->setDefault(true);
|
||||||
QPushButton *discardButton = m_ui.buttonBox->addButton(tr("Discard All"),
|
m_ui.buttonBox->button(QDialogButtonBox::Save)->setFocus(Qt::TabFocusReason);
|
||||||
QDialogButtonBox::DestructiveRole);
|
m_ui.buttonBox->button(QDialogButtonBox::Save)->setMinimumWidth(130); // bad magic number to avoid resizing of button
|
||||||
m_ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
|
||||||
m_ui.buttonBox->button(QDialogButtonBox::Ok)->setFocus(Qt::TabFocusReason);
|
|
||||||
|
|
||||||
m_ui.treeWidget->header()->setMovable(false);
|
foreach (IFile *file, items) {
|
||||||
m_ui.treeWidget->setRootIsDecorated(false);
|
QString visibleName;
|
||||||
m_ui.treeWidget->setColumnCount(2);
|
QString directory;
|
||||||
|
QString fileName = file->fileName();
|
||||||
QStringList headers;
|
if (fileName.isEmpty()) {
|
||||||
headers << tr("Save") << tr("File Name");
|
visibleName = file->suggestedFileName();
|
||||||
|
} else {
|
||||||
const bool hasVersionControl = true;
|
QFileInfo info = QFileInfo(fileName);
|
||||||
if (hasVersionControl) {
|
directory = info.absolutePath();
|
||||||
m_ui.treeWidget->setColumnCount(3);
|
visibleName = info.fileName();
|
||||||
headers.insert(1, tr("Open with SCC"));
|
|
||||||
}
|
}
|
||||||
m_ui.treeWidget->setHeaderLabels(headers);
|
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.treeWidget, QStringList()
|
||||||
|
<< visibleName << directory);
|
||||||
FileItem *itm;
|
item->setData(0, Qt::UserRole, qVariantFromValue(file));
|
||||||
QMap<IFile*, QString>::const_iterator it = items.constBegin();
|
|
||||||
while (it != items.constEnd()) {
|
|
||||||
QString directory = QFileInfo(it.key()->fileName()).absolutePath();
|
|
||||||
bool fileHasVersionControl = mainWindow->vcsManager()->findVersionControlForDirectory(directory) != 0;
|
|
||||||
itm = new FileItem(m_ui.treeWidget, fileHasVersionControl,
|
|
||||||
it.key()->isReadOnly(), it.value());
|
|
||||||
m_itemMap.insert(itm, it.key());
|
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui.treeWidget->resizeColumnToContents(0);
|
m_ui.treeWidget->resizeColumnToContents(0);
|
||||||
if (hasVersionControl)
|
m_ui.treeWidget->selectAll();
|
||||||
m_ui.treeWidget->resizeColumnToContents(1);
|
updateSaveButton();
|
||||||
|
|
||||||
connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()),
|
connect(m_ui.buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()),
|
||||||
this, SLOT(collectItemsToSave()));
|
this, SLOT(collectItemsToSave()));
|
||||||
connect(uncheckButton, SIGNAL(clicked()), this, SLOT(uncheckAll()));
|
|
||||||
connect(discardButton, SIGNAL(clicked()), this, SLOT(discardAll()));
|
connect(discardButton, SIGNAL(clicked()), this, SLOT(discardAll()));
|
||||||
|
connect(m_ui.treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(updateSaveButton()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveItemsDialog::setMessage(const QString &msg)
|
void SaveItemsDialog::setMessage(const QString &msg)
|
||||||
@@ -164,24 +86,34 @@ void SaveItemsDialog::setMessage(const QString &msg)
|
|||||||
m_ui.msgLabel->setText(msg);
|
m_ui.msgLabel->setText(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SaveItemsDialog::updateSaveButton()
|
||||||
|
{
|
||||||
|
int count = m_ui.treeWidget->selectedItems().count();
|
||||||
|
QPushButton *button = m_ui.buttonBox->button(QDialogButtonBox::Save);
|
||||||
|
if (count == m_ui.treeWidget->topLevelItemCount()) {
|
||||||
|
button->setEnabled(true);
|
||||||
|
button->setText(tr("Save All"));
|
||||||
|
} else if (count == 0) {
|
||||||
|
button->setEnabled(false);
|
||||||
|
button->setText(tr("Save"));
|
||||||
|
} else {
|
||||||
|
button->setEnabled(true);
|
||||||
|
button->setText(tr("Save Selected"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SaveItemsDialog::collectItemsToSave()
|
void SaveItemsDialog::collectItemsToSave()
|
||||||
{
|
{
|
||||||
m_itemsToSave.clear();
|
m_itemsToSave.clear();
|
||||||
m_itemsToOpen.clear();
|
foreach (QTreeWidgetItem *item, m_ui.treeWidget->selectedItems()) {
|
||||||
QMap<FileItem*, IFile*>::const_iterator it = m_itemMap.constBegin();
|
m_itemsToSave.append(item->data(0, Qt::UserRole).value<IFile*>());
|
||||||
while (it != m_itemMap.constEnd()) {
|
|
||||||
if (it.key()->shouldBeSaved())
|
|
||||||
m_itemsToSave << it.value();
|
|
||||||
if (it.key()->shouldBeOpened())
|
|
||||||
m_itemsToOpen.insert(it.value());
|
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveItemsDialog::discardAll()
|
void SaveItemsDialog::discardAll()
|
||||||
{
|
{
|
||||||
uncheckAll();
|
m_ui.treeWidget->clearSelection();
|
||||||
collectItemsToSave();
|
collectItemsToSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,16 +121,3 @@ QList<IFile*> SaveItemsDialog::itemsToSave() const
|
|||||||
{
|
{
|
||||||
return m_itemsToSave;
|
return m_itemsToSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<IFile*> SaveItemsDialog::itemsToOpen() const
|
|
||||||
{
|
|
||||||
return m_itemsToOpen;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SaveItemsDialog::uncheckAll()
|
|
||||||
{
|
|
||||||
for (int i=0; i<m_ui.treeWidget->topLevelItemCount(); ++i) {
|
|
||||||
FileItem *item = static_cast<FileItem*>(m_ui.treeWidget->topLevelItem(i));
|
|
||||||
item->setShouldBeSaved(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -48,49 +48,26 @@ namespace Internal {
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
class FileItem : public QObject, public QTreeWidgetItem
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
FileItem(QTreeWidget *tree, bool supportOpen,
|
|
||||||
bool open, const QString &text);
|
|
||||||
bool shouldBeSaved() const;
|
|
||||||
void setShouldBeSaved(bool s);
|
|
||||||
bool shouldBeOpened() const;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void updateSCCCheckBox();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QCheckBox *createCheckBox(QTreeWidget *tree, int column);
|
|
||||||
QCheckBox *m_saveCheckBox;
|
|
||||||
QCheckBox *m_sccCheckBox;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SaveItemsDialog : public QDialog
|
class SaveItemsDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SaveItemsDialog(MainWindow *mainWindow,
|
SaveItemsDialog(QWidget *parent,
|
||||||
QMap<Core::IFile*, QString> items);
|
QList<Core::IFile *> items);
|
||||||
|
|
||||||
void setMessage(const QString &msg);
|
void setMessage(const QString &msg);
|
||||||
|
|
||||||
QList<Core::IFile*> itemsToSave() const;
|
QList<Core::IFile *> itemsToSave() const;
|
||||||
QSet<Core::IFile*> itemsToOpen() const;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void collectItemsToSave();
|
void collectItemsToSave();
|
||||||
void uncheckAll();
|
|
||||||
void discardAll();
|
void discardAll();
|
||||||
|
void updateSaveButton();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SaveItemsDialog m_ui;
|
Ui::SaveItemsDialog m_ui;
|
||||||
QMap<FileItem*, Core::IFile*> m_itemMap;
|
|
||||||
QList<Core::IFile*> m_itemsToSave;
|
QList<Core::IFile*> m_itemsToSave;
|
||||||
QSet<Core::IFile*> m_itemsToOpen;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -1,41 +1,68 @@
|
|||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<class>SaveItemsDialog</class>
|
<class>SaveItemsDialog</class>
|
||||||
<widget class="QDialog" name="SaveItemsDialog" >
|
<widget class="QDialog" name="SaveItemsDialog">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>457</width>
|
||||||
<height>200</height>
|
<height>200</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Save Changes</string>
|
<string>Save Changes</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout">
|
||||||
<property name="margin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="msgLabel" >
|
<widget class="QLabel" name="msgLabel">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string>Save the changes of the following items:</string>
|
<string>The following files have unsaved changes:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeWidget" name="treeWidget" />
|
<widget class="QTreeWidget" name="treeWidget">
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||||
|
</property>
|
||||||
|
<property name="textElideMode">
|
||||||
|
<enum>Qt::ElideLeft</enum>
|
||||||
|
</property>
|
||||||
|
<property name="indentation">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rootIsDecorated">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="uniformRowHeights">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="headerHidden">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="columnCount">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">1</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">2</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons" >
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -52,11 +79,11 @@
|
|||||||
<receiver>SaveItemsDialog</receiver>
|
<receiver>SaveItemsDialog</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>199</x>
|
<x>199</x>
|
||||||
<y>174</y>
|
<y>174</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>199</x>
|
<x>199</x>
|
||||||
<y>99</y>
|
<y>99</y>
|
||||||
</hint>
|
</hint>
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
#include "icore.h"
|
#include "icore.h"
|
||||||
#include "iversioncontrol.h"
|
#include "iversioncontrol.h"
|
||||||
#include "mimedatabase.h"
|
#include "mimedatabase.h"
|
||||||
#include "saveitemsdialog.h"
|
|
||||||
#include "tabpositionindicator.h"
|
#include "tabpositionindicator.h"
|
||||||
#include "vcsmanager.h"
|
#include "vcsmanager.h"
|
||||||
|
|
||||||
|
|||||||
@@ -132,8 +132,7 @@ void EditorModel::addEntry(const Entry &entry)
|
|||||||
if (previousIndex >= 0) {
|
if (previousIndex >= 0) {
|
||||||
if (entry.editor && m_editors.at(previousIndex).editor == 0) {
|
if (entry.editor && m_editors.at(previousIndex).editor == 0) {
|
||||||
m_editors[previousIndex] = entry;
|
m_editors[previousIndex] = entry;
|
||||||
QModelIndex mindex = index(previousIndex, 0);
|
connect(entry.editor, SIGNAL(changed()), this, SLOT(itemChanged()));
|
||||||
emit dataChanged(mindex, mindex);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -314,7 +314,8 @@ QList<IFile *> FileManager::saveModifiedFiles(const QList<IFile *> &files,
|
|||||||
(*cancelled) = false;
|
(*cancelled) = false;
|
||||||
|
|
||||||
QList<IFile *> notSaved;
|
QList<IFile *> notSaved;
|
||||||
QMap<IFile*, QString> modifiedFiles;
|
QMap<IFile *, QString> modifiedFilesMap;
|
||||||
|
QList<IFile *> modifiedFiles;
|
||||||
|
|
||||||
foreach (IFile *file, files) {
|
foreach (IFile *file, files) {
|
||||||
if (file->isModified()) {
|
if (file->isModified()) {
|
||||||
@@ -324,17 +325,16 @@ QList<IFile *> FileManager::saveModifiedFiles(const QList<IFile *> &files,
|
|||||||
|
|
||||||
// There can be several FileInterfaces pointing to the same file
|
// There can be several FileInterfaces pointing to the same file
|
||||||
// Select one that is not readonly.
|
// Select one that is not readonly.
|
||||||
if (!(modifiedFiles.values().contains(name)
|
if (!(modifiedFilesMap.values().contains(name)
|
||||||
&& file->isReadOnly()))
|
&& file->isReadOnly()))
|
||||||
modifiedFiles.insert(file, name);
|
modifiedFilesMap.insert(file, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
modifiedFiles = modifiedFilesMap.keys();
|
||||||
if (!modifiedFiles.isEmpty()) {
|
if (!modifiedFiles.isEmpty()) {
|
||||||
QList<IFile *> filesToSave;
|
QList<IFile *> filesToSave;
|
||||||
QSet<IFile *> filesToOpen;
|
|
||||||
if (silently) {
|
if (silently) {
|
||||||
filesToSave = modifiedFiles.keys();
|
filesToSave = modifiedFiles;
|
||||||
} else {
|
} else {
|
||||||
SaveItemsDialog dia(m_mainWindow, modifiedFiles);
|
SaveItemsDialog dia(m_mainWindow, modifiedFiles);
|
||||||
if (!message.isEmpty())
|
if (!message.isEmpty())
|
||||||
@@ -342,16 +342,15 @@ QList<IFile *> FileManager::saveModifiedFiles(const QList<IFile *> &files,
|
|||||||
if (dia.exec() != QDialog::Accepted) {
|
if (dia.exec() != QDialog::Accepted) {
|
||||||
if (cancelled)
|
if (cancelled)
|
||||||
(*cancelled) = true;
|
(*cancelled) = true;
|
||||||
notSaved = modifiedFiles.keys();
|
notSaved = modifiedFiles;
|
||||||
return notSaved;
|
return notSaved;
|
||||||
}
|
}
|
||||||
filesToSave = dia.itemsToSave();
|
filesToSave = dia.itemsToSave();
|
||||||
filesToOpen = dia.itemsToOpen();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool yestoall = false;
|
bool yestoall = false;
|
||||||
foreach (IFile *file, filesToSave) {
|
foreach (IFile *file, filesToSave) {
|
||||||
if (file->isReadOnly() && filesToOpen.contains(file)) {
|
if (file->isReadOnly()) {
|
||||||
QString directory = QFileInfo(file->fileName()).absolutePath();
|
QString directory = QFileInfo(file->fileName()).absolutePath();
|
||||||
IVersionControl *versionControl = m_mainWindow->vcsManager()->findVersionControlForDirectory(directory);
|
IVersionControl *versionControl = m_mainWindow->vcsManager()->findVersionControlForDirectory(directory);
|
||||||
if (versionControl)
|
if (versionControl)
|
||||||
|
|||||||
@@ -92,7 +92,9 @@ WelcomeModePrivate::WelcomeModePrivate() :
|
|||||||
m_projectHtmlTemplate(readFile(QLatin1String(":/core/html/recent_projects.html"))),
|
m_projectHtmlTemplate(readFile(QLatin1String(":/core/html/recent_projects.html"))),
|
||||||
m_baseUrl(QUrl(QLatin1String("qrc:/core/html/welcome.html")))
|
m_baseUrl(QUrl(QLatin1String("qrc:/core/html/welcome.html")))
|
||||||
{
|
{
|
||||||
|
#if !defined(QT_NO_WEBKIT)
|
||||||
m_webview->setContextMenuPolicy(Qt::NoContextMenu);
|
m_webview->setContextMenuPolicy(Qt::NoContextMenu);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(QT_NO_WEBKIT)
|
#if defined(QT_NO_WEBKIT)
|
||||||
|
|||||||
@@ -370,7 +370,7 @@ void CPPEditor::jumpToMethod(int)
|
|||||||
if (! symbol)
|
if (! symbol)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
openEditorAt(symbol);
|
openCppEditorAt(linkToSymbol(symbol));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPPEditor::updateMethodBoxIndex()
|
void CPPEditor::updateMethodBoxIndex()
|
||||||
@@ -579,50 +579,65 @@ void CPPEditor::switchDeclarationDefinition()
|
|||||||
declaration = symbols.first();
|
declaration = symbols.first();
|
||||||
|
|
||||||
if (declaration)
|
if (declaration)
|
||||||
openEditorAt(declaration);
|
openCppEditorAt(linkToSymbol(declaration));
|
||||||
} else if (lastSymbol->type()->isFunctionType()) {
|
} else if (lastSymbol->type()->isFunctionType()) {
|
||||||
if (Symbol *def = findDefinition(lastSymbol))
|
if (Symbol *def = findDefinition(lastSymbol))
|
||||||
openEditorAt(def);
|
openCppEditorAt(linkToSymbol(def));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPPEditor::jumpToDefinition()
|
CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor)
|
||||||
{
|
{
|
||||||
|
Link link;
|
||||||
|
|
||||||
if (!m_modelManager)
|
if (!m_modelManager)
|
||||||
return;
|
return link;
|
||||||
|
|
||||||
const Snapshot snapshot = m_modelManager->snapshot();
|
const Snapshot snapshot = m_modelManager->snapshot();
|
||||||
|
|
||||||
// Find the last symbol up to the cursor position
|
|
||||||
int line = 0, column = 0;
|
int line = 0, column = 0;
|
||||||
convertPosition(position(), &line, &column);
|
convertPosition(cursor.position(), &line, &column);
|
||||||
Document::Ptr doc = snapshot.value(file()->fileName());
|
Document::Ptr doc = snapshot.value(file()->fileName());
|
||||||
if (!doc)
|
if (!doc)
|
||||||
return;
|
return link;
|
||||||
|
|
||||||
QTextCursor tc = textCursor();
|
// Handle include directives
|
||||||
unsigned lineno = tc.blockNumber() + 1;
|
const unsigned lineno = cursor.blockNumber() + 1;
|
||||||
foreach (const Document::Include &incl, doc->includes()) {
|
foreach (const Document::Include &incl, doc->includes()) {
|
||||||
if (incl.line() == lineno) {
|
if (incl.line() == lineno) {
|
||||||
if (openCppEditorAt(incl.fileName(), 0, 0))
|
link.fileName = incl.fileName();
|
||||||
return; // done
|
link.pos = cursor.block().position();
|
||||||
break;
|
link.length = cursor.block().length();
|
||||||
|
return link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Find the last symbol up to the cursor position
|
||||||
Symbol *lastSymbol = doc->findSymbolAt(line, column);
|
Symbol *lastSymbol = doc->findSymbolAt(line, column);
|
||||||
if (!lastSymbol)
|
if (!lastSymbol)
|
||||||
return;
|
return link;
|
||||||
|
|
||||||
// Get the expression under the cursor
|
// Check whether we're at a name
|
||||||
const int endOfName = endOfNameUnderCursor();
|
const int endOfName = endOfNameAtPosition(cursor.position());
|
||||||
|
if (!characterAt(endOfName - 1).isLetterOrNumber())
|
||||||
|
return link;
|
||||||
|
|
||||||
|
// Remember the position and length of the name
|
||||||
|
QTextCursor tc = cursor;
|
||||||
|
tc.setPosition(endOfName);
|
||||||
|
tc.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);
|
||||||
|
const int nameStart = tc.position();
|
||||||
|
const int nameLength = tc.anchor() - tc.position();
|
||||||
|
|
||||||
|
// Drop out if we're at a number
|
||||||
|
if (characterAt(nameStart).isNumber())
|
||||||
|
return link;
|
||||||
|
|
||||||
|
// Evaluate the type of the expression under the cursor
|
||||||
tc.setPosition(endOfName);
|
tc.setPosition(endOfName);
|
||||||
ExpressionUnderCursor expressionUnderCursor;
|
ExpressionUnderCursor expressionUnderCursor;
|
||||||
const QString expression = expressionUnderCursor(tc);
|
const QString expression = expressionUnderCursor(tc);
|
||||||
|
|
||||||
// Evaluate the type of the expression
|
|
||||||
TypeOfExpression typeOfExpression;
|
TypeOfExpression typeOfExpression;
|
||||||
typeOfExpression.setSnapshot(m_modelManager->snapshot());
|
typeOfExpression.setSnapshot(snapshot);
|
||||||
QList<TypeOfExpression::Result> resolvedSymbols =
|
QList<TypeOfExpression::Result> resolvedSymbols =
|
||||||
typeOfExpression(expression, doc, lastSymbol);
|
typeOfExpression(expression, doc, lastSymbol);
|
||||||
|
|
||||||
@@ -633,10 +648,10 @@ void CPPEditor::jumpToDefinition()
|
|||||||
if (!lastSymbol->isFunction())
|
if (!lastSymbol->isFunction())
|
||||||
def = findDefinition(symbol);
|
def = findDefinition(symbol);
|
||||||
|
|
||||||
if (def)
|
link = linkToSymbol(def ? def : symbol);
|
||||||
openEditorAt(def);
|
link.pos = nameStart;
|
||||||
else
|
link.length = nameLength;
|
||||||
openEditorAt(symbol);
|
return link;
|
||||||
|
|
||||||
// This would jump to the type of a name
|
// This would jump to the type of a name
|
||||||
#if 0
|
#if 0
|
||||||
@@ -649,15 +664,25 @@ void CPPEditor::jumpToDefinition()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Handle macro uses
|
||||||
foreach (const Document::MacroUse use, doc->macroUses()) {
|
foreach (const Document::MacroUse use, doc->macroUses()) {
|
||||||
if (use.contains(endOfName - 1)) {
|
if (use.contains(endOfName - 1)) {
|
||||||
const Macro ¯o = use.macro();
|
const Macro ¯o = use.macro();
|
||||||
const QString fileName = QString::fromUtf8(macro.fileName());
|
link.fileName = QString::fromUtf8(macro.fileName());
|
||||||
if (openCppEditorAt(fileName, macro.line(), 0))
|
link.line = macro.line();
|
||||||
return; // done
|
link.pos = use.begin();
|
||||||
|
link.length = use.end() - use.begin();
|
||||||
|
return link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPPEditor::jumpToDefinition()
|
||||||
|
{
|
||||||
|
openCppEditorAt(findLinkAt(textCursor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Symbol *CPPEditor::findDefinition(Symbol *symbol)
|
Symbol *CPPEditor::findDefinition(Symbol *symbol)
|
||||||
@@ -777,6 +802,78 @@ void CPPEditor::contextMenuEvent(QContextMenuEvent *e)
|
|||||||
delete menu;
|
delete menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPPEditor::mouseMoveEvent(QMouseEvent *e)
|
||||||
|
{
|
||||||
|
bool hasDestination = false;
|
||||||
|
Qt::CursorShape cursorShape;
|
||||||
|
|
||||||
|
if (e->modifiers() & Qt::ControlModifier) {
|
||||||
|
// Link emulation behaviour for 'go to definition'
|
||||||
|
const QTextCursor cursor = cursorForPosition(e->pos());
|
||||||
|
|
||||||
|
// Check that the mouse was actually on the text somewhere
|
||||||
|
bool onText = cursorRect(cursor).right() >= e->x();
|
||||||
|
if (!onText) {
|
||||||
|
QTextCursor nextPos = cursor;
|
||||||
|
nextPos.movePosition(QTextCursor::Right);
|
||||||
|
onText = cursorRect(nextPos).right() >= e->x();
|
||||||
|
}
|
||||||
|
|
||||||
|
const Link link = findLinkAt(cursor);
|
||||||
|
|
||||||
|
if (onText && !link.fileName.isEmpty()) {
|
||||||
|
QTextEdit::ExtraSelection sel;
|
||||||
|
sel.cursor = cursor;
|
||||||
|
if (link.pos >= 0) {
|
||||||
|
sel.cursor.setPosition(link.pos);
|
||||||
|
sel.cursor.setPosition(link.pos + link.length, QTextCursor::KeepAnchor);
|
||||||
|
} else {
|
||||||
|
sel.cursor.select(QTextCursor::WordUnderCursor);
|
||||||
|
}
|
||||||
|
sel.format.setFontUnderline(true);
|
||||||
|
sel.format.setForeground(Qt::blue);
|
||||||
|
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>() << sel);
|
||||||
|
hasDestination = true;
|
||||||
|
cursorShape = Qt::PointingHandCursor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasDestination) {
|
||||||
|
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>());
|
||||||
|
cursorShape = Qt::IBeamCursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextEditor::BaseTextEditor::mouseMoveEvent(e);
|
||||||
|
|
||||||
|
viewport()->setCursor(cursorShape);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPPEditor::mouseReleaseEvent(QMouseEvent *e)
|
||||||
|
{
|
||||||
|
if (e->modifiers() & Qt::ControlModifier && !(e->modifiers() & Qt::ShiftModifier)
|
||||||
|
&& e->button() == Qt::LeftButton) {
|
||||||
|
|
||||||
|
const QTextCursor cursor = cursorForPosition(e->pos());
|
||||||
|
if (openCppEditorAt(findLinkAt(cursor))) {
|
||||||
|
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>());
|
||||||
|
viewport()->setCursor(Qt::IBeamCursor);
|
||||||
|
e->accept();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TextEditor::BaseTextEditor::mouseReleaseEvent(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPPEditor::keyReleaseEvent(QKeyEvent *e)
|
||||||
|
{
|
||||||
|
// Clear link emulation when Ctrl is released
|
||||||
|
if (e->key() == Qt::Key_Control) {
|
||||||
|
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>());
|
||||||
|
viewport()->setCursor(Qt::IBeamCursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QList<int> CPPEditorEditable::context() const
|
QList<int> CPPEditorEditable::context() const
|
||||||
{
|
{
|
||||||
return m_context;
|
return m_context;
|
||||||
@@ -946,9 +1043,11 @@ void CPPEditor::unCommentSelection()
|
|||||||
cursor.endEditBlock();
|
cursor.endEditBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPPEditor::endOfNameUnderCursor()
|
int CPPEditor::endOfNameAtPosition(int pos)
|
||||||
{
|
{
|
||||||
int pos = position();
|
if (pos == -1)
|
||||||
|
pos = position();
|
||||||
|
|
||||||
QChar chr = characterAt(pos);
|
QChar chr = characterAt(pos);
|
||||||
|
|
||||||
// Skip to the start of a name
|
// Skip to the start of a name
|
||||||
@@ -958,32 +1057,37 @@ int CPPEditor::endOfNameUnderCursor()
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditor::ITextEditor *CPPEditor::openCppEditorAt(const QString &fileName,
|
CPPEditor::Link CPPEditor::linkToSymbol(CPlusPlus::Symbol *symbol)
|
||||||
int line, int column)
|
|
||||||
{
|
{
|
||||||
return TextEditor::BaseTextEditor::openEditorAt(fileName, line, column,
|
const QString fileName = QString::fromUtf8(symbol->fileName(),
|
||||||
Constants::C_CPPEDITOR);
|
symbol->fileNameLength());
|
||||||
}
|
unsigned line = symbol->line();
|
||||||
|
unsigned column = symbol->column();
|
||||||
bool CPPEditor::openEditorAt(Symbol *s)
|
|
||||||
{
|
|
||||||
const QString fileName = QString::fromUtf8(s->fileName(), s->fileNameLength());
|
|
||||||
unsigned line = s->line();
|
|
||||||
unsigned column = s->column();
|
|
||||||
|
|
||||||
if (column)
|
if (column)
|
||||||
--column;
|
--column;
|
||||||
|
|
||||||
if (s->isGenerated())
|
if (symbol->isGenerated())
|
||||||
column = 0;
|
column = 0;
|
||||||
|
|
||||||
if (baseTextDocument()->fileName() == fileName) {
|
return Link(fileName, line, column);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CPPEditor::openCppEditorAt(const Link &link)
|
||||||
|
{
|
||||||
|
if (link.fileName.isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (baseTextDocument()->fileName() == link.fileName) {
|
||||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||||
editorManager->addCurrentPositionToNavigationHistory();
|
editorManager->addCurrentPositionToNavigationHistory();
|
||||||
gotoLine(line, column);
|
gotoLine(link.line, link.column);
|
||||||
setFocus();
|
setFocus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return openCppEditorAt(fileName, line, column);
|
return TextEditor::BaseTextEditor::openEditorAt(link.fileName,
|
||||||
|
link.line,
|
||||||
|
link.column,
|
||||||
|
Constants::C_CPPEDITOR);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,11 @@ public slots:
|
|||||||
void deleteEndOfToken();
|
void deleteEndOfToken();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent(QContextMenuEvent *e);
|
void contextMenuEvent(QContextMenuEvent *);
|
||||||
|
void mouseMoveEvent(QMouseEvent *);
|
||||||
|
void mouseReleaseEvent(QMouseEvent *);
|
||||||
|
void keyReleaseEvent(QKeyEvent *);
|
||||||
|
|
||||||
TextEditor::BaseTextEditorEditable *createEditableInterface();
|
TextEditor::BaseTextEditorEditable *createEditableInterface();
|
||||||
|
|
||||||
// Rertuns true if key triggers anindent.
|
// Rertuns true if key triggers anindent.
|
||||||
@@ -122,9 +126,31 @@ private:
|
|||||||
|
|
||||||
void createToolBar(CPPEditorEditable *editable);
|
void createToolBar(CPPEditorEditable *editable);
|
||||||
|
|
||||||
int endOfNameUnderCursor();
|
int endOfNameAtPosition(int pos);
|
||||||
|
|
||||||
bool openEditorAt(CPlusPlus::Symbol *symbol);
|
struct Link
|
||||||
|
{
|
||||||
|
Link(const QString &fileName = QString(),
|
||||||
|
int line = 0,
|
||||||
|
int column = 0)
|
||||||
|
: pos(-1)
|
||||||
|
, length(-1)
|
||||||
|
, fileName(fileName)
|
||||||
|
, line(line)
|
||||||
|
, column(column)
|
||||||
|
{}
|
||||||
|
|
||||||
|
int pos; // Link position
|
||||||
|
int length; // Link length
|
||||||
|
|
||||||
|
QString fileName; // Target file
|
||||||
|
int line; // Target line
|
||||||
|
int column; // Target column
|
||||||
|
};
|
||||||
|
|
||||||
|
Link findLinkAt(const QTextCursor &);
|
||||||
|
static Link linkToSymbol(CPlusPlus::Symbol *symbol);
|
||||||
|
bool openCppEditorAt(const Link &);
|
||||||
|
|
||||||
CppTools::CppModelManagerInterface *m_modelManager;
|
CppTools::CppModelManagerInterface *m_modelManager;
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ namespace Internal {
|
|||||||
DebuggerAction::DebuggerAction(QObject *parent)
|
DebuggerAction::DebuggerAction(QObject *parent)
|
||||||
: QAction(parent)
|
: QAction(parent)
|
||||||
{
|
{
|
||||||
|
m_widget = 0;
|
||||||
connect(this, SIGNAL(triggered(bool)), this, SLOT(actionTriggered(bool)));
|
connect(this, SIGNAL(triggered(bool)), this, SLOT(actionTriggered(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,8 +127,7 @@ QString DebuggerAction::toString() const
|
|||||||
{
|
{
|
||||||
return "value: " + m_value.toString()
|
return "value: " + m_value.toString()
|
||||||
+ " defaultvalue: " + m_defaultValue.toString()
|
+ " defaultvalue: " + m_defaultValue.toString()
|
||||||
+ " settingskey: " + m_settingsGroup + '/' + m_settingsKey
|
+ " settingskey: " + m_settingsGroup + '/' + m_settingsKey;
|
||||||
+ " deferedValue: " + m_deferedValue.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction *DebuggerAction::updatedAction(const QString &text0)
|
QAction *DebuggerAction::updatedAction(const QString &text0)
|
||||||
@@ -173,9 +173,9 @@ void DebuggerAction::writeSettings(QSettings *settings)
|
|||||||
void DebuggerAction::connectWidget(QWidget *widget, ApplyMode applyMode)
|
void DebuggerAction::connectWidget(QWidget *widget, ApplyMode applyMode)
|
||||||
{
|
{
|
||||||
using namespace Core::Utils;
|
using namespace Core::Utils;
|
||||||
//qDebug() << "CONNECT WIDGET " << widget << " TO " << m_settingsKey;
|
m_widget = widget;
|
||||||
m_applyModes[widget] = applyMode;
|
m_applyMode = applyMode;
|
||||||
m_deferedValue = m_value;
|
|
||||||
if (QAbstractButton *button = qobject_cast<QAbstractButton *>(widget)) {
|
if (QAbstractButton *button = qobject_cast<QAbstractButton *>(widget)) {
|
||||||
if (button->isCheckable()) {
|
if (button->isCheckable()) {
|
||||||
button->setChecked(m_value.toBool());
|
button->setChecked(m_value.toBool());
|
||||||
@@ -203,7 +203,14 @@ void DebuggerAction::connectWidget(QWidget *widget, ApplyMode applyMode)
|
|||||||
|
|
||||||
void DebuggerAction::apply(QSettings *s)
|
void DebuggerAction::apply(QSettings *s)
|
||||||
{
|
{
|
||||||
setValue(m_deferedValue);
|
using namespace Core::Utils;
|
||||||
|
if (QAbstractButton *button = qobject_cast<QAbstractButton *>(m_widget))
|
||||||
|
setValue(button->isChecked());
|
||||||
|
else if (QLineEdit *lineEdit = qobject_cast<QLineEdit *>(m_widget))
|
||||||
|
setValue(lineEdit->text());
|
||||||
|
else if (PathChooser *pathChooser = qobject_cast<PathChooser *>(m_widget))
|
||||||
|
setValue(pathChooser->path());
|
||||||
|
m_widget = 0;
|
||||||
if (s)
|
if (s)
|
||||||
writeSettings(s);
|
writeSettings(s);
|
||||||
}
|
}
|
||||||
@@ -221,9 +228,7 @@ void DebuggerAction::checkableButtonClicked(bool)
|
|||||||
QAbstractButton *button = qobject_cast<QAbstractButton *>(sender());
|
QAbstractButton *button = qobject_cast<QAbstractButton *>(sender());
|
||||||
QTC_ASSERT(button, return);
|
QTC_ASSERT(button, return);
|
||||||
//qDebug() << "CHECKABLE BUTTON: " << sender();
|
//qDebug() << "CHECKABLE BUTTON: " << sender();
|
||||||
if (m_applyModes[sender()] == DeferedApply)
|
if (m_applyMode == ImmediateApply)
|
||||||
m_deferedValue = button->isChecked();
|
|
||||||
else
|
|
||||||
setValue(button->isChecked());
|
setValue(button->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,9 +237,7 @@ void DebuggerAction::lineEditEditingFinished()
|
|||||||
QLineEdit *lineEdit = qobject_cast<QLineEdit *>(sender());
|
QLineEdit *lineEdit = qobject_cast<QLineEdit *>(sender());
|
||||||
QTC_ASSERT(lineEdit, return);
|
QTC_ASSERT(lineEdit, return);
|
||||||
//qDebug() << "LINEEDIT: " << sender() << lineEdit->text();
|
//qDebug() << "LINEEDIT: " << sender() << lineEdit->text();
|
||||||
if (m_applyModes[sender()] == DeferedApply)
|
if (m_applyMode == ImmediateApply)
|
||||||
m_deferedValue = lineEdit->text();
|
|
||||||
else
|
|
||||||
setValue(lineEdit->text());
|
setValue(lineEdit->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,9 +247,7 @@ void DebuggerAction::pathChooserEditingFinished()
|
|||||||
PathChooser *pathChooser = qobject_cast<PathChooser *>(sender());
|
PathChooser *pathChooser = qobject_cast<PathChooser *>(sender());
|
||||||
QTC_ASSERT(pathChooser, return);
|
QTC_ASSERT(pathChooser, return);
|
||||||
//qDebug() << "PATHCHOOSER: " << sender() << pathChooser->path();
|
//qDebug() << "PATHCHOOSER: " << sender() << pathChooser->path();
|
||||||
if (m_applyModes[sender()] == DeferedApply)
|
if (m_applyMode == ImmediateApply)
|
||||||
m_deferedValue = pathChooser->path();
|
|
||||||
else
|
|
||||||
setValue(pathChooser->path());
|
setValue(pathChooser->path());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,13 +263,13 @@ void DebuggerAction::trigger(const QVariant &data)
|
|||||||
QAction::trigger();
|
QAction::trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// DebuggerSettings
|
// DebuggerSettings
|
||||||
//
|
//
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
DebuggerSettings::DebuggerSettings(QObject *parent)
|
DebuggerSettings::DebuggerSettings(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@@ -96,12 +96,12 @@ private:
|
|||||||
|
|
||||||
QVariant m_value;
|
QVariant m_value;
|
||||||
QVariant m_defaultValue;
|
QVariant m_defaultValue;
|
||||||
QVariant m_deferedValue; // basically a temporary copy of m_value
|
|
||||||
QString m_settingsKey;
|
QString m_settingsKey;
|
||||||
QString m_settingsGroup;
|
QString m_settingsGroup;
|
||||||
QString m_textPattern;
|
QString m_textPattern;
|
||||||
QString m_textData;
|
QString m_textData;
|
||||||
QHash<QObject *, ApplyMode> m_applyModes;
|
QWidget *m_widget;
|
||||||
|
ApplyMode m_applyMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DebuggerSettings : public QObject
|
class DebuggerSettings : public QObject
|
||||||
|
|||||||
@@ -4232,7 +4232,7 @@ void GdbEngine::assignValueInDebugger(const QString &expression, const QString &
|
|||||||
|
|
||||||
QString GdbEngine::dumperLibraryName() const
|
QString GdbEngine::dumperLibraryName() const
|
||||||
{
|
{
|
||||||
if (theDebuggerAction(UsePrebuiltDumpers))
|
if (theDebuggerAction(UsePrebuiltDumpers)->value().toBool())
|
||||||
return theDebuggerAction(PrebuiltDumpersLocation)->value().toString();
|
return theDebuggerAction(PrebuiltDumpersLocation)->value().toString();
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
return q->m_buildDir + "/qtc-gdbmacros/debug/gdbmacros.dll";
|
return q->m_buildDir + "/qtc-gdbmacros/debug/gdbmacros.dll";
|
||||||
@@ -4252,9 +4252,16 @@ void GdbEngine::tryLoadCustomDumpers()
|
|||||||
m_dataDumperState = DataDumperUnavailable;
|
m_dataDumperState = DataDumperUnavailable;
|
||||||
QString lib = dumperLibraryName();
|
QString lib = dumperLibraryName();
|
||||||
|
|
||||||
if (QFileInfo(lib).exists()) {
|
if (!QFileInfo(lib).exists()) {
|
||||||
#if defined(Q_OS_WIN)
|
debugMessage(QString("DEBUG HELPER LIBRARY IS NOT USABLE: "
|
||||||
|
" %1 EXISTS: %2, EXECUTABLE: %3").arg(lib)
|
||||||
|
.arg(QFileInfo(lib).exists())
|
||||||
|
.arg(QFileInfo(lib).isExecutable()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_dataDumperState = DataDumperLoadTried;
|
m_dataDumperState = DataDumperLoadTried;
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
sendCommand("sharedlibrary .*"); // for LoadLibraryA
|
sendCommand("sharedlibrary .*"); // for LoadLibraryA
|
||||||
//sendCommand("handle SIGSEGV pass stop print");
|
//sendCommand("handle SIGSEGV pass stop print");
|
||||||
//sendCommand("set unwindonsignal off");
|
//sendCommand("set unwindonsignal off");
|
||||||
@@ -4262,7 +4269,6 @@ void GdbEngine::tryLoadCustomDumpers()
|
|||||||
WatchDumpCustomSetup);
|
WatchDumpCustomSetup);
|
||||||
sendCommand("sharedlibrary " + dotEscape(lib));
|
sendCommand("sharedlibrary " + dotEscape(lib));
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
m_dataDumperState = DataDumperLoadTried;
|
|
||||||
//sendCommand("sharedlibrary libc"); // for malloc
|
//sendCommand("sharedlibrary libc"); // for malloc
|
||||||
//sendCommand("sharedlibrary libdl"); // for dlopen
|
//sendCommand("sharedlibrary libdl"); // for dlopen
|
||||||
QString flag = QString::number(RTLD_NOW);
|
QString flag = QString::number(RTLD_NOW);
|
||||||
@@ -4282,18 +4288,9 @@ void GdbEngine::tryLoadCustomDumpers()
|
|||||||
WatchDumpCustomSetup);
|
WatchDumpCustomSetup);
|
||||||
sendCommand("sharedlibrary " + dotEscape(lib));
|
sendCommand("sharedlibrary " + dotEscape(lib));
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
if (m_dataDumperState == DataDumperLoadTried) {
|
|
||||||
// retreive list of dumpable classes
|
// retreive list of dumpable classes
|
||||||
sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)");
|
sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)");
|
||||||
sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper);
|
sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper);
|
||||||
} else {
|
|
||||||
debugMessage(QString("DEBUG HELPER LIBRARY IS NOT USABLE: "
|
|
||||||
" %1 EXISTS: %2, EXECUTABLE: %3").arg(lib)
|
|
||||||
.arg(QFileInfo(lib).exists())
|
|
||||||
.arg(QFileInfo(lib).isExecutable()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GdbEngine::recheckCustomDumperAvailability()
|
void GdbEngine::recheckCustomDumperAvailability()
|
||||||
|
|||||||
@@ -682,7 +682,7 @@ void WatchHandler::rebuildModel()
|
|||||||
|
|
||||||
emit layoutAboutToBeChanged();
|
emit layoutAboutToBeChanged();
|
||||||
|
|
||||||
if (oldTopINames != topINames) {
|
if (0 && oldTopINames != topINames) {
|
||||||
m_displaySet = initialSet();
|
m_displaySet = initialSet();
|
||||||
m_expandedINames.clear();
|
m_expandedINames.clear();
|
||||||
emit reset();
|
emit reset();
|
||||||
|
|||||||
@@ -1273,8 +1273,7 @@ bool ProjectExplorerPlugin::saveModifiedFiles(const QList<Project *> & projects)
|
|||||||
|
|
||||||
if (!filesToSave.isEmpty()) {
|
if (!filesToSave.isEmpty()) {
|
||||||
bool cancelled;
|
bool cancelled;
|
||||||
Core::ICore::instance()->fileManager()->saveModifiedFiles(filesToSave, &cancelled,
|
Core::ICore::instance()->fileManager()->saveModifiedFiles(filesToSave, &cancelled);
|
||||||
tr("The following dependencies are modified, do you want to save them?"));
|
|
||||||
if (cancelled) {
|
if (cancelled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -335,7 +335,6 @@ void VCSBaseEditor::mouseMoveEvent(QMouseEvent *e)
|
|||||||
sel.cursor = cursor;
|
sel.cursor = cursor;
|
||||||
sel.cursor.select(QTextCursor::WordUnderCursor);
|
sel.cursor.select(QTextCursor::WordUnderCursor);
|
||||||
sel.format.setFontUnderline(true);
|
sel.format.setFontUnderline(true);
|
||||||
change = changeUnderCursor(cursor);
|
|
||||||
sel.format.setProperty(QTextFormat::UserProperty, change);
|
sel.format.setProperty(QTextFormat::UserProperty, change);
|
||||||
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>() << sel);
|
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>() << sel);
|
||||||
overrideCursor = true;
|
overrideCursor = true;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ isEmpty(TEST):CONFIG(debug, debug|release) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
linux-g++-64 {
|
linux-*-64 {
|
||||||
IDE_LIBRARY_BASENAME = lib64
|
IDE_LIBRARY_BASENAME = lib64
|
||||||
} else {
|
} else {
|
||||||
IDE_LIBRARY_BASENAME = lib
|
IDE_LIBRARY_BASENAME = lib
|
||||||
|
|||||||
Reference in New Issue
Block a user