forked from qt-creator/qt-creator
Further header cleanup.
Introduce some more private classes for the coreplugin, use header include convention <QtModule/QClass>, de-qobjectify VariableManager.
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
#ifndef PLUGINCOLLECTION_H
|
#ifndef PLUGINCOLLECTION_H
|
||||||
#define PLUGINCOLLECTION_H
|
#define PLUGINCOLLECTION_H
|
||||||
|
|
||||||
#include <QList>
|
|
||||||
#include <QString>
|
|
||||||
#include "extensionsystem_global.h"
|
#include "extensionsystem_global.h"
|
||||||
|
|
||||||
|
#include <QtCore/QList>
|
||||||
|
#include <QtCore/QString>
|
||||||
|
|
||||||
namespace ExtensionSystem {
|
namespace ExtensionSystem {
|
||||||
class PluginSpec;
|
class PluginSpec;
|
||||||
@@ -26,6 +26,6 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace ExtensionSystem
|
||||||
|
|
||||||
#endif // PLUGINCOLLECTION_H
|
#endif // PLUGINCOLLECTION_H
|
||||||
|
|||||||
@@ -30,12 +30,13 @@
|
|||||||
#include "crumblepath.h"
|
#include "crumblepath.h"
|
||||||
#include "stylehelper.h"
|
#include "stylehelper.h"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QtCore/QList>
|
||||||
#include <QPushButton>
|
#include <QtGui/QHBoxLayout>
|
||||||
#include <QStyle>
|
#include <QtGui/QPushButton>
|
||||||
#include <QResizeEvent>
|
#include <QtGui/QStyle>
|
||||||
#include <QPainter>
|
#include <QtGui/QResizeEvent>
|
||||||
#include <QImage>
|
#include <QtGui/QPainter>
|
||||||
|
#include <QtGui/QImage>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
@@ -177,31 +178,43 @@ void CrumblePathButton::setSegmentType(int type)
|
|||||||
m_textPos.setX(useLeftPadding ? 18 : 4);
|
m_textPos.setX(useLeftPadding ? 18 : 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct CrumblePathPrivate {
|
||||||
|
explicit CrumblePathPrivate(CrumblePath *q);
|
||||||
|
|
||||||
|
QColor m_baseColor;
|
||||||
|
QList<CrumblePathButton*> m_buttons;
|
||||||
|
QWidget *m_background;
|
||||||
|
};
|
||||||
|
|
||||||
|
CrumblePathPrivate::CrumblePathPrivate(CrumblePath *q) :
|
||||||
|
m_baseColor(StyleHelper::baseColor()),
|
||||||
|
m_background(new QWidget(q))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// CrumblePath
|
// CrumblePath
|
||||||
//
|
//
|
||||||
CrumblePath::CrumblePath(QWidget *parent) :
|
CrumblePath::CrumblePath(QWidget *parent) :
|
||||||
QWidget(parent), m_background(new QWidget(this))
|
QWidget(parent), d(new CrumblePathPrivate(this))
|
||||||
{
|
{
|
||||||
m_baseColor = StyleHelper::baseColor();
|
|
||||||
|
|
||||||
setMinimumHeight(25);
|
setMinimumHeight(25);
|
||||||
setMaximumHeight(25);
|
setMaximumHeight(25);
|
||||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
|
||||||
|
|
||||||
setBackgroundStyle();
|
setBackgroundStyle();
|
||||||
m_background->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
d->m_background->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
CrumblePath::~CrumblePath()
|
CrumblePath::~CrumblePath()
|
||||||
{
|
{
|
||||||
qDeleteAll(m_buttons);
|
qDeleteAll(d->m_buttons);
|
||||||
m_buttons.clear();
|
d->m_buttons.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrumblePath::setBackgroundStyle()
|
void CrumblePath::setBackgroundStyle()
|
||||||
{
|
{
|
||||||
m_background->setStyleSheet("QWidget { background-color:" + m_baseColor.name() + ";}");
|
d->m_background->setStyleSheet("QWidget { background-color:" + d->m_baseColor.name() + ";}");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrumblePath::pushElement(const QString &title)
|
void CrumblePath::pushElement(const QString &title)
|
||||||
@@ -212,38 +225,38 @@ void CrumblePath::pushElement(const QString &title)
|
|||||||
connect(newButton, SIGNAL(customContextMenuRequested(QPoint)), SLOT(mapContextMenuRequestToIndex()));
|
connect(newButton, SIGNAL(customContextMenuRequested(QPoint)), SLOT(mapContextMenuRequestToIndex()));
|
||||||
|
|
||||||
int segType = CrumblePathButton::MiddleSegment;
|
int segType = CrumblePathButton::MiddleSegment;
|
||||||
if (!m_buttons.isEmpty()) {
|
if (!d->m_buttons.isEmpty()) {
|
||||||
if (m_buttons.length() == 1)
|
if (d->m_buttons.length() == 1)
|
||||||
segType = segType | CrumblePathButton::FirstSegment;
|
segType = segType | CrumblePathButton::FirstSegment;
|
||||||
m_buttons.last()->setSegmentType(segType);
|
d->m_buttons.last()->setSegmentType(segType);
|
||||||
} else {
|
} else {
|
||||||
segType = CrumblePathButton::FirstSegment | CrumblePathButton::LastSegment;
|
segType = CrumblePathButton::FirstSegment | CrumblePathButton::LastSegment;
|
||||||
newButton->setSegmentType(segType);
|
newButton->setSegmentType(segType);
|
||||||
}
|
}
|
||||||
m_buttons.append(newButton);
|
d->m_buttons.append(newButton);
|
||||||
|
|
||||||
resizeButtons();
|
resizeButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrumblePath::popElement()
|
void CrumblePath::popElement()
|
||||||
{
|
{
|
||||||
QWidget *last = m_buttons.last();
|
QWidget *last = d->m_buttons.last();
|
||||||
m_buttons.removeLast();
|
d->m_buttons.removeLast();
|
||||||
last->setParent(0);
|
last->setParent(0);
|
||||||
last->deleteLater();
|
last->deleteLater();
|
||||||
|
|
||||||
int segType = CrumblePathButton::MiddleSegment | CrumblePathButton::LastSegment;
|
int segType = CrumblePathButton::MiddleSegment | CrumblePathButton::LastSegment;
|
||||||
if (!m_buttons.isEmpty()) {
|
if (!d->m_buttons.isEmpty()) {
|
||||||
if (m_buttons.length() == 1)
|
if (d->m_buttons.length() == 1)
|
||||||
segType = CrumblePathButton::FirstSegment | CrumblePathButton::LastSegment;
|
segType = CrumblePathButton::FirstSegment | CrumblePathButton::LastSegment;
|
||||||
m_buttons.last()->setSegmentType(segType);
|
d->m_buttons.last()->setSegmentType(segType);
|
||||||
}
|
}
|
||||||
resizeButtons();
|
resizeButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrumblePath::clear()
|
void CrumblePath::clear()
|
||||||
{
|
{
|
||||||
while (!m_buttons.isEmpty()) {
|
while (!d->m_buttons.isEmpty()) {
|
||||||
popElement();
|
popElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,21 +272,21 @@ void CrumblePath::resizeButtons()
|
|||||||
int buttonMaxWidth = 0;
|
int buttonMaxWidth = 0;
|
||||||
int totalWidthLeft = width();
|
int totalWidthLeft = width();
|
||||||
|
|
||||||
if (m_buttons.length() >= 1) {
|
if (d->m_buttons.length() >= 1) {
|
||||||
QPoint nextElementPosition(0,0);
|
QPoint nextElementPosition(0,0);
|
||||||
|
|
||||||
m_buttons[0]->raise();
|
d->m_buttons[0]->raise();
|
||||||
// rearrange all items so that the first item is on top (added last).
|
// rearrange all items so that the first item is on top (added last).
|
||||||
for(int i = 0; i < m_buttons.length() ; ++i) {
|
for(int i = 0; i < d->m_buttons.length() ; ++i) {
|
||||||
CrumblePathButton *button = m_buttons[i];
|
CrumblePathButton *button = d->m_buttons[i];
|
||||||
|
|
||||||
QFontMetrics fm(button->font());
|
QFontMetrics fm(button->font());
|
||||||
buttonMinWidth = ArrowBorderSize + fm.width(button->text()) + ArrowBorderSize * 2 ;
|
buttonMinWidth = ArrowBorderSize + fm.width(button->text()) + ArrowBorderSize * 2 ;
|
||||||
buttonMaxWidth = (totalWidthLeft + ArrowBorderSize * (m_buttons.length() - i)) / (m_buttons.length() - i);
|
buttonMaxWidth = (totalWidthLeft + ArrowBorderSize * (d->m_buttons.length() - i)) / (d->m_buttons.length() - i);
|
||||||
|
|
||||||
if (buttonMinWidth > buttonMaxWidth && i < m_buttons.length() - 1) {
|
if (buttonMinWidth > buttonMaxWidth && i < d->m_buttons.length() - 1) {
|
||||||
buttonMinWidth = buttonMaxWidth;
|
buttonMinWidth = buttonMaxWidth;
|
||||||
} else if (i > 3 && (i == m_buttons.length() - 1)) {
|
} else if (i > 3 && (i == d->m_buttons.length() - 1)) {
|
||||||
buttonMinWidth = width() - nextElementPosition.x();
|
buttonMinWidth = width() - nextElementPosition.x();
|
||||||
buttonMaxWidth = buttonMinWidth;
|
buttonMaxWidth = buttonMinWidth;
|
||||||
}
|
}
|
||||||
@@ -287,20 +300,20 @@ void CrumblePath::resizeButtons()
|
|||||||
|
|
||||||
button->show();
|
button->show();
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
button->stackUnder(m_buttons[i - 1]);
|
button->stackUnder(d->m_buttons[i - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_background->setGeometry(0,0, width(), height());
|
d->m_background->setGeometry(0,0, width(), height());
|
||||||
m_background->update();
|
d->m_background->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrumblePath::mapClickToIndex()
|
void CrumblePath::mapClickToIndex()
|
||||||
{
|
{
|
||||||
QObject *element = sender();
|
QObject *element = sender();
|
||||||
for (int i = 0; i < m_buttons.length(); ++i) {
|
for (int i = 0; i < d->m_buttons.length(); ++i) {
|
||||||
if (m_buttons[i] == element) {
|
if (d->m_buttons[i] == element) {
|
||||||
emit elementClicked(i);
|
emit elementClicked(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -310,8 +323,8 @@ void CrumblePath::mapClickToIndex()
|
|||||||
void CrumblePath::mapContextMenuRequestToIndex()
|
void CrumblePath::mapContextMenuRequestToIndex()
|
||||||
{
|
{
|
||||||
QObject *element = sender();
|
QObject *element = sender();
|
||||||
for (int i = 0; i < m_buttons.length(); ++i) {
|
for (int i = 0; i < d->m_buttons.length(); ++i) {
|
||||||
if (m_buttons[i] == element) {
|
if (d->m_buttons[i] == element) {
|
||||||
emit elementContextMenuRequested(i);
|
emit elementContextMenuRequested(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -320,8 +333,8 @@ void CrumblePath::mapContextMenuRequestToIndex()
|
|||||||
|
|
||||||
void CrumblePath::paintEvent(QPaintEvent *event)
|
void CrumblePath::paintEvent(QPaintEvent *event)
|
||||||
{
|
{
|
||||||
if (StyleHelper::baseColor() != m_baseColor) {
|
if (StyleHelper::baseColor() != d->m_baseColor) {
|
||||||
m_baseColor = StyleHelper::baseColor();
|
d->m_baseColor = StyleHelper::baseColor();
|
||||||
setBackgroundStyle();
|
setBackgroundStyle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,15 +30,15 @@
|
|||||||
#ifndef CRUMBLEPATH_H
|
#ifndef CRUMBLEPATH_H
|
||||||
#define CRUMBLEPATH_H
|
#define CRUMBLEPATH_H
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QList>
|
|
||||||
#include "utils_global.h"
|
#include "utils_global.h"
|
||||||
|
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QResizeEvent);
|
QT_FORWARD_DECLARE_CLASS(QResizeEvent);
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
class CrumblePathButton;
|
struct CrumblePathPrivate;
|
||||||
|
|
||||||
class QTCREATOR_UTILS_EXPORT CrumblePath : public QWidget
|
class QTCREATOR_UTILS_EXPORT CrumblePath : public QWidget
|
||||||
{
|
{
|
||||||
@@ -69,9 +69,7 @@ private:
|
|||||||
void setBackgroundStyle();
|
void setBackgroundStyle();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QColor m_baseColor;
|
QScopedPointer<CrumblePathPrivate> d;
|
||||||
QList<CrumblePathButton*> m_buttons;
|
|
||||||
QWidget *m_background;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlViewer
|
} // namespace QmlViewer
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#include "debuggerlanguagechooser.h"
|
#include "debuggerlanguagechooser.h"
|
||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QtGui/QHBoxLayout>
|
||||||
#include <QCheckBox>
|
#include <QtGui/QCheckBox>
|
||||||
#include <QSpinBox>
|
#include <QtGui/QSpinBox>
|
||||||
#include <QLabel>
|
#include <QtGui/QLabel>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
#ifndef DEBUGGERLANGUAGECHOOSER_H
|
#ifndef DEBUGGERLANGUAGECHOOSER_H
|
||||||
#define DEBUGGERLANGUAGECHOOSER_H
|
#define DEBUGGERLANGUAGECHOOSER_H
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include "utils_global.h"
|
#include "utils_global.h"
|
||||||
|
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QCheckBox);
|
QT_FORWARD_DECLARE_CLASS(QCheckBox);
|
||||||
QT_FORWARD_DECLARE_CLASS(QLabel);
|
QT_FORWARD_DECLARE_CLASS(QLabel);
|
||||||
QT_FORWARD_DECLARE_CLASS(QSpinBox);
|
QT_FORWARD_DECLARE_CLASS(QSpinBox);
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#define TREEWIDGETCOLUMNSTRETCHER_H
|
#define TREEWIDGETCOLUMNSTRETCHER_H
|
||||||
|
|
||||||
#include "utils_global.h"
|
#include "utils_global.h"
|
||||||
#include <QObject>
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QTreeWidget;
|
class QTreeWidget;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "openwithdialog.h"
|
#include "openwithdialog.h"
|
||||||
#include "filemanager.h"
|
#include "filemanager.h"
|
||||||
#include "icore.h"
|
#include "icore.h"
|
||||||
|
#include "ieditor.h"
|
||||||
#include "iversioncontrol.h"
|
#include "iversioncontrol.h"
|
||||||
#include "mimedatabase.h"
|
#include "mimedatabase.h"
|
||||||
#include "tabpositionindicator.h"
|
#include "tabpositionindicator.h"
|
||||||
@@ -435,11 +436,7 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
|
|||||||
connect(m_d->m_openInExternalEditorAction, SIGNAL(triggered()), this, SLOT(openInExternalEditor()));
|
connect(m_d->m_openInExternalEditorAction, SIGNAL(triggered()), this, SLOT(openInExternalEditor()));
|
||||||
|
|
||||||
// Connect to VariableManager for CURRENT_DOCUMENT variable setting
|
// Connect to VariableManager for CURRENT_DOCUMENT variable setting
|
||||||
VariableManager *vm = VariableManager::instance();
|
VariableManager::initEditorManagerConnections();
|
||||||
connect(this, SIGNAL(currentEditorChanged(Core::IEditor *)),
|
|
||||||
vm, SLOT(updateCurrentDocument(Core::IEditor *)));
|
|
||||||
|
|
||||||
|
|
||||||
// other setup
|
// other setup
|
||||||
m_d->m_splitter = new SplitterOrView(m_d->m_editorModel);
|
m_d->m_splitter = new SplitterOrView(m_d->m_editorModel);
|
||||||
m_d->m_view = m_d->m_splitter->view();
|
m_d->m_view = m_d->m_splitter->view();
|
||||||
|
|||||||
@@ -38,21 +38,44 @@ Q_DECLARE_METATYPE(Core::IEditor*)
|
|||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
OpenEditorsModel::OpenEditorsModel(QObject *parent) :
|
struct OpenEditorsModelPrivate {
|
||||||
QAbstractItemModel(parent),
|
OpenEditorsModelPrivate();
|
||||||
|
|
||||||
|
const QIcon m_lockedIcon;
|
||||||
|
const QIcon m_unlockedIcon;
|
||||||
|
|
||||||
|
QList<OpenEditorsModel::Entry> m_editors;
|
||||||
|
QList<IEditor *> m_duplicateEditors;
|
||||||
|
};
|
||||||
|
|
||||||
|
OpenEditorsModelPrivate::OpenEditorsModelPrivate() :
|
||||||
m_lockedIcon(QLatin1String(":/core/images/locked.png")),
|
m_lockedIcon(QLatin1String(":/core/images/locked.png")),
|
||||||
m_unlockedIcon(QLatin1String(":/core/images/unlocked.png"))
|
m_unlockedIcon(QLatin1String(":/core/images/unlocked.png"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OpenEditorsModel::Entry::Entry() :
|
||||||
|
editor(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenEditorsModel::OpenEditorsModel(QObject *parent) :
|
||||||
|
QAbstractItemModel(parent), d(new OpenEditorsModelPrivate)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenEditorsModel::~OpenEditorsModel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
QIcon OpenEditorsModel::lockedIcon() const
|
QIcon OpenEditorsModel::lockedIcon() const
|
||||||
{
|
{
|
||||||
return m_lockedIcon;
|
return d->m_lockedIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon OpenEditorsModel::unlockedIcon() const
|
QIcon OpenEditorsModel::unlockedIcon() const
|
||||||
{
|
{
|
||||||
return m_unlockedIcon;
|
return d->m_unlockedIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString OpenEditorsModel::Entry::fileName() const {
|
QString OpenEditorsModel::Entry::fileName() const {
|
||||||
@@ -77,14 +100,14 @@ int OpenEditorsModel::columnCount(const QModelIndex &parent) const
|
|||||||
int OpenEditorsModel::rowCount(const QModelIndex &parent) const
|
int OpenEditorsModel::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
if (!parent.isValid())
|
if (!parent.isValid())
|
||||||
return m_editors.count();
|
return d->m_editors.count();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<IEditor *> OpenEditorsModel::editors() const
|
QList<IEditor *> OpenEditorsModel::editors() const
|
||||||
{
|
{
|
||||||
QList<IEditor *> result;
|
QList<IEditor *> result;
|
||||||
foreach (const Entry &entry, m_editors)
|
foreach (const Entry &entry, d->m_editors)
|
||||||
if (entry.editor)
|
if (entry.editor)
|
||||||
result += entry.editor;
|
result += entry.editor;
|
||||||
return result;
|
return result;
|
||||||
@@ -96,7 +119,7 @@ void OpenEditorsModel::addEditor(IEditor *editor, bool isDuplicate)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (isDuplicate) {
|
if (isDuplicate) {
|
||||||
m_duplicateEditors.append(editor);
|
d->m_duplicateEditors.append(editor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,8 +139,8 @@ void OpenEditorsModel::addRestoredEditor(const QString &fileName, const QString
|
|||||||
|
|
||||||
QModelIndex OpenEditorsModel::firstRestoredEditor() const
|
QModelIndex OpenEditorsModel::firstRestoredEditor() const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_editors.count(); ++i)
|
for (int i = 0; i < d->m_editors.count(); ++i)
|
||||||
if (!m_editors.at(i).editor)
|
if (!d->m_editors.at(i).editor)
|
||||||
return createIndex(i, 0);
|
return createIndex(i, 0);
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
}
|
}
|
||||||
@@ -128,8 +151,8 @@ void OpenEditorsModel::addEntry(const Entry &entry)
|
|||||||
|
|
||||||
int previousIndex = findFileName(fileName);
|
int previousIndex = findFileName(fileName);
|
||||||
if (previousIndex >= 0) {
|
if (previousIndex >= 0) {
|
||||||
if (entry.editor && m_editors.at(previousIndex).editor == 0) {
|
if (entry.editor && d->m_editors.at(previousIndex).editor == 0) {
|
||||||
m_editors[previousIndex] = entry;
|
d->m_editors[previousIndex] = entry;
|
||||||
connect(entry.editor, SIGNAL(changed()), this, SLOT(itemChanged()));
|
connect(entry.editor, SIGNAL(changed()), this, SLOT(itemChanged()));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -137,13 +160,13 @@ void OpenEditorsModel::addEntry(const Entry &entry)
|
|||||||
|
|
||||||
int index;
|
int index;
|
||||||
QString displayName = entry.displayName();
|
QString displayName = entry.displayName();
|
||||||
for (index = 0; index < m_editors.count(); ++index) {
|
for (index = 0; index < d->m_editors.count(); ++index) {
|
||||||
if (displayName < m_editors.at(index).displayName())
|
if (displayName < d->m_editors.at(index).displayName())
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
beginInsertRows(QModelIndex(), index, index);
|
beginInsertRows(QModelIndex(), index, index);
|
||||||
m_editors.insert(index, entry);
|
d->m_editors.insert(index, entry);
|
||||||
if (entry.editor)
|
if (entry.editor)
|
||||||
connect(entry.editor, SIGNAL(changed()), this, SLOT(itemChanged()));
|
connect(entry.editor, SIGNAL(changed()), this, SLOT(itemChanged()));
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
@@ -152,8 +175,8 @@ void OpenEditorsModel::addEntry(const Entry &entry)
|
|||||||
|
|
||||||
int OpenEditorsModel::findEditor(IEditor *editor) const
|
int OpenEditorsModel::findEditor(IEditor *editor) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_editors.count(); ++i)
|
for (int i = 0; i < d->m_editors.count(); ++i)
|
||||||
if (m_editors.at(i).editor == editor)
|
if (d->m_editors.at(i).editor == editor)
|
||||||
return i;
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -162,8 +185,8 @@ int OpenEditorsModel::findFileName(const QString &filename) const
|
|||||||
{
|
{
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
return -1;
|
return -1;
|
||||||
for (int i = 0; i < m_editors.count(); ++i) {
|
for (int i = 0; i < d->m_editors.count(); ++i) {
|
||||||
if (m_editors.at(i).fileName() == filename)
|
if (d->m_editors.at(i).fileName() == filename)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
@@ -171,12 +194,12 @@ int OpenEditorsModel::findFileName(const QString &filename) const
|
|||||||
|
|
||||||
void OpenEditorsModel::removeEditor(IEditor *editor)
|
void OpenEditorsModel::removeEditor(IEditor *editor)
|
||||||
{
|
{
|
||||||
m_duplicateEditors.removeAll(editor);
|
d->m_duplicateEditors.removeAll(editor);
|
||||||
int idx = findEditor(editor);
|
int idx = findEditor(editor);
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
return;
|
return;
|
||||||
beginRemoveRows(QModelIndex(), idx, idx);
|
beginRemoveRows(QModelIndex(), idx, idx);
|
||||||
m_editors.removeAt(idx);
|
d->m_editors.removeAt(idx);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
disconnect(editor, SIGNAL(changed()), this, SLOT(itemChanged()));
|
disconnect(editor, SIGNAL(changed()), this, SLOT(itemChanged()));
|
||||||
}
|
}
|
||||||
@@ -186,9 +209,9 @@ void OpenEditorsModel::removeEditor(const QModelIndex &index)
|
|||||||
int idx = index.row();
|
int idx = index.row();
|
||||||
if (idx < 0)
|
if (idx < 0)
|
||||||
return;
|
return;
|
||||||
IEditor *editor= m_editors.at(idx).editor;
|
IEditor *editor= d->m_editors.at(idx).editor;
|
||||||
beginRemoveRows(QModelIndex(), idx, idx);
|
beginRemoveRows(QModelIndex(), idx, idx);
|
||||||
m_editors.removeAt(idx);
|
d->m_editors.removeAt(idx);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
if (editor)
|
if (editor)
|
||||||
disconnect(editor, SIGNAL(changed()), this, SLOT(itemChanged()));
|
disconnect(editor, SIGNAL(changed()), this, SLOT(itemChanged()));
|
||||||
@@ -196,10 +219,10 @@ void OpenEditorsModel::removeEditor(const QModelIndex &index)
|
|||||||
|
|
||||||
void OpenEditorsModel::removeAllRestoredEditors()
|
void OpenEditorsModel::removeAllRestoredEditors()
|
||||||
{
|
{
|
||||||
for (int i = m_editors.count()-1; i >= 0; --i) {
|
for (int i = d->m_editors.count()-1; i >= 0; --i) {
|
||||||
if (!m_editors.at(i).editor) {
|
if (!d->m_editors.at(i).editor) {
|
||||||
beginRemoveRows(QModelIndex(), i, i);
|
beginRemoveRows(QModelIndex(), i, i);
|
||||||
m_editors.removeAt(i);
|
d->m_editors.removeAt(i);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,9 +231,9 @@ void OpenEditorsModel::removeAllRestoredEditors()
|
|||||||
QList<OpenEditorsModel::Entry> OpenEditorsModel::restoredEditors() const
|
QList<OpenEditorsModel::Entry> OpenEditorsModel::restoredEditors() const
|
||||||
{
|
{
|
||||||
QList<Entry> result;
|
QList<Entry> result;
|
||||||
for (int i = m_editors.count()-1; i >= 0; --i) {
|
for (int i = d->m_editors.count()-1; i >= 0; --i) {
|
||||||
if (!m_editors.at(i).editor) {
|
if (!d->m_editors.at(i).editor) {
|
||||||
result.append(m_editors.at(i));
|
result.append(d->m_editors.at(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -218,13 +241,13 @@ QList<OpenEditorsModel::Entry> OpenEditorsModel::restoredEditors() const
|
|||||||
|
|
||||||
bool OpenEditorsModel::isDuplicate(IEditor *editor) const
|
bool OpenEditorsModel::isDuplicate(IEditor *editor) const
|
||||||
{
|
{
|
||||||
return editor && m_duplicateEditors.contains(editor);
|
return editor && d->m_duplicateEditors.contains(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
IEditor *OpenEditorsModel::originalForDuplicate(IEditor *duplicate) const
|
IEditor *OpenEditorsModel::originalForDuplicate(IEditor *duplicate) const
|
||||||
{
|
{
|
||||||
IFile *file = duplicate->file();
|
IFile *file = duplicate->file();
|
||||||
foreach(const Entry &e, m_editors)
|
foreach(const Entry &e, d->m_editors)
|
||||||
if (e.editor && e.editor->file() == file)
|
if (e.editor && e.editor->file() == file)
|
||||||
return e.editor;
|
return e.editor;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -234,7 +257,7 @@ QList<IEditor *> OpenEditorsModel::duplicatesFor(IEditor *editor) const
|
|||||||
{
|
{
|
||||||
QList<IEditor *> result;
|
QList<IEditor *> result;
|
||||||
IFile *file = editor->file();
|
IFile *file = editor->file();
|
||||||
foreach(IEditor *e, m_duplicateEditors)
|
foreach(IEditor *e, d->m_duplicateEditors)
|
||||||
if (e->file() == file)
|
if (e->file() == file)
|
||||||
result += e;
|
result += e;
|
||||||
return result;
|
return result;
|
||||||
@@ -246,9 +269,9 @@ void OpenEditorsModel::makeOriginal(IEditor *duplicate)
|
|||||||
IEditor *original = originalForDuplicate(duplicate);
|
IEditor *original = originalForDuplicate(duplicate);
|
||||||
Q_ASSERT(original);
|
Q_ASSERT(original);
|
||||||
int i = findEditor(original);
|
int i = findEditor(original);
|
||||||
m_editors[i].editor = duplicate;
|
d->m_editors[i].editor = duplicate;
|
||||||
m_duplicateEditors.removeOne(duplicate);
|
d->m_duplicateEditors.removeOne(duplicate);
|
||||||
m_duplicateEditors.append(original);
|
d->m_duplicateEditors.append(original);
|
||||||
disconnect(original, SIGNAL(changed()), this, SLOT(itemChanged()));
|
disconnect(original, SIGNAL(changed()), this, SLOT(itemChanged()));
|
||||||
connect(duplicate, SIGNAL(changed()), this, SLOT(itemChanged()));
|
connect(duplicate, SIGNAL(changed()), this, SLOT(itemChanged()));
|
||||||
}
|
}
|
||||||
@@ -265,7 +288,7 @@ void OpenEditorsModel::emitDataChanged(IEditor *editor)
|
|||||||
QModelIndex OpenEditorsModel::index(int row, int column, const QModelIndex &parent) const
|
QModelIndex OpenEditorsModel::index(int row, int column, const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent)
|
Q_UNUSED(parent)
|
||||||
if (column < 0 || column > 1 || row < 0 || row >= m_editors.count())
|
if (column < 0 || column > 1 || row < 0 || row >= d->m_editors.count())
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
return createIndex(row, column);
|
return createIndex(row, column);
|
||||||
}
|
}
|
||||||
@@ -274,7 +297,7 @@ QVariant OpenEditorsModel::data(const QModelIndex &index, int role) const
|
|||||||
{
|
{
|
||||||
if (!index.isValid() || (index.column() != 0 && role < Qt::UserRole))
|
if (!index.isValid() || (index.column() != 0 && role < Qt::UserRole))
|
||||||
return QVariant();
|
return QVariant();
|
||||||
Entry e = m_editors.at(index.row());
|
Entry e = d->m_editors.at(index.row());
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
return (e.editor && e.editor->file()->isModified())
|
return (e.editor && e.editor->file()->isModified())
|
||||||
@@ -282,7 +305,7 @@ QVariant OpenEditorsModel::data(const QModelIndex &index, int role) const
|
|||||||
: e.displayName();
|
: e.displayName();
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
return (e.editor && e.editor->file()->isReadOnly())
|
return (e.editor && e.editor->file()->isReadOnly())
|
||||||
? m_lockedIcon : QIcon();
|
? d->m_lockedIcon : QIcon();
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
return e.fileName().isEmpty()
|
return e.fileName().isEmpty()
|
||||||
? e.displayName()
|
? e.displayName()
|
||||||
@@ -307,9 +330,9 @@ QModelIndex OpenEditorsModel::indexOf(IEditor *editor) const
|
|||||||
|
|
||||||
QString OpenEditorsModel::displayNameForFile(IFile *file) const
|
QString OpenEditorsModel::displayNameForFile(IFile *file) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_editors.count(); ++i)
|
for (int i = 0; i < d->m_editors.count(); ++i)
|
||||||
if (m_editors.at(i).editor && m_editors.at(i).editor->file() == file)
|
if (d->m_editors.at(i).editor && d->m_editors.at(i).editor->file() == file)
|
||||||
return m_editors.at(i).editor->displayName();
|
return d->m_editors.at(i).editor->displayName();
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,4 +341,14 @@ void OpenEditorsModel::itemChanged()
|
|||||||
emitDataChanged(qobject_cast<IEditor*>(sender()));
|
emitDataChanged(qobject_cast<IEditor*>(sender()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<OpenEditorsModel::Entry> OpenEditorsModel::entries() const
|
||||||
|
{
|
||||||
|
return d->m_editors;
|
||||||
|
}
|
||||||
|
|
||||||
|
IEditor *OpenEditorsModel::editorAt(int row) const
|
||||||
|
{
|
||||||
|
return d->m_editors.at(row).editor;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|||||||
@@ -33,10 +33,13 @@
|
|||||||
#include "../core_global.h"
|
#include "../core_global.h"
|
||||||
|
|
||||||
#include <QtCore/QAbstractItemModel>
|
#include <QtCore/QAbstractItemModel>
|
||||||
#include <QtGui/QIcon>
|
#include <QtCore/QScopedPointer>
|
||||||
|
|
||||||
|
QT_FORWARD_DECLARE_CLASS(QIcon)
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
struct OpenEditorsModelPrivate;
|
||||||
class IEditor;
|
class IEditor;
|
||||||
class IFile;
|
class IFile;
|
||||||
|
|
||||||
@@ -45,6 +48,7 @@ class CORE_EXPORT OpenEditorsModel : public QAbstractItemModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit OpenEditorsModel(QObject *parent);
|
explicit OpenEditorsModel(QObject *parent);
|
||||||
|
virtual ~OpenEditorsModel();
|
||||||
|
|
||||||
QIcon lockedIcon() const;
|
QIcon lockedIcon() const;
|
||||||
QIcon unlockedIcon() const;
|
QIcon unlockedIcon() const;
|
||||||
@@ -60,7 +64,7 @@ public:
|
|||||||
QModelIndex firstRestoredEditor() const;
|
QModelIndex firstRestoredEditor() const;
|
||||||
|
|
||||||
struct CORE_EXPORT Entry {
|
struct CORE_EXPORT Entry {
|
||||||
Entry() : editor(0) {}
|
Entry();
|
||||||
IEditor *editor;
|
IEditor *editor;
|
||||||
QString fileName() const;
|
QString fileName() const;
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
@@ -69,9 +73,9 @@ public:
|
|||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
QString m_id;
|
QString m_id;
|
||||||
};
|
};
|
||||||
QList<Entry> entries() const { return m_editors; }
|
QList<Entry> entries() const;
|
||||||
|
|
||||||
IEditor *editorAt(int row) const { return m_editors.at(row).editor; }
|
IEditor *editorAt(int row) const;
|
||||||
|
|
||||||
void removeEditor(IEditor *editor);
|
void removeEditor(IEditor *editor);
|
||||||
void removeEditor(const QModelIndex &index);
|
void removeEditor(const QModelIndex &index);
|
||||||
@@ -97,11 +101,7 @@ private:
|
|||||||
int findEditor(IEditor *editor) const;
|
int findEditor(IEditor *editor) const;
|
||||||
int findFileName(const QString &filename) const;
|
int findFileName(const QString &filename) const;
|
||||||
|
|
||||||
const QIcon m_lockedIcon;
|
QScopedPointer<OpenEditorsModelPrivate> d;
|
||||||
const QIcon m_unlockedIcon;
|
|
||||||
|
|
||||||
QList<Entry> m_editors;
|
|
||||||
QList<IEditor *> m_duplicateEditors;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|||||||
@@ -161,10 +161,10 @@ private:
|
|||||||
class CORE_EXPORT FileChangeBlocker
|
class CORE_EXPORT FileChangeBlocker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FileChangeBlocker(const QString &fileName);
|
explicit FileChangeBlocker(const QString &fileName);
|
||||||
~FileChangeBlocker();
|
~FileChangeBlocker();
|
||||||
private:
|
private:
|
||||||
QString m_fileName;
|
const QString m_fileName;
|
||||||
Q_DISABLE_COPY(FileChangeBlocker)
|
Q_DISABLE_COPY(FileChangeBlocker)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
#include "progressview.h"
|
#include "progressview.h"
|
||||||
#include "shortcutsettings.h"
|
#include "shortcutsettings.h"
|
||||||
#include "vcsmanager.h"
|
#include "vcsmanager.h"
|
||||||
|
#include "ieditor.h"
|
||||||
|
|
||||||
#include "scriptmanager_p.h"
|
#include "scriptmanager_p.h"
|
||||||
#include "settingsdialog.h"
|
#include "settingsdialog.h"
|
||||||
@@ -130,7 +131,7 @@ MainWindow::MainWindow() :
|
|||||||
m_fileManager(new FileManager(this)),
|
m_fileManager(new FileManager(this)),
|
||||||
m_progressManager(new ProgressManagerPrivate()),
|
m_progressManager(new ProgressManagerPrivate()),
|
||||||
m_scriptManager(new ScriptManagerPrivate(this)),
|
m_scriptManager(new ScriptManagerPrivate(this)),
|
||||||
m_variableManager(new VariableManager(this)),
|
m_variableManager(new VariableManager),
|
||||||
m_vcsManager(new VCSManager),
|
m_vcsManager(new VCSManager),
|
||||||
m_statusBarManager(0),
|
m_statusBarManager(0),
|
||||||
m_modeManager(0),
|
m_modeManager(0),
|
||||||
@@ -1020,7 +1021,7 @@ ScriptManager *MainWindow::scriptManager() const
|
|||||||
|
|
||||||
VariableManager *MainWindow::variableManager() const
|
VariableManager *MainWindow::variableManager() const
|
||||||
{
|
{
|
||||||
return m_variableManager;
|
return m_variableManager.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
ModeManager *MainWindow::modeManager() const
|
ModeManager *MainWindow::modeManager() const
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ private:
|
|||||||
MessageManager *m_messageManager;
|
MessageManager *m_messageManager;
|
||||||
ProgressManagerPrivate *m_progressManager;
|
ProgressManagerPrivate *m_progressManager;
|
||||||
ScriptManager *m_scriptManager;
|
ScriptManager *m_scriptManager;
|
||||||
VariableManager *m_variableManager;
|
QScopedPointer<VariableManager> m_variableManager;
|
||||||
VCSManager *m_vcsManager;
|
VCSManager *m_vcsManager;
|
||||||
StatusBarManager *m_statusBarManager;
|
StatusBarManager *m_statusBarManager;
|
||||||
ModeManager *m_modeManager;
|
ModeManager *m_modeManager;
|
||||||
|
|||||||
@@ -29,29 +29,61 @@
|
|||||||
|
|
||||||
#include "variablemanager.h"
|
#include "variablemanager.h"
|
||||||
#include "ifile.h"
|
#include "ifile.h"
|
||||||
|
#include "editormanager/ieditor.h"
|
||||||
|
#include "editormanager/editormanager.h"
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QMap>
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
using namespace Core;
|
namespace Core {
|
||||||
|
|
||||||
VariableManager *VariableManager::m_instance = 0;
|
class VariableManagerPrivate : public QObject
|
||||||
|
|
||||||
VariableManager::VariableManager(QObject *parent) : QObject(parent)
|
|
||||||
{
|
{
|
||||||
m_instance = this;
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
void insert(const QString &variable, const QString &value);
|
||||||
|
bool remove(const QString &variable);
|
||||||
|
void insertFileInfo(const QString &tag, const QFileInfo &file);
|
||||||
|
void removeFileInfo(const QString &tag);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void updateCurrentDocument(Core::IEditor *editor);
|
||||||
|
|
||||||
|
public:
|
||||||
|
QMap<QString, QString> m_map;
|
||||||
|
static VariableManager *m_instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
VariableManager *VariableManagerPrivate::m_instance = 0;
|
||||||
|
|
||||||
|
void VariableManagerPrivate::updateCurrentDocument(Core::IEditor *editor)
|
||||||
|
{
|
||||||
|
const QString currentDocumentTag = QLatin1String("CURRENT_DOCUMENT");
|
||||||
|
removeFileInfo(currentDocumentTag);
|
||||||
|
if (editor) {
|
||||||
|
if (const Core::IFile *file = editor->file()) {
|
||||||
|
const QString fileName = file->fileName();
|
||||||
|
if (!fileName.isEmpty())
|
||||||
|
insertFileInfo(currentDocumentTag, fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VariableManager::~VariableManager()
|
void VariableManagerPrivate::insert(const QString &variable, const QString &value)
|
||||||
{
|
|
||||||
m_instance = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VariableManager::insert(const QString &variable, const QString &value)
|
|
||||||
{
|
{
|
||||||
m_map.insert(variable, value);
|
m_map.insert(variable, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VariableManager::insertFileInfo(const QString &tag, const QFileInfo &file)
|
bool VariableManagerPrivate::remove(const QString &variable)
|
||||||
|
{
|
||||||
|
return m_map.remove(variable) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VariableManagerPrivate::insertFileInfo(const QString &tag, const QFileInfo &file)
|
||||||
{
|
{
|
||||||
insert(tag, file.filePath());
|
insert(tag, file.filePath());
|
||||||
insert(tag + QLatin1String(":absoluteFilePath"), file.absoluteFilePath());
|
insert(tag + QLatin1String(":absoluteFilePath"), file.absoluteFilePath());
|
||||||
@@ -67,7 +99,7 @@ void VariableManager::insertFileInfo(const QString &tag, const QFileInfo &file)
|
|||||||
insert(tag + QLatin1String(":suffix"), file.suffix());
|
insert(tag + QLatin1String(":suffix"), file.suffix());
|
||||||
}
|
}
|
||||||
|
|
||||||
void VariableManager::removeFileInfo(const QString &tag)
|
void VariableManagerPrivate::removeFileInfo(const QString &tag)
|
||||||
{
|
{
|
||||||
if (remove(tag)) {
|
if (remove(tag)) {
|
||||||
remove(tag + QLatin1String(":absoluteFilePath"));
|
remove(tag + QLatin1String(":absoluteFilePath"));
|
||||||
@@ -84,38 +116,38 @@ void VariableManager::removeFileInfo(const QString &tag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VariableManager::updateCurrentDocument(Core::IEditor *editor)
|
VariableManager::VariableManager() : d(new VariableManagerPrivate)
|
||||||
{
|
{
|
||||||
const QString currentDocumentTag = QLatin1String("CURRENT_DOCUMENT");
|
VariableManagerPrivate::m_instance = this;
|
||||||
removeFileInfo(currentDocumentTag);
|
}
|
||||||
if (editor) {
|
|
||||||
if (const Core::IFile *file = editor->file()) {
|
VariableManager::~VariableManager()
|
||||||
const QString fileName = file->fileName();
|
{
|
||||||
if (!fileName.isEmpty())
|
VariableManagerPrivate::m_instance = 0;
|
||||||
insertFileInfo(currentDocumentTag, fileName);
|
}
|
||||||
}
|
|
||||||
}
|
void VariableManager::initEditorManagerConnections()
|
||||||
|
{
|
||||||
|
QTC_ASSERT(VariableManagerPrivate::m_instance && Core::EditorManager::instance(), return; )
|
||||||
|
|
||||||
|
QObject::connect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||||
|
VariableManagerPrivate::m_instance->d.data(), SLOT(updateCurrentDocument(Core::IEditor*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VariableManager::value(const QString &variable) const
|
QString VariableManager::value(const QString &variable) const
|
||||||
{
|
{
|
||||||
return m_map.value(variable);
|
return d->m_map.value(variable);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VariableManager::value(const QString &variable, const QString &defaultValue) const
|
QString VariableManager::value(const QString &variable, const QString &defaultValue) const
|
||||||
{
|
{
|
||||||
return m_map.value(variable, defaultValue);
|
return d->m_map.value(variable, defaultValue);
|
||||||
}
|
|
||||||
|
|
||||||
bool VariableManager::remove(const QString &variable)
|
|
||||||
{
|
|
||||||
return m_map.remove(variable) > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VariableManager::resolve(const QString &stringWithVariables) const
|
QString VariableManager::resolve(const QString &stringWithVariables) const
|
||||||
{
|
{
|
||||||
QString result = stringWithVariables;
|
QString result = stringWithVariables;
|
||||||
QMapIterator<QString, QString> i(m_map);
|
QMapIterator<QString, QString> i(d->m_map);
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
QString key = QLatin1String("${");
|
QString key = QLatin1String("${");
|
||||||
@@ -125,3 +157,31 @@ QString VariableManager::resolve(const QString &stringWithVariables) const
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VariableManager::insert(const QString &variable, const QString &value)
|
||||||
|
{
|
||||||
|
d->insert(variable, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VariableManager::insertFileInfo(const QString &tag, const QFileInfo &file)
|
||||||
|
{
|
||||||
|
d->insertFileInfo(tag, file);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VariableManager::removeFileInfo(const QString &tag)
|
||||||
|
{
|
||||||
|
d->removeFileInfo(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VariableManager::remove(const QString &variable)
|
||||||
|
{
|
||||||
|
return d->remove(variable);
|
||||||
|
}
|
||||||
|
|
||||||
|
VariableManager* VariableManager::instance()
|
||||||
|
{
|
||||||
|
return VariableManagerPrivate::m_instance;
|
||||||
|
}
|
||||||
|
} // namespace Core
|
||||||
|
|
||||||
|
#include "variablemanager.moc"
|
||||||
|
|||||||
@@ -31,10 +31,8 @@
|
|||||||
#define VARIABLEMANAGER_H
|
#define VARIABLEMANAGER_H
|
||||||
|
|
||||||
#include "core_global.h"
|
#include "core_global.h"
|
||||||
#include <coreplugin/editormanager/ieditor.h>
|
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QScopedPointer>
|
||||||
#include <QtCore/QMap>
|
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -42,16 +40,17 @@ class QFileInfo;
|
|||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
class VariableManagerPrivate;
|
||||||
|
|
||||||
class CORE_EXPORT VariableManager : public QObject
|
class CORE_EXPORT VariableManager
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_DISABLE_COPY(VariableManager)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
VariableManager(QObject *parent);
|
VariableManager();
|
||||||
~VariableManager();
|
~VariableManager();
|
||||||
|
|
||||||
static VariableManager* instance() { return m_instance; }
|
static VariableManager* instance();
|
||||||
|
static void initEditorManagerConnections();
|
||||||
|
|
||||||
void insert(const QString &variable, const QString &value);
|
void insert(const QString &variable, const QString &value);
|
||||||
void insertFileInfo(const QString &tag, const QFileInfo &file);
|
void insertFileInfo(const QString &tag, const QFileInfo &file);
|
||||||
@@ -61,12 +60,8 @@ public:
|
|||||||
bool remove(const QString &variable);
|
bool remove(const QString &variable);
|
||||||
QString resolve(const QString &stringWithVariables) const;
|
QString resolve(const QString &stringWithVariables) const;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void updateCurrentDocument(Core::IEditor *editor);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, QString> m_map;
|
QScopedPointer<VariableManagerPrivate> d;
|
||||||
static VariableManager *m_instance;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|||||||
@@ -30,11 +30,13 @@
|
|||||||
#ifndef CPPTOOLSEDITORSUPPORT_H
|
#ifndef CPPTOOLSEDITORSUPPORT_H
|
||||||
#define CPPTOOLSEDITORSUPPORT_H
|
#define CPPTOOLSEDITORSUPPORT_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QPointer>
|
#include <QtCore/QPointer>
|
||||||
#include <QFuture>
|
#include <QtCore/QFuture>
|
||||||
#include <QSharedPointer>
|
#include <QtCore/QSharedPointer>
|
||||||
#include <QTextCursor>
|
|
||||||
|
#include <QtGui/QTextCursor>
|
||||||
|
|
||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|||||||
@@ -36,11 +36,11 @@
|
|||||||
#include <Symbols.h>
|
#include <Symbols.h>
|
||||||
#include <SymbolVisitor.h>
|
#include <SymbolVisitor.h>
|
||||||
|
|
||||||
#include <QIcon>
|
#include <QtGui/QIcon>
|
||||||
#include <QMetaType>
|
#include <QtCore/QMetaType>
|
||||||
#include <QString>
|
#include <QtCore/QString>
|
||||||
#include <QSet>
|
#include <QtCore/QSet>
|
||||||
#include <QHash>
|
#include <QtCore/QHash>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,8 @@
|
|||||||
#define DESIGNERCONTEXT_H
|
#define DESIGNERCONTEXT_H
|
||||||
|
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
#include <QList>
|
|
||||||
|
#include <QtCore/QList>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|||||||
@@ -32,12 +32,28 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/filesearch.h>
|
#include <utils/filesearch.h>
|
||||||
|
|
||||||
|
#include <QtCore/QPointer>
|
||||||
|
|
||||||
#include <QtGui/QTextBlock>
|
#include <QtGui/QTextBlock>
|
||||||
#include <QtGui/QPlainTextEdit>
|
#include <QtGui/QPlainTextEdit>
|
||||||
|
#include <QtGui/QTextCursor>
|
||||||
|
|
||||||
using namespace Find;
|
namespace Find {
|
||||||
|
|
||||||
BaseTextFind::BaseTextFind(QTextEdit *editor)
|
struct BaseTextFindPrivate {
|
||||||
|
explicit BaseTextFindPrivate(QPlainTextEdit *editor);
|
||||||
|
explicit BaseTextFindPrivate(QTextEdit *editor);
|
||||||
|
|
||||||
|
QPointer<QTextEdit> m_editor;
|
||||||
|
QPointer<QPlainTextEdit> m_plaineditor;
|
||||||
|
QTextCursor m_findScopeStart;
|
||||||
|
QTextCursor m_findScopeEnd;
|
||||||
|
int m_findScopeVerticalBlockSelectionFirstColumn;
|
||||||
|
int m_findScopeVerticalBlockSelectionLastColumn;
|
||||||
|
int m_incrementalStartPos;
|
||||||
|
};
|
||||||
|
|
||||||
|
BaseTextFindPrivate::BaseTextFindPrivate(QTextEdit *editor)
|
||||||
: m_editor(editor)
|
: m_editor(editor)
|
||||||
, m_findScopeVerticalBlockSelectionFirstColumn(-1)
|
, m_findScopeVerticalBlockSelectionFirstColumn(-1)
|
||||||
, m_findScopeVerticalBlockSelectionLastColumn(-1)
|
, m_findScopeVerticalBlockSelectionLastColumn(-1)
|
||||||
@@ -45,7 +61,7 @@ BaseTextFind::BaseTextFind(QTextEdit *editor)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseTextFind::BaseTextFind(QPlainTextEdit *editor)
|
BaseTextFindPrivate::BaseTextFindPrivate(QPlainTextEdit *editor)
|
||||||
: m_plaineditor(editor)
|
: m_plaineditor(editor)
|
||||||
, m_findScopeVerticalBlockSelectionFirstColumn(-1)
|
, m_findScopeVerticalBlockSelectionFirstColumn(-1)
|
||||||
, m_findScopeVerticalBlockSelectionLastColumn(-1)
|
, m_findScopeVerticalBlockSelectionLastColumn(-1)
|
||||||
@@ -53,29 +69,44 @@ BaseTextFind::BaseTextFind(QPlainTextEdit *editor)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BaseTextFind::BaseTextFind(QTextEdit *editor)
|
||||||
|
: d(new BaseTextFindPrivate(editor))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BaseTextFind::BaseTextFind(QPlainTextEdit *editor)
|
||||||
|
: d(new BaseTextFindPrivate(editor))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseTextFind::~BaseTextFind()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
QTextCursor BaseTextFind::textCursor() const
|
QTextCursor BaseTextFind::textCursor() const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_editor || m_plaineditor, return QTextCursor());
|
QTC_ASSERT(d->m_editor || d->m_plaineditor, return QTextCursor());
|
||||||
return m_editor ? m_editor->textCursor() : m_plaineditor->textCursor();
|
return d->m_editor ? d->m_editor->textCursor() : d->m_plaineditor->textCursor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextFind::setTextCursor(const QTextCursor& cursor)
|
void BaseTextFind::setTextCursor(const QTextCursor& cursor)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_editor || m_plaineditor, return);
|
QTC_ASSERT(d->m_editor || d->m_plaineditor, return);
|
||||||
m_editor ? m_editor->setTextCursor(cursor) : m_plaineditor->setTextCursor(cursor);
|
d->m_editor ? d->m_editor->setTextCursor(cursor) : d->m_plaineditor->setTextCursor(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextDocument *BaseTextFind::document() const
|
QTextDocument *BaseTextFind::document() const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_editor || m_plaineditor, return 0);
|
QTC_ASSERT(d->m_editor || d->m_plaineditor, return 0);
|
||||||
return m_editor ? m_editor->document() : m_plaineditor->document();
|
return d->m_editor ? d->m_editor->document() : d->m_plaineditor->document();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseTextFind::isReadOnly() const
|
bool BaseTextFind::isReadOnly() const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_editor || m_plaineditor, return true);
|
QTC_ASSERT(d->m_editor || d->m_plaineditor, return true);
|
||||||
return m_editor ? m_editor->isReadOnly() : m_plaineditor->isReadOnly();
|
return d->m_editor ? d->m_editor->isReadOnly() : d->m_plaineditor->isReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseTextFind::supportsReplace() const
|
bool BaseTextFind::supportsReplace() const
|
||||||
@@ -91,7 +122,7 @@ Find::FindFlags BaseTextFind::supportedFindFlags() const
|
|||||||
|
|
||||||
void BaseTextFind::resetIncrementalSearch()
|
void BaseTextFind::resetIncrementalSearch()
|
||||||
{
|
{
|
||||||
m_incrementalStartPos = -1;
|
d->m_incrementalStartPos = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextFind::clearResults()
|
void BaseTextFind::clearResults()
|
||||||
@@ -136,9 +167,9 @@ QString BaseTextFind::completedFindString() const
|
|||||||
IFindSupport::Result BaseTextFind::findIncremental(const QString &txt, Find::FindFlags findFlags)
|
IFindSupport::Result BaseTextFind::findIncremental(const QString &txt, Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
if (m_incrementalStartPos < 0)
|
if (d->m_incrementalStartPos < 0)
|
||||||
m_incrementalStartPos = cursor.selectionStart();
|
d->m_incrementalStartPos = cursor.selectionStart();
|
||||||
cursor.setPosition(m_incrementalStartPos);
|
cursor.setPosition(d->m_incrementalStartPos);
|
||||||
bool found = find(txt, findFlags, cursor);
|
bool found = find(txt, findFlags, cursor);
|
||||||
if (found)
|
if (found)
|
||||||
emit highlightAll(txt, findFlags);
|
emit highlightAll(txt, findFlags);
|
||||||
@@ -151,7 +182,7 @@ IFindSupport::Result BaseTextFind::findStep(const QString &txt, Find::FindFlags
|
|||||||
{
|
{
|
||||||
bool found = find(txt, findFlags, textCursor());
|
bool found = find(txt, findFlags, textCursor());
|
||||||
if (found)
|
if (found)
|
||||||
m_incrementalStartPos = textCursor().selectionStart();
|
d->m_incrementalStartPos = textCursor().selectionStart();
|
||||||
return found ? Found : NotFound;
|
return found ? Found : NotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,8 +223,8 @@ int BaseTextFind::replaceAll(const QString &before, const QString &after,
|
|||||||
Find::FindFlags findFlags)
|
Find::FindFlags findFlags)
|
||||||
{
|
{
|
||||||
QTextCursor editCursor = textCursor();
|
QTextCursor editCursor = textCursor();
|
||||||
if (!m_findScopeStart.isNull())
|
if (!d->m_findScopeStart.isNull())
|
||||||
editCursor.setPosition(m_findScopeStart.position());
|
editCursor.setPosition(d->m_findScopeStart.position());
|
||||||
else
|
else
|
||||||
editCursor.movePosition(QTextCursor::Start);
|
editCursor.movePosition(QTextCursor::Start);
|
||||||
editCursor.beginEditBlock();
|
editCursor.beginEditBlock();
|
||||||
@@ -230,14 +261,14 @@ bool BaseTextFind::find(const QString &txt,
|
|||||||
regexp.setCaseSensitivity((findFlags&Find::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
regexp.setCaseSensitivity((findFlags&Find::FindCaseSensitively) ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
||||||
QTextCursor found = findOne(regexp, start, Find::textDocumentFlagsForFindFlags(findFlags));
|
QTextCursor found = findOne(regexp, start, Find::textDocumentFlagsForFindFlags(findFlags));
|
||||||
|
|
||||||
if (!m_findScopeStart.isNull()) {
|
if (!d->m_findScopeStart.isNull()) {
|
||||||
|
|
||||||
// scoped
|
// scoped
|
||||||
if (found.isNull() || !inScope(found.selectionStart(), found.selectionEnd())) {
|
if (found.isNull() || !inScope(found.selectionStart(), found.selectionEnd())) {
|
||||||
if ((findFlags&Find::FindBackward) == 0)
|
if ((findFlags&Find::FindBackward) == 0)
|
||||||
start.setPosition(m_findScopeStart.position());
|
start.setPosition(d->m_findScopeStart.position());
|
||||||
else
|
else
|
||||||
start.setPosition(m_findScopeEnd.position());
|
start.setPosition(d->m_findScopeEnd.position());
|
||||||
found = findOne(regexp, start, Find::textDocumentFlagsForFindFlags(findFlags));
|
found = findOne(regexp, start, Find::textDocumentFlagsForFindFlags(findFlags));
|
||||||
if (found.isNull() || !inScope(found.selectionStart(), found.selectionEnd()))
|
if (found.isNull() || !inScope(found.selectionStart(), found.selectionEnd()))
|
||||||
return false;
|
return false;
|
||||||
@@ -270,13 +301,13 @@ QTextCursor BaseTextFind::findOne(const QRegExp &expr, const QTextCursor &from,
|
|||||||
if (candidate.isNull())
|
if (candidate.isNull())
|
||||||
return candidate;
|
return candidate;
|
||||||
|
|
||||||
if (m_findScopeVerticalBlockSelectionFirstColumn < 0)
|
if (d->m_findScopeVerticalBlockSelectionFirstColumn < 0)
|
||||||
return candidate;
|
return candidate;
|
||||||
forever {
|
forever {
|
||||||
if (!inScope(candidate.selectionStart(), candidate.selectionEnd()))
|
if (!inScope(candidate.selectionStart(), candidate.selectionEnd()))
|
||||||
return candidate;
|
return candidate;
|
||||||
bool inVerticalFindScope = false;
|
bool inVerticalFindScope = false;
|
||||||
QMetaObject::invokeMethod(m_plaineditor, "inFindScope", Qt::DirectConnection,
|
QMetaObject::invokeMethod(d->m_plaineditor, "inFindScope", Qt::DirectConnection,
|
||||||
Q_RETURN_ARG(bool, inVerticalFindScope),
|
Q_RETURN_ARG(bool, inVerticalFindScope),
|
||||||
Q_ARG(QTextCursor, candidate));
|
Q_ARG(QTextCursor, candidate));
|
||||||
if (inVerticalFindScope)
|
if (inVerticalFindScope)
|
||||||
@@ -288,32 +319,32 @@ QTextCursor BaseTextFind::findOne(const QRegExp &expr, const QTextCursor &from,
|
|||||||
|
|
||||||
bool BaseTextFind::inScope(int startPosition, int endPosition) const
|
bool BaseTextFind::inScope(int startPosition, int endPosition) const
|
||||||
{
|
{
|
||||||
if (m_findScopeStart.isNull())
|
if (d->m_findScopeStart.isNull())
|
||||||
return true;
|
return true;
|
||||||
return (m_findScopeStart.position() <= startPosition
|
return (d->m_findScopeStart.position() <= startPosition
|
||||||
&& m_findScopeEnd.position() >= endPosition);
|
&& d->m_findScopeEnd.position() >= endPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextFind::defineFindScope()
|
void BaseTextFind::defineFindScope()
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
if (cursor.hasSelection() && cursor.block() != cursor.document()->findBlock(cursor.anchor())) {
|
if (cursor.hasSelection() && cursor.block() != cursor.document()->findBlock(cursor.anchor())) {
|
||||||
m_findScopeStart = QTextCursor(document()->docHandle(), qMax(0, cursor.selectionStart()-1));
|
d->m_findScopeStart = QTextCursor(document()->docHandle(), qMax(0, cursor.selectionStart()-1));
|
||||||
m_findScopeEnd = QTextCursor(document()->docHandle(), cursor.selectionEnd());
|
d->m_findScopeEnd = QTextCursor(document()->docHandle(), cursor.selectionEnd());
|
||||||
m_findScopeVerticalBlockSelectionFirstColumn = -1;
|
d->m_findScopeVerticalBlockSelectionFirstColumn = -1;
|
||||||
m_findScopeVerticalBlockSelectionLastColumn = -1;
|
d->m_findScopeVerticalBlockSelectionLastColumn = -1;
|
||||||
|
|
||||||
if (m_plaineditor && m_plaineditor->metaObject()->indexOfProperty("verticalBlockSelectionFirstColumn") >= 0) {
|
if (d->m_plaineditor && d->m_plaineditor->metaObject()->indexOfProperty("verticalBlockSelectionFirstColumn") >= 0) {
|
||||||
m_findScopeVerticalBlockSelectionFirstColumn
|
d->m_findScopeVerticalBlockSelectionFirstColumn
|
||||||
= m_plaineditor->property("verticalBlockSelectionFirstColumn").toInt();
|
= d->m_plaineditor->property("verticalBlockSelectionFirstColumn").toInt();
|
||||||
m_findScopeVerticalBlockSelectionLastColumn
|
d->m_findScopeVerticalBlockSelectionLastColumn
|
||||||
= m_plaineditor->property("verticalBlockSelectionLastColumn").toInt();
|
= d->m_plaineditor->property("verticalBlockSelectionLastColumn").toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit findScopeChanged(m_findScopeStart, m_findScopeEnd,
|
emit findScopeChanged(d->m_findScopeStart, d->m_findScopeEnd,
|
||||||
m_findScopeVerticalBlockSelectionFirstColumn,
|
d->m_findScopeVerticalBlockSelectionFirstColumn,
|
||||||
m_findScopeVerticalBlockSelectionLastColumn);
|
d->m_findScopeVerticalBlockSelectionLastColumn);
|
||||||
cursor.setPosition(m_findScopeStart.position()+1);
|
cursor.setPosition(d->m_findScopeStart.position()+1);
|
||||||
setTextCursor(cursor);
|
setTextCursor(cursor);
|
||||||
} else {
|
} else {
|
||||||
clearFindScope();
|
clearFindScope();
|
||||||
@@ -322,11 +353,13 @@ void BaseTextFind::defineFindScope()
|
|||||||
|
|
||||||
void BaseTextFind::clearFindScope()
|
void BaseTextFind::clearFindScope()
|
||||||
{
|
{
|
||||||
m_findScopeStart = QTextCursor();
|
d->m_findScopeStart = QTextCursor();
|
||||||
m_findScopeEnd = QTextCursor();
|
d->m_findScopeEnd = QTextCursor();
|
||||||
m_findScopeVerticalBlockSelectionFirstColumn = -1;
|
d->m_findScopeVerticalBlockSelectionFirstColumn = -1;
|
||||||
m_findScopeVerticalBlockSelectionLastColumn = -1;
|
d->m_findScopeVerticalBlockSelectionLastColumn = -1;
|
||||||
emit findScopeChanged(m_findScopeStart, m_findScopeEnd,
|
emit findScopeChanged(d->m_findScopeStart, d->m_findScopeEnd,
|
||||||
m_findScopeVerticalBlockSelectionFirstColumn,
|
d->m_findScopeVerticalBlockSelectionFirstColumn,
|
||||||
m_findScopeVerticalBlockSelectionLastColumn);
|
d->m_findScopeVerticalBlockSelectionLastColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Find
|
||||||
|
|||||||
@@ -33,23 +33,25 @@
|
|||||||
#include "find_global.h"
|
#include "find_global.h"
|
||||||
#include "ifindsupport.h"
|
#include "ifindsupport.h"
|
||||||
|
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QScopedPointer>
|
||||||
#include <QtGui/QTextCursor>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QPlainTextEdit;
|
class QPlainTextEdit;
|
||||||
class QTextEdit;
|
class QTextEdit;
|
||||||
|
class QTextCursor;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Find {
|
namespace Find {
|
||||||
|
struct BaseTextFindPrivate;
|
||||||
|
|
||||||
class FIND_EXPORT BaseTextFind : public Find::IFindSupport
|
class FIND_EXPORT BaseTextFind : public Find::IFindSupport
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BaseTextFind(QPlainTextEdit *editor);
|
explicit BaseTextFind(QPlainTextEdit *editor);
|
||||||
BaseTextFind(QTextEdit *editor);
|
explicit BaseTextFind(QTextEdit *editor);
|
||||||
|
virtual ~BaseTextFind();
|
||||||
|
|
||||||
bool supportsReplace() const;
|
bool supportsReplace() const;
|
||||||
Find::FindFlags supportedFindFlags() const;
|
Find::FindFlags supportedFindFlags() const;
|
||||||
@@ -87,15 +89,10 @@ private:
|
|||||||
void setTextCursor(const QTextCursor&);
|
void setTextCursor(const QTextCursor&);
|
||||||
QTextDocument *document() const;
|
QTextDocument *document() const;
|
||||||
bool isReadOnly() const;
|
bool isReadOnly() const;
|
||||||
QPointer<QTextEdit> m_editor;
|
|
||||||
QPointer<QPlainTextEdit> m_plaineditor;
|
|
||||||
QTextCursor m_findScopeStart;
|
|
||||||
QTextCursor m_findScopeEnd;
|
|
||||||
int m_findScopeVerticalBlockSelectionFirstColumn;
|
|
||||||
int m_findScopeVerticalBlockSelectionLastColumn;
|
|
||||||
bool inScope(int startPosition, int endPosition) const;
|
bool inScope(int startPosition, int endPosition) const;
|
||||||
QTextCursor findOne(const QRegExp &expr, const QTextCursor &from, QTextDocument::FindFlags options) const;
|
QTextCursor findOne(const QRegExp &expr, const QTextCursor &from, QTextDocument::FindFlags options) const;
|
||||||
int m_incrementalStartPos;
|
|
||||||
|
QScopedPointer<BaseTextFindPrivate> d;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Find
|
} // namespace Find
|
||||||
|
|||||||
@@ -41,8 +41,8 @@
|
|||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <coreplugin/ifile.h>
|
#include <coreplugin/ifile.h>
|
||||||
#include <QFuture>
|
|
||||||
#include <QtGui/QLineEdit>
|
#include <QtCore/QFuture>
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
class PathChooser;
|
class PathChooser;
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
|
|
||||||
#include <projectexplorer/projectnodes.h>
|
#include <projectexplorer/projectnodes.h>
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QHash>
|
#include <QtCore/QHash>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class IFile;
|
class IFile;
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
#ifndef PKGCONFIGTOOL_H
|
#ifndef PKGCONFIGTOOL_H
|
||||||
#define PKGCONFIGTOOL_H
|
#define PKGCONFIGTOOL_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QStringList>
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
namespace GenericProjectManager {
|
namespace GenericProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
@@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
#include "targetselector.h"
|
#include "targetselector.h"
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QMenu;
|
class QMenu;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ bool QmlStateNodeInstance::updateStateBinding(const NodeInstance &target, const
|
|||||||
return stateObject()->changeValueInRevertList(target.internalObject(), propertyName.toLatin1(), expression);
|
return stateObject()->changeValueInRevertList(target.internalObject(), propertyName.toLatin1(), expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmlStateNodeInstance::resetStateProperty(const NodeInstance &target, const QString &propertyName, const QVariant &resetValue)
|
bool QmlStateNodeInstance::resetStateProperty(const NodeInstance &target, const QString &propertyName, const QVariant & /* resetValue */)
|
||||||
{
|
{
|
||||||
return stateObject()->removeEntryFromRevertList(target.internalObject(), propertyName.toLatin1());
|
return stateObject()->removeEntryFromRevertList(target.internalObject(), propertyName.toLatin1());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include <projectexplorer/abstractprocessstep.h>
|
#include <projectexplorer/abstractprocessstep.h>
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class BuildStep;
|
class BuildStep;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#ifndef MAEMOCONSTANTS_H
|
#ifndef MAEMOCONSTANTS_H
|
||||||
#define MAEMOCONSTANTS_H
|
#define MAEMOCONSTANTS_H
|
||||||
|
|
||||||
#include <QLatin1String>
|
#include <QtCore/QLatin1String>
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
#define REFACTOROVERLAY_H
|
#define REFACTOROVERLAY_H
|
||||||
|
|
||||||
#include "basetexteditor.h"
|
#include "basetexteditor.h"
|
||||||
#include <QTextCursor>
|
|
||||||
#include <QObject>
|
#include <QtGui/QTextCursor>
|
||||||
#include <QIcon>
|
#include <QtGui/QIcon>
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|||||||
@@ -181,6 +181,11 @@ QToolButton *WelcomeMode::addPageToolButton(Utils::IWelcomePage *plugin, int pos
|
|||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString WelcomeMode::contextHelpId() const
|
||||||
|
{
|
||||||
|
return QLatin1String("Qt Creator Manual");
|
||||||
|
}
|
||||||
|
|
||||||
void WelcomeMode::initPlugins()
|
void WelcomeMode::initPlugins()
|
||||||
{
|
{
|
||||||
m_d->buttonLayout = new QHBoxLayout(m_d->ui.navFrame);
|
m_d->buttonLayout = new QHBoxLayout(m_d->ui.navFrame);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
QString type() const;
|
QString type() const;
|
||||||
Core::Context context() const;
|
Core::Context context() const;
|
||||||
void activated();
|
void activated();
|
||||||
QString contextHelpId() const { return QLatin1String("Qt Creator Manual"); }
|
QString contextHelpId() const;
|
||||||
void initPlugins();
|
void initPlugins();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
@@ -269,6 +269,18 @@ WelcomeModeLabel_CW::WelcomeModeLabel_CW(QObject *parent) :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CrumblePath_CW::CrumblePath_CW(QObject *parent) :
|
||||||
|
QObject(parent),
|
||||||
|
CustomWidget<Utils::CrumblePath>
|
||||||
|
(QLatin1String("<utils/crumblepath.h>"),
|
||||||
|
false,
|
||||||
|
QLatin1String(groupC),
|
||||||
|
QIcon(),
|
||||||
|
QLatin1String("Crumble Path"))
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
DetailsWidget_CW::DetailsWidget_CW(QObject *parent) :
|
DetailsWidget_CW::DetailsWidget_CW(QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
CustomWidget<Utils::DetailsWidget>
|
CustomWidget<Utils::DetailsWidget>
|
||||||
@@ -397,6 +409,7 @@ WidgetCollection::WidgetCollection(QObject *parent) :
|
|||||||
m_plugins.push_back(new Wizard_CW(this));
|
m_plugins.push_back(new Wizard_CW(this));
|
||||||
m_plugins.push_back(new WelcomePageWidget_CW(this));
|
m_plugins.push_back(new WelcomePageWidget_CW(this));
|
||||||
m_plugins.push_back(new WelcomeModeLabel_CW(this));
|
m_plugins.push_back(new WelcomeModeLabel_CW(this));
|
||||||
|
m_plugins.push_back(new CrumblePath_CW(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QDesignerCustomWidgetInterface*> WidgetCollection::customWidgets() const
|
QList<QDesignerCustomWidgetInterface*> WidgetCollection::customWidgets() const
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
#include <utils/styledbar.h>
|
#include <utils/styledbar.h>
|
||||||
#include <utils/wizard.h>
|
#include <utils/wizard.h>
|
||||||
#include <utils/welcomemodetreewidget.h>
|
#include <utils/welcomemodetreewidget.h>
|
||||||
|
#include <utils/crumblepath.h>
|
||||||
|
|
||||||
#include <QtDesigner/QDesignerCustomWidgetCollectionInterface>
|
#include <QtDesigner/QDesignerCustomWidgetCollectionInterface>
|
||||||
#include <QtDesigner/QDesignerContainerExtension>
|
#include <QtDesigner/QDesignerContainerExtension>
|
||||||
@@ -255,6 +256,15 @@ public:
|
|||||||
explicit WelcomeModeLabel_CW(QObject *parent = 0);
|
explicit WelcomeModeLabel_CW(QObject *parent = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CrumblePath_CW :
|
||||||
|
public QObject,
|
||||||
|
public CustomWidget<Utils::CrumblePath>
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||||
|
public:
|
||||||
|
explicit CrumblePath_CW(QObject *parent = 0);
|
||||||
|
};
|
||||||
|
|
||||||
// Details Widget: plugin + simple, hacky container extension that
|
// Details Widget: plugin + simple, hacky container extension that
|
||||||
// accepts only one page.
|
// accepts only one page.
|
||||||
|
|||||||
Reference in New Issue
Block a user