forked from qt-creator/qt-creator
Merge commit 'origin/0.9.1-beta'
This commit is contained in:
@@ -123,14 +123,13 @@ int qtGhVersion = QT_VERSION;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
//#include <sys/types.h>
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -172,9 +171,6 @@ public:
|
|||||||
|
|
||||||
// id of the thread that owns the object
|
// id of the thread that owns the object
|
||||||
QThreadData *threadData;
|
QThreadData *threadData;
|
||||||
void moveToThread_helper();
|
|
||||||
void setThreadData_helper(QThreadData *currentData, QThreadData *targetData);
|
|
||||||
void _q_reregisterTimers(void *pointer);
|
|
||||||
|
|
||||||
struct Sender
|
struct Sender
|
||||||
{
|
{
|
||||||
@@ -188,20 +184,12 @@ public:
|
|||||||
|
|
||||||
QList<QPointer<QObject> > eventFilters;
|
QList<QPointer<QObject> > eventFilters;
|
||||||
|
|
||||||
struct ExtraData
|
struct ExtraData;
|
||||||
{
|
|
||||||
#ifndef QT_NO_USERDATA
|
|
||||||
QVector<QObjectUserData *> userData;
|
|
||||||
#endif
|
|
||||||
QList<QByteArray> propertyNames;
|
|
||||||
QList<QVariant> propertyValues;
|
|
||||||
};
|
|
||||||
ExtraData *extraData;
|
ExtraData *extraData;
|
||||||
mutable quint32 connectedSignals;
|
mutable quint32 connectedSignals;
|
||||||
|
|
||||||
QString objectName;
|
QString objectName;
|
||||||
|
|
||||||
// Note: you must hold the signalSlotLock() before accessing the lists below or calling the functions
|
|
||||||
struct Connection
|
struct Connection
|
||||||
{
|
{
|
||||||
QObject *receiver;
|
QObject *receiver;
|
||||||
@@ -214,8 +202,6 @@ public:
|
|||||||
QObjectConnectionListVector *connectionLists;
|
QObjectConnectionListVector *connectionLists;
|
||||||
QList<Sender> senders;
|
QList<Sender> senders;
|
||||||
int *deleteWatch;
|
int *deleteWatch;
|
||||||
|
|
||||||
static QObjectPrivate *get(QObject *o) { return o->d_func(); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(QT_BEGIN_NAMESPACE)
|
#if defined(QT_BEGIN_NAMESPACE)
|
||||||
@@ -291,7 +277,7 @@ static bool startsWith(const char *s, const char *t)
|
|||||||
#define qCheckAccess(d) do { qProvokeSegFaultHelper = *(char*)d; } while (0)
|
#define qCheckAccess(d) do { qProvokeSegFaultHelper = *(char*)d; } while (0)
|
||||||
#define qCheckPointer(d) do { if (d) qProvokeSegFaultHelper = *(char*)d; } while (0)
|
#define qCheckPointer(d) do { if (d) qProvokeSegFaultHelper = *(char*)d; } while (0)
|
||||||
// provoke segfault unconditionally
|
// provoke segfault unconditionally
|
||||||
#define qCheck(b) do { if (!b) qProvokeSegFaultHelper = *(char*)0; } while (0)
|
#define qCheck(b) do { if (!(b)) qProvokeSegFaultHelper = *(char*)0; } while (0)
|
||||||
|
|
||||||
const char *stripNamespace(const char *type)
|
const char *stripNamespace(const char *type)
|
||||||
{
|
{
|
||||||
@@ -2146,6 +2132,61 @@ static void qDumpStdList(QDumper &d)
|
|||||||
d.disarm();
|
d.disarm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void qDumpStdMap(QDumper &d)
|
||||||
|
{
|
||||||
|
typedef std::map<int, int> DummyType;
|
||||||
|
const DummyType &map = *reinterpret_cast<const DummyType*>(d.data);
|
||||||
|
const char *keyType = d.templateParameters[0];
|
||||||
|
const char *valueType = d.templateParameters[1];
|
||||||
|
const void *p = d.data;
|
||||||
|
qCheckAccess(p);
|
||||||
|
p = deref(p);
|
||||||
|
|
||||||
|
int nn = map.size();
|
||||||
|
qCheck(nn >= 0);
|
||||||
|
DummyType::const_iterator it = map.begin();
|
||||||
|
for (int i = 0; i < nn && i < 10 && it != map.end(); ++i, ++it)
|
||||||
|
qCheckAccess(it.operator->());
|
||||||
|
|
||||||
|
QByteArray strippedInnerType = stripPointerType(d.innertype);
|
||||||
|
P(d, "numchild", nn);
|
||||||
|
P(d, "value", "<" << nn << " items>");
|
||||||
|
P(d, "valuedisabled", "true");
|
||||||
|
P(d, "valueoffset", d.extraInt[2]);
|
||||||
|
|
||||||
|
if (d.dumpChildren) {
|
||||||
|
bool simpleKey = isSimpleType(keyType);
|
||||||
|
bool simpleValue = isShortKey(valueType);
|
||||||
|
int valueOffset = d.extraInt[2];
|
||||||
|
|
||||||
|
d << ",children=[";
|
||||||
|
it = map.begin();
|
||||||
|
for (int i = 0; i < 1000 && it != map.end(); ++i, ++it) {
|
||||||
|
const void *node = it.operator->();
|
||||||
|
if (simpleKey) {
|
||||||
|
d.beginHash();
|
||||||
|
P(d, "type", valueType);
|
||||||
|
qDumpInnerValueHelper(d, keyType, node, "name");
|
||||||
|
P(d, "nameisindex", "1");
|
||||||
|
if (simpleValue)
|
||||||
|
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
|
||||||
|
P(d, "addr", addOffset(node, valueOffset));
|
||||||
|
d.endHash();
|
||||||
|
} else {
|
||||||
|
d.beginHash();
|
||||||
|
P(d, "name", "[" << i << "]");
|
||||||
|
P(d, "addr", it.operator->());
|
||||||
|
P(d, "type", "std::pair<const " << keyType << "," << valueType << " >");
|
||||||
|
d.endHash();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (it != map.end())
|
||||||
|
d.putEllipsis();
|
||||||
|
d << "]";
|
||||||
|
}
|
||||||
|
d.disarm();
|
||||||
|
}
|
||||||
|
|
||||||
static void qDumpStdString(QDumper &d)
|
static void qDumpStdString(QDumper &d)
|
||||||
{
|
{
|
||||||
const std::string &str = *reinterpret_cast<const std::string *>(d.data);
|
const std::string &str = *reinterpret_cast<const std::string *>(d.data);
|
||||||
@@ -2356,9 +2397,9 @@ static void handleProtocolVersion2and3(QDumper & d)
|
|||||||
qDumpStdVectorBool(d);
|
qDumpStdVectorBool(d);
|
||||||
else if (isEqual(type, "std::list"))
|
else if (isEqual(type, "std::list"))
|
||||||
qDumpStdList(d);
|
qDumpStdList(d);
|
||||||
else if (isEqual(type, "string"))
|
else if (isEqual(type, "std::map"))
|
||||||
qDumpStdString(d);
|
qDumpStdMap(d);
|
||||||
else if (isEqual(type, "std::string"))
|
else if (isEqual(type, "std::string") || isEqual(type, "string"))
|
||||||
qDumpStdString(d);
|
qDumpStdString(d);
|
||||||
else if (isEqual(type, "std::wstring"))
|
else if (isEqual(type, "std::wstring"))
|
||||||
qDumpStdWString(d);
|
qDumpStdWString(d);
|
||||||
@@ -2383,34 +2424,7 @@ void qDumpObjectData440(
|
|||||||
int extraInt2,
|
int extraInt2,
|
||||||
int extraInt3)
|
int extraInt3)
|
||||||
{
|
{
|
||||||
if (protocolVersion == -2) {
|
if (protocolVersion == 1) {
|
||||||
// close socket
|
|
||||||
QDumper d;
|
|
||||||
d.protocolVersion = protocolVersion;
|
|
||||||
d.token = token;
|
|
||||||
d.flush();
|
|
||||||
d.disarm();
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (protocolVersion == -1) {
|
|
||||||
// finalize Startup
|
|
||||||
QDumper d;
|
|
||||||
d.protocolVersion = protocolVersion;
|
|
||||||
d.token = token;
|
|
||||||
d.disarm();
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (protocolVersion == 0) {
|
|
||||||
QDumper d;
|
|
||||||
d.protocolVersion = protocolVersion;
|
|
||||||
d.token = token;
|
|
||||||
// used to test whether error output gets through
|
|
||||||
//fprintf(stderr, "using stderr, qDebug follows: %d\n", token);
|
|
||||||
//qDebug() << "using qDebug, stderr already used: " << token;
|
|
||||||
d.disarm();
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (protocolVersion == 1) {
|
|
||||||
QDumper d;
|
QDumper d;
|
||||||
d.protocolVersion = protocolVersion;
|
d.protocolVersion = protocolVersion;
|
||||||
d.token = token;
|
d.token = token;
|
||||||
|
|||||||
@@ -871,6 +871,7 @@ IEditor *EditorManager::openEditor(const QString &fileName, const QString &edito
|
|||||||
restoreEditorState(editor);
|
restoreEditorState(editor);
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
ensureEditorManagerVisible();
|
ensureEditorManagerVisible();
|
||||||
|
setCurrentEditor(editor);
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1351,6 +1352,8 @@ bool EditorManager::restoreState(const QByteArray &state)
|
|||||||
if (!success)
|
if (!success)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||||
|
|
||||||
bool editorChangesSuppressed = m_d->m_suppressEditorChanges;
|
bool editorChangesSuppressed = m_d->m_suppressEditorChanges;
|
||||||
m_d->m_suppressEditorChanges = true;
|
m_d->m_suppressEditorChanges = true;
|
||||||
|
|
||||||
@@ -1367,6 +1370,8 @@ bool EditorManager::restoreState(const QByteArray &state)
|
|||||||
if (currentEditor())
|
if (currentEditor())
|
||||||
setCurrentEditor(currentEditor());// looks like a null-op but is not
|
setCurrentEditor(currentEditor());// looks like a null-op but is not
|
||||||
|
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ StackedEditorGroup::StackedEditorGroup(QWidget *parent) :
|
|||||||
hbox->addWidget(closeButton);
|
hbox->addWidget(closeButton);
|
||||||
|
|
||||||
|
|
||||||
|
m_infoWidget->setVisible(false);
|
||||||
tl->addWidget(m_infoWidget);
|
tl->addWidget(m_infoWidget);
|
||||||
}
|
}
|
||||||
tl->addWidget(m_container);
|
tl->addWidget(m_container);
|
||||||
@@ -166,8 +167,6 @@ StackedEditorGroup::StackedEditorGroup(QWidget *parent) :
|
|||||||
l->setMargin(0);
|
l->setMargin(0);
|
||||||
l->addWidget(m_toplevel);
|
l->addWidget(m_toplevel);
|
||||||
setLayout(l);
|
setLayout(l);
|
||||||
|
|
||||||
m_toplevel->setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StackedEditorGroup::showEditorInfoBar(const QString &kind,
|
void StackedEditorGroup::showEditorInfoBar(const QString &kind,
|
||||||
@@ -226,12 +225,11 @@ void StackedEditorGroup::insertEditor(int index, IEditor *editor)
|
|||||||
m_widgetEditorMap.insert(editor->widget(), editor);
|
m_widgetEditorMap.insert(editor->widget(), editor);
|
||||||
|
|
||||||
QToolBar *toolBar = editor->toolBar();
|
QToolBar *toolBar = editor->toolBar();
|
||||||
if (toolBar)
|
if (toolBar) {
|
||||||
|
toolBar->setVisible(false); // will be made visible in setCurrentEditor
|
||||||
m_toolBar->layout()->addWidget(toolBar);
|
m_toolBar->layout()->addWidget(toolBar);
|
||||||
connect(editor, SIGNAL(changed()), this, SLOT(updateEditorStatus()));
|
}
|
||||||
|
connect(editor, SIGNAL(changed()), this, SLOT(checkEditorStatus()));
|
||||||
updateEditorStatus(editor);
|
|
||||||
updateToolBar(editor);
|
|
||||||
|
|
||||||
emit editorAdded(editor);
|
emit editorAdded(editor);
|
||||||
}
|
}
|
||||||
@@ -261,10 +259,6 @@ void StackedEditorGroup::removeEditor(IEditor *editor)
|
|||||||
toolBar->setVisible(false);
|
toolBar->setVisible(false);
|
||||||
toolBar->setParent(0);
|
toolBar->setParent(0);
|
||||||
}
|
}
|
||||||
if (m_container->count() == 0) {
|
|
||||||
m_toplevel->setVisible(false);
|
|
||||||
setFocus();
|
|
||||||
}
|
|
||||||
emit editorRemoved(editor);
|
emit editorRemoved(editor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,7 +275,6 @@ void StackedEditorGroup::setCurrentEditor(IEditor *editor)
|
|||||||
if (!editor || m_container->count() <= 0
|
if (!editor || m_container->count() <= 0
|
||||||
|| m_container->indexOf(editor->widget()) == -1)
|
|| m_container->indexOf(editor->widget()) == -1)
|
||||||
return;
|
return;
|
||||||
m_toplevel->setVisible(true);
|
|
||||||
const int idx = m_container->indexOf(editor->widget());
|
const int idx = m_container->indexOf(editor->widget());
|
||||||
QTC_ASSERT(idx >= 0, return);
|
QTC_ASSERT(idx >= 0, return);
|
||||||
if (m_container->currentIndex() != idx) {
|
if (m_container->currentIndex() != idx) {
|
||||||
@@ -290,23 +283,26 @@ void StackedEditorGroup::setCurrentEditor(IEditor *editor)
|
|||||||
const bool block = m_editorList->blockSignals(true);
|
const bool block = m_editorList->blockSignals(true);
|
||||||
m_editorList->setCurrentIndex(indexOf(editor));
|
m_editorList->setCurrentIndex(indexOf(editor));
|
||||||
m_editorList->blockSignals(block);
|
m_editorList->blockSignals(block);
|
||||||
|
|
||||||
updateEditorStatus(editor);
|
|
||||||
updateToolBar(editor);
|
|
||||||
}
|
}
|
||||||
setEditorFocus(idx);
|
setEditorFocus(idx);
|
||||||
|
|
||||||
|
updateEditorStatus(editor);
|
||||||
|
updateToolBar(editor);
|
||||||
if (editor != m_editorForInfoWidget) {
|
if (editor != m_editorForInfoWidget) {
|
||||||
m_infoWidget->hide();
|
m_infoWidget->hide();
|
||||||
m_editorForInfoWidget = 0;
|
m_editorForInfoWidget = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StackedEditorGroup::checkEditorStatus()
|
||||||
|
{
|
||||||
|
IEditor *editor = qobject_cast<IEditor *>(sender());
|
||||||
|
if (editor == currentEditor())
|
||||||
|
updateEditorStatus(editor);
|
||||||
|
}
|
||||||
|
|
||||||
void StackedEditorGroup::updateEditorStatus(IEditor *editor)
|
void StackedEditorGroup::updateEditorStatus(IEditor *editor)
|
||||||
{
|
{
|
||||||
if (!editor)
|
|
||||||
editor = qobject_cast<IEditor *>(sender());
|
|
||||||
QTC_ASSERT(editor, return);
|
|
||||||
|
|
||||||
static const QIcon lockedIcon(QLatin1String(":/qworkbench/images/locked.png"));
|
static const QIcon lockedIcon(QLatin1String(":/qworkbench/images/locked.png"));
|
||||||
static const QIcon unlockedIcon(QLatin1String(":/qworkbench/images/unlocked.png"));
|
static const QIcon unlockedIcon(QLatin1String(":/qworkbench/images/unlocked.png"));
|
||||||
|
|
||||||
@@ -331,8 +327,8 @@ void StackedEditorGroup::updateToolBar(IEditor *editor)
|
|||||||
toolBar = m_defaultToolBar;
|
toolBar = m_defaultToolBar;
|
||||||
if (m_activeToolBar == toolBar)
|
if (m_activeToolBar == toolBar)
|
||||||
return;
|
return;
|
||||||
m_activeToolBar->setVisible(false);
|
|
||||||
toolBar->setVisible(true);
|
toolBar->setVisible(true);
|
||||||
|
m_activeToolBar->setVisible(false);
|
||||||
m_activeToolBar = toolBar;
|
m_activeToolBar = toolBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ protected:
|
|||||||
private slots:
|
private slots:
|
||||||
void sendCloseRequest();
|
void sendCloseRequest();
|
||||||
void updateEditorStatus(Core::IEditor *editor = 0);
|
void updateEditorStatus(Core::IEditor *editor = 0);
|
||||||
|
void checkEditorStatus();
|
||||||
void setEditorFocus(int index);
|
void setEditorFocus(int index);
|
||||||
void makeEditorWritable();
|
void makeEditorWritable();
|
||||||
void listSelectionChanged(int index);
|
void listSelectionChanged(int index);
|
||||||
|
|||||||
@@ -48,3 +48,13 @@ QKeySequence INavigationWidgetFactory::activationSequence()
|
|||||||
return QKeySequence();
|
return QKeySequence();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void INavigationWidgetFactory::saveSettings(int position, QWidget *widget)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void INavigationWidgetFactory::restoreSettings(int position, QWidget *widget)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -65,6 +65,12 @@ public:
|
|||||||
// and the docktoolbar widgets
|
// and the docktoolbar widgets
|
||||||
// Similar to how IView
|
// Similar to how IView
|
||||||
virtual NavigationView createWidget() = 0;
|
virtual NavigationView createWidget() = 0;
|
||||||
|
|
||||||
|
// Read and store settings for the widget, created by this factory
|
||||||
|
// and beeing at position position. (The position is important since
|
||||||
|
// a certain type of widget could exist multiple times.)
|
||||||
|
virtual void saveSettings(int position, QWidget *widget);
|
||||||
|
virtual void restoreSettings(int position, QWidget *widget);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|||||||
@@ -997,7 +997,7 @@ void MainWindow::readSettings()
|
|||||||
|
|
||||||
m_settings->endGroup();
|
m_settings->endGroup();
|
||||||
m_editorManager->readSettings(m_settings);
|
m_editorManager->readSettings(m_settings);
|
||||||
m_navigationWidget->readSettings(m_settings);
|
m_navigationWidget->restoreSettings(m_settings);
|
||||||
m_rightPaneWidget->readSettings(m_settings);
|
m_rightPaneWidget->readSettings(m_settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -220,6 +220,8 @@ void NavigationWidget::close()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void NavigationWidget::saveSettings(QSettings *settings)
|
void NavigationWidget::saveSettings(QSettings *settings)
|
||||||
{
|
{
|
||||||
QStringList views;
|
QStringList views;
|
||||||
@@ -230,9 +232,12 @@ void NavigationWidget::saveSettings(QSettings *settings)
|
|||||||
settings->setValue("Navigation/Visible", isShown());
|
settings->setValue("Navigation/Visible", isShown());
|
||||||
settings->setValue("Navigation/VerticalPosition", saveState());
|
settings->setValue("Navigation/VerticalPosition", saveState());
|
||||||
settings->setValue("Navigation/Width", m_width);
|
settings->setValue("Navigation/Width", m_width);
|
||||||
|
|
||||||
|
for (int i=0; i<m_subWidgets.count(); ++i)
|
||||||
|
m_subWidgets.at(i)->saveSettings(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationWidget::readSettings(QSettings *settings)
|
void NavigationWidget::restoreSettings(QSettings *settings)
|
||||||
{
|
{
|
||||||
if (settings->contains("Navigation/Views")) {
|
if (settings->contains("Navigation/Views")) {
|
||||||
QStringList views = settings->value("Navigation/Views").toStringList();
|
QStringList views = settings->value("Navigation/Views").toStringList();
|
||||||
@@ -266,6 +271,9 @@ void NavigationWidget::readSettings(QSettings *settings)
|
|||||||
if (NavigationWidgetPlaceHolder::m_current) {
|
if (NavigationWidgetPlaceHolder::m_current) {
|
||||||
NavigationWidgetPlaceHolder::m_current->applyStoredSize(m_width);
|
NavigationWidgetPlaceHolder::m_current->applyStoredSize(m_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<m_subWidgets.count(); ++i)
|
||||||
|
m_subWidgets.at(i)->restoreSettings(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationWidget::setShown(bool b)
|
void NavigationWidget::setShown(bool b)
|
||||||
@@ -469,6 +477,16 @@ INavigationWidgetFactory *NavigationSubWidget::factory()
|
|||||||
return m_navigationComboBox->itemData(index).value<INavigationWidgetFactory *>();
|
return m_navigationComboBox->itemData(index).value<INavigationWidgetFactory *>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NavigationSubWidget::saveSettings(int position)
|
||||||
|
{
|
||||||
|
factory()->saveSettings(position, m_navigationWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NavigationSubWidget::restoreSettings(int position)
|
||||||
|
{
|
||||||
|
factory()->restoreSettings(position, m_navigationWidget);
|
||||||
|
}
|
||||||
|
|
||||||
Core::ICommand *NavigationSubWidget::command(const QString &title) const
|
Core::ICommand *NavigationSubWidget::command(const QString &title) const
|
||||||
{
|
{
|
||||||
const QHash<QString, Core::ICommand*> commandMap = m_parentWidget->commandMap();
|
const QHash<QString, Core::ICommand*> commandMap = m_parentWidget->commandMap();
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
~NavigationWidget();
|
~NavigationWidget();
|
||||||
|
|
||||||
void saveSettings(QSettings *settings);
|
void saveSettings(QSettings *settings);
|
||||||
void readSettings(QSettings *settings);
|
void restoreSettings(QSettings *settings);
|
||||||
|
|
||||||
bool isShown() const;
|
bool isShown() const;
|
||||||
void setShown(bool b);
|
void setShown(bool b);
|
||||||
@@ -133,6 +133,9 @@ public:
|
|||||||
void setFactory(const QString &name);
|
void setFactory(const QString &name);
|
||||||
void setFocusWidget();
|
void setFocusWidget();
|
||||||
|
|
||||||
|
void saveSettings(int position);
|
||||||
|
void restoreSettings(int position);
|
||||||
|
|
||||||
Core::ICommand *command(const QString &title) const;
|
Core::ICommand *command(const QString &title) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@@ -177,14 +177,14 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (m_toolTip.isEmpty()) {
|
if (m_toolTip.isEmpty()) {
|
||||||
unsigned lineno = tc.blockNumber() + 1;
|
unsigned lineno = tc.blockNumber() + 1;
|
||||||
foreach (const Document::Include &incl, doc->includes()) {
|
foreach (const Document::Include &incl, doc->includes()) {
|
||||||
if (lineno == incl.line()) {
|
if (lineno == incl.line()) {
|
||||||
m_toolTip = incl.fileName();
|
m_toolTip = incl.fileName();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2941,6 +2941,8 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
|
|||||||
}
|
}
|
||||||
if (tmplate == "std::list")
|
if (tmplate == "std::list")
|
||||||
return true;
|
return true;
|
||||||
|
if (tmplate == "std::map")
|
||||||
|
return true;
|
||||||
if (tmplate == "std::vector" && inner != "bool")
|
if (tmplate == "std::vector" && inner != "bool")
|
||||||
return true;
|
return true;
|
||||||
if (tmplate == "std::basic_string") {
|
if (tmplate == "std::basic_string") {
|
||||||
@@ -2962,6 +2964,8 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
|||||||
QStringList inners = inner.split('@');
|
QStringList inners = inner.split('@');
|
||||||
if (inners.at(0).isEmpty())
|
if (inners.at(0).isEmpty())
|
||||||
inners.clear();
|
inners.clear();
|
||||||
|
for (int i = 0; i != inners.size(); ++i)
|
||||||
|
inners[i] = inners[i].simplified();
|
||||||
|
|
||||||
QString outertype = isTemplate ? tmplate : data.type;
|
QString outertype = isTemplate ? tmplate : data.type;
|
||||||
|
|
||||||
@@ -3015,6 +3019,12 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
|||||||
//extraArgs[extraArgCount++] = sizeofTypeExpression(data.type);
|
//extraArgs[extraArgCount++] = sizeofTypeExpression(data.type);
|
||||||
//extraArgs[extraArgCount++] = "(size_t)&(('" + data.type + "'*)0)->value";
|
//extraArgs[extraArgCount++] = "(size_t)&(('" + data.type + "'*)0)->value";
|
||||||
}
|
}
|
||||||
|
} else if (outertype == "std::map") {
|
||||||
|
// We don't want the comparator and the allocator confuse gdb.
|
||||||
|
// But we need the offset of the second item in the value pair.
|
||||||
|
extraArgs[2] = "(size_t)&(('std::pair<const " + inners.at(0)
|
||||||
|
+ "," + inners.at(1) + ">'*)0)->second";
|
||||||
|
extraArgs[3] = "0";
|
||||||
} else if (outertype == "std::basic_string") {
|
} else if (outertype == "std::basic_string") {
|
||||||
//qDebug() << "EXTRACT TEMPLATE: " << outertype << inners;
|
//qDebug() << "EXTRACT TEMPLATE: " << outertype << inners;
|
||||||
if (inners.at(0) == "char") {
|
if (inners.at(0) == "char") {
|
||||||
@@ -3064,6 +3074,8 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
|||||||
+ ',' + extraArgs[2]
|
+ ',' + extraArgs[2]
|
||||||
+ ',' + extraArgs[3] + ')';
|
+ ',' + extraArgs[3] + ')';
|
||||||
|
|
||||||
|
//qDebug() << "CMD: " << cmd;
|
||||||
|
|
||||||
sendSynchronizedCommand(cmd, WatchDumpCustomValue1, QVariant::fromValue(data));
|
sendSynchronizedCommand(cmd, WatchDumpCustomValue1, QVariant::fromValue(data));
|
||||||
|
|
||||||
q->showStatusMessage(
|
q->showStatusMessage(
|
||||||
|
|||||||
@@ -481,3 +481,16 @@ void FindToolBar::openFind()
|
|||||||
m_currentDocumentFind->highlightAll(getFindText(), m_plugin->findFlags());
|
m_currentDocumentFind->highlightAll(getFindText(), m_plugin->findFlags());
|
||||||
selectFindText();
|
selectFindText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool FindToolBar::focusNextPrevChild(bool next)
|
||||||
|
{
|
||||||
|
// close tab order change
|
||||||
|
if (next && m_ui.replaceAllButton->hasFocus())
|
||||||
|
m_ui.findEdit->setFocus(Qt::TabFocusReason);
|
||||||
|
else if (!next && m_ui.findEdit->hasFocus())
|
||||||
|
m_ui.replaceAllButton->setFocus(Qt::TabFocusReason);
|
||||||
|
else
|
||||||
|
return QToolBar::focusNextPrevChild(next);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ private slots:
|
|||||||
void updateActions();
|
void updateActions();
|
||||||
void findFlagsChanged();
|
void findFlagsChanged();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool focusNextPrevChild(bool next);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool setFocusToCurrentFindSupport();
|
bool setFocusToCurrentFindSupport();
|
||||||
|
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ class AllProjectsFilter : public QuickOpen::BaseFileFilter
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
AllProjectsFilter(ProjectExplorerPlugin *pe, Core::ICore *core);
|
AllProjectsFilter(ProjectExplorerPlugin *pe, Core::ICore *core);
|
||||||
QString trName() const { return tr("File in any project"); }
|
QString trName() const { return tr("Files in any project"); }
|
||||||
QString name() const { return "File in any project"; }
|
QString name() const { return "Files in any project"; }
|
||||||
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }
|
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ class CurrentProjectFilter : public QuickOpen::BaseFileFilter
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
CurrentProjectFilter(ProjectExplorerPlugin *pe, Core::ICore *core);
|
CurrentProjectFilter(ProjectExplorerPlugin *pe, Core::ICore *core);
|
||||||
QString trName() const { return tr("File in current project"); }
|
QString trName() const { return tr("Files in current project"); }
|
||||||
QString name() const { return "File in current project"; }
|
QString name() const { return "Files in current project"; }
|
||||||
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }
|
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }
|
||||||
void refresh(QFutureInterface<void> &future);
|
void refresh(QFutureInterface<void> &future);
|
||||||
|
|
||||||
|
|||||||
@@ -926,6 +926,16 @@ void FlatModel::setGeneratedFilesFilterEnabled(bool filter)
|
|||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FlatModel::projectFilterEnabled()
|
||||||
|
{
|
||||||
|
return m_filterProjects;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FlatModel::generatedFilesFilterEnabled()
|
||||||
|
{
|
||||||
|
return m_filterGeneratedFiles;
|
||||||
|
}
|
||||||
|
|
||||||
Node *FlatModel::nodeForIndex(const QModelIndex &index) const
|
Node *FlatModel::nodeForIndex(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (index.isValid())
|
if (index.isValid())
|
||||||
|
|||||||
@@ -136,6 +136,9 @@ public:
|
|||||||
ProjectExplorer::Node *nodeForIndex(const QModelIndex &index) const;
|
ProjectExplorer::Node *nodeForIndex(const QModelIndex &index) const;
|
||||||
QModelIndex indexForNode(const Node *node);
|
QModelIndex indexForNode(const Node *node);
|
||||||
|
|
||||||
|
bool projectFilterEnabled();
|
||||||
|
bool generatedFilesFilterEnabled();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setProjectFilterEnabled(bool filter);
|
void setProjectFilterEnabled(bool filter);
|
||||||
void setGeneratedFilesFilterEnabled(bool filter);
|
void setGeneratedFilesFilterEnabled(bool filter);
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
@@ -156,7 +157,20 @@ ProjectTreeWidget::ProjectTreeWidget(Core::ICore *core, QWidget *parent)
|
|||||||
connect(m_explorer->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project *)),
|
connect(m_explorer->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project *)),
|
||||||
this, SLOT(startupProjectChanged(ProjectExplorer::Project *)));
|
this, SLOT(startupProjectChanged(ProjectExplorer::Project *)));
|
||||||
|
|
||||||
setAutoSynchronization(true);
|
m_toggleSync = new QToolButton;
|
||||||
|
m_toggleSync->setProperty("type", "dockbutton");
|
||||||
|
m_toggleSync->setIcon(QIcon(":/qworkbench/images/linkicon.png"));
|
||||||
|
m_toggleSync->setCheckable(true);
|
||||||
|
m_toggleSync->setChecked(autoSynchronization());
|
||||||
|
m_toggleSync->setToolTip(tr("Synchronize with Editor"));
|
||||||
|
connect(m_toggleSync, SIGNAL(clicked(bool)), this, SLOT(toggleAutoSynchronization()));
|
||||||
|
|
||||||
|
//setAutoSynchronization(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton *ProjectTreeWidget::toggleSync()
|
||||||
|
{
|
||||||
|
return m_toggleSync;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectTreeWidget::toggleAutoSynchronization()
|
void ProjectTreeWidget::toggleAutoSynchronization()
|
||||||
@@ -171,6 +185,7 @@ bool ProjectTreeWidget::autoSynchronization() const
|
|||||||
|
|
||||||
void ProjectTreeWidget::setAutoSynchronization(bool sync, bool syncNow)
|
void ProjectTreeWidget::setAutoSynchronization(bool sync, bool syncNow)
|
||||||
{
|
{
|
||||||
|
m_toggleSync->setChecked(sync);
|
||||||
if (sync == m_autoSync)
|
if (sync == m_autoSync)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -296,6 +311,17 @@ void ProjectTreeWidget::setGeneratedFilesFilter(bool filter)
|
|||||||
m_filterGeneratedFilesAction->setChecked(filter);
|
m_filterGeneratedFilesAction->setChecked(filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ProjectTreeWidget::generatedFilesFilter()
|
||||||
|
{
|
||||||
|
return m_model->generatedFilesFilterEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ProjectTreeWidget::projectFilter()
|
||||||
|
{
|
||||||
|
return m_model->projectFilterEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ProjectTreeWidgetFactory::ProjectTreeWidgetFactory(Core::ICore *core)
|
ProjectTreeWidgetFactory::ProjectTreeWidgetFactory(Core::ICore *core)
|
||||||
: m_core(core)
|
: m_core(core)
|
||||||
{
|
{
|
||||||
@@ -331,15 +357,24 @@ Core::NavigationView ProjectTreeWidgetFactory::createWidget()
|
|||||||
filterMenu->addAction(ptw->m_filterGeneratedFilesAction);
|
filterMenu->addAction(ptw->m_filterGeneratedFilesAction);
|
||||||
filter->setMenu(filterMenu);
|
filter->setMenu(filterMenu);
|
||||||
|
|
||||||
QToolButton *toggleSync = new QToolButton;
|
n.doockToolBarWidgets << filter << ptw->toggleSync();
|
||||||
toggleSync->setProperty("type", "dockbutton");
|
|
||||||
toggleSync->setIcon(QIcon(":/qworkbench/images/linkicon.png"));
|
|
||||||
toggleSync->setCheckable(true);
|
|
||||||
toggleSync->setChecked(ptw->autoSynchronization());
|
|
||||||
toggleSync->setToolTip(tr("Synchronize with Editor"));
|
|
||||||
connect(toggleSync, SIGNAL(clicked(bool)), ptw, SLOT(toggleAutoSynchronization()));
|
|
||||||
|
|
||||||
n.doockToolBarWidgets << filter << toggleSync;
|
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProjectTreeWidgetFactory::saveSettings(int position, QWidget *widget)
|
||||||
|
{
|
||||||
|
ProjectTreeWidget *ptw = qobject_cast<ProjectTreeWidget *>(widget);
|
||||||
|
Q_ASSERT(ptw);
|
||||||
|
m_core->settings()->setValue("ProjectTreeWidget."+QString::number(position)+".ProjectFilter", ptw->projectFilter());
|
||||||
|
m_core->settings()->setValue("ProjectTreeWidget."+QString::number(position)+".GeneratedFilter", ptw->generatedFilesFilter());
|
||||||
|
m_core->settings()->setValue("ProjectTreeWidget."+QString::number(position)+".SyncWithEditor", ptw->autoSynchronization());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectTreeWidgetFactory::restoreSettings(int position, QWidget *widget)
|
||||||
|
{
|
||||||
|
ProjectTreeWidget *ptw = qobject_cast<ProjectTreeWidget *>(widget);
|
||||||
|
Q_ASSERT(ptw);
|
||||||
|
ptw->setProjectFilter(m_core->settings()->value("ProjectTreeWidget."+QString::number(position)+".ProjectFilter", false).toBool());
|
||||||
|
ptw->setGeneratedFilesFilter(m_core->settings()->value("ProjectTreeWidget."+QString::number(position)+".GeneratedFilter", true).toBool());
|
||||||
|
ptw->setAutoSynchronization(m_core->settings()->value("ProjectTreeWidget."+QString::number(position)+".SyncWithEditor", true).toBool());
|
||||||
|
}
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ public:
|
|||||||
|
|
||||||
bool autoSynchronization() const;
|
bool autoSynchronization() const;
|
||||||
void setAutoSynchronization(bool sync, bool syncNow = true);
|
void setAutoSynchronization(bool sync, bool syncNow = true);
|
||||||
|
bool projectFilter();
|
||||||
|
bool generatedFilesFilter();
|
||||||
|
QToolButton *toggleSync();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void toggleAutoSynchronization();
|
void toggleAutoSynchronization();
|
||||||
@@ -84,6 +87,7 @@ private:
|
|||||||
FlatModel *m_model;
|
FlatModel *m_model;
|
||||||
QAction *m_filterProjectsAction;
|
QAction *m_filterProjectsAction;
|
||||||
QAction *m_filterGeneratedFilesAction;
|
QAction *m_filterGeneratedFilesAction;
|
||||||
|
QToolButton *m_toggleSync;
|
||||||
|
|
||||||
QModelIndex m_subIndex;
|
QModelIndex m_subIndex;
|
||||||
QString m_modelId;
|
QString m_modelId;
|
||||||
@@ -100,6 +104,8 @@ public:
|
|||||||
virtual QString displayName();
|
virtual QString displayName();
|
||||||
virtual QKeySequence activationSequence();
|
virtual QKeySequence activationSequence();
|
||||||
virtual Core::NavigationView createWidget();
|
virtual Core::NavigationView createWidget();
|
||||||
|
void restoreSettings(int position, QWidget *widget);
|
||||||
|
void saveSettings(int position, QWidget *widget);
|
||||||
private:
|
private:
|
||||||
Core::ICore *m_core;
|
Core::ICore *m_core;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ QByteArray DirectoryFilter::saveState() const
|
|||||||
out << m_directories;
|
out << m_directories;
|
||||||
out << m_filters;
|
out << m_filters;
|
||||||
out << shortcutString();
|
out << shortcutString();
|
||||||
out << defaultActiveState();
|
out << isIncludedByDefault();
|
||||||
out << m_files;
|
out << m_files;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@@ -120,7 +120,7 @@ bool DirectoryFilter::openConfigDialog(QWidget *parent, bool &needsRefresh)
|
|||||||
m_ui.directoryList->addItems(m_directories);
|
m_ui.directoryList->addItems(m_directories);
|
||||||
m_ui.fileTypeEdit->setText(m_filters.join(tr(",")));
|
m_ui.fileTypeEdit->setText(m_filters.join(tr(",")));
|
||||||
m_ui.shortcutEdit->setText(shortcutString());
|
m_ui.shortcutEdit->setText(shortcutString());
|
||||||
m_ui.defaultFlag->setChecked(!defaultActiveState());
|
m_ui.defaultFlag->setChecked(!isIncludedByDefault());
|
||||||
updateOptionButtons();
|
updateOptionButtons();
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
QMutexLocker locker(&m_lock);
|
QMutexLocker locker(&m_lock);
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ bool FileSystemFilter::openConfigDialog(QWidget *parent, bool &needsRefresh)
|
|||||||
ui.setupUi(&dialog);
|
ui.setupUi(&dialog);
|
||||||
|
|
||||||
ui.hiddenFilesFlag->setChecked(m_includeHidden);
|
ui.hiddenFilesFlag->setChecked(m_includeHidden);
|
||||||
ui.limitCheck->setChecked(!defaultActiveState());
|
ui.limitCheck->setChecked(!isIncludedByDefault());
|
||||||
ui.shortcutEdit->setText(shortcutString());
|
ui.shortcutEdit->setText(shortcutString());
|
||||||
|
|
||||||
if (dialog.exec() == QDialog::Accepted) {
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
@@ -132,7 +132,7 @@ QByteArray FileSystemFilter::saveState() const
|
|||||||
QDataStream out(&value, QIODevice::WriteOnly);
|
QDataStream out(&value, QIODevice::WriteOnly);
|
||||||
out << m_includeHidden;
|
out << m_includeHidden;
|
||||||
out << shortcutString();
|
out << shortcutString();
|
||||||
out << defaultActiveState();
|
out << isIncludedByDefault();
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ class FileSystemFilter : public QuickOpen::IQuickOpenFilter
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
FileSystemFilter(Core::EditorManager *editorManager, QuickOpenToolWindow *toolWindow);
|
FileSystemFilter(Core::EditorManager *editorManager, QuickOpenToolWindow *toolWindow);
|
||||||
QString trName() const { return tr("File in file system"); }
|
QString trName() const { return tr("Files in file system"); }
|
||||||
QString name() const { return "File in file system"; }
|
QString name() const { return "Files in file system"; }
|
||||||
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Medium; }
|
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Medium; }
|
||||||
QList<QuickOpen::FilterEntry> matchesFor(const QString &entry);
|
QList<QuickOpen::FilterEntry> matchesFor(const QString &entry);
|
||||||
void accept(QuickOpen::FilterEntry selection) const;
|
void accept(QuickOpen::FilterEntry selection) const;
|
||||||
|
|||||||
@@ -43,7 +43,9 @@
|
|||||||
using namespace QuickOpen;
|
using namespace QuickOpen;
|
||||||
|
|
||||||
IQuickOpenFilter::IQuickOpenFilter(QObject *parent):
|
IQuickOpenFilter::IQuickOpenFilter(QObject *parent):
|
||||||
QObject(parent)
|
QObject(parent),
|
||||||
|
m_includedByDefault(false),
|
||||||
|
m_hidden(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,7 +64,7 @@ QByteArray IQuickOpenFilter::saveState() const
|
|||||||
QByteArray value;
|
QByteArray value;
|
||||||
QDataStream out(&value, QIODevice::WriteOnly);
|
QDataStream out(&value, QIODevice::WriteOnly);
|
||||||
out << shortcutString();
|
out << shortcutString();
|
||||||
out << defaultActiveState();
|
out << isIncludedByDefault();
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +93,7 @@ bool IQuickOpenFilter::openConfigDialog(QWidget *parent, bool &needsRefresh)
|
|||||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||||
QLineEdit *shortcutEdit = new QLineEdit(shortcutString());
|
QLineEdit *shortcutEdit = new QLineEdit(shortcutString());
|
||||||
QCheckBox *limitCheck = new QCheckBox(tr("Limit to prefix"));
|
QCheckBox *limitCheck = new QCheckBox(tr("Limit to prefix"));
|
||||||
limitCheck->setChecked(!defaultActiveState());
|
limitCheck->setChecked(!isIncludedByDefault());
|
||||||
|
|
||||||
hlayout->addWidget(new QLabel(tr("Prefix:")));
|
hlayout->addWidget(new QLabel(tr("Prefix:")));
|
||||||
hlayout->addWidget(shortcutEdit);
|
hlayout->addWidget(shortcutEdit);
|
||||||
@@ -120,12 +122,22 @@ bool IQuickOpenFilter::isConfigurable() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IQuickOpenFilter::defaultActiveState() const
|
bool IQuickOpenFilter::isIncludedByDefault() const
|
||||||
{
|
{
|
||||||
return m_default;
|
return m_includedByDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IQuickOpenFilter::setIncludedByDefault(bool includedByDefault)
|
void IQuickOpenFilter::setIncludedByDefault(bool includedByDefault)
|
||||||
{
|
{
|
||||||
m_default = includedByDefault;
|
m_includedByDefault = includedByDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IQuickOpenFilter::isHidden() const
|
||||||
|
{
|
||||||
|
return m_hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IQuickOpenFilter::setHidden(bool hidden)
|
||||||
|
{
|
||||||
|
m_hidden = hidden;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,26 +87,25 @@ public:
|
|||||||
IQuickOpenFilter(QObject *parent = 0);
|
IQuickOpenFilter(QObject *parent = 0);
|
||||||
virtual ~IQuickOpenFilter() {}
|
virtual ~IQuickOpenFilter() {}
|
||||||
|
|
||||||
/* visible name */
|
/* Visible name. */
|
||||||
virtual QString trName() const = 0;
|
virtual QString trName() const = 0;
|
||||||
|
|
||||||
/* internal name */
|
/* Internal name. */
|
||||||
virtual QString name() const = 0;
|
virtual QString name() const = 0;
|
||||||
|
|
||||||
/* selection list order in case of multiple active filters (high goes on top) */
|
/* Selection list order in case of multiple active filters (high goes on top). */
|
||||||
virtual Priority priority() const = 0;
|
virtual Priority priority() const = 0;
|
||||||
|
|
||||||
/* string to type to use this filter exclusively */
|
/* String to type to use this filter exclusively. */
|
||||||
virtual QString shortcutString() const;
|
QString shortcutString() const;
|
||||||
void setShortcutString(const QString &shortcut);
|
|
||||||
|
|
||||||
/* list of matches for the given user entry */
|
/* List of matches for the given user entry. */
|
||||||
virtual QList<FilterEntry> matchesFor(const QString &entry) = 0;
|
virtual QList<FilterEntry> matchesFor(const QString &entry) = 0;
|
||||||
|
|
||||||
/* user has selected the given entry that belongs to this filter */
|
/* User has selected the given entry that belongs to this filter. */
|
||||||
virtual void accept(FilterEntry selection) const = 0;
|
virtual void accept(FilterEntry selection) const = 0;
|
||||||
|
|
||||||
/* implement to update caches on user request, if that's a long operation */
|
/* Implement to update caches on user request, if that's a long operation. */
|
||||||
virtual void refresh(QFutureInterface<void> &future) = 0;
|
virtual void refresh(QFutureInterface<void> &future) = 0;
|
||||||
|
|
||||||
/* Saved state is used to restore the filter at start up. */
|
/* Saved state is used to restore the filter at start up. */
|
||||||
@@ -126,9 +125,11 @@ public:
|
|||||||
* implementation returns true. */
|
* implementation returns true. */
|
||||||
virtual bool isConfigurable() const;
|
virtual bool isConfigurable() const;
|
||||||
|
|
||||||
/* is this filter used also when the shortcutString is not used? */
|
/* Is this filter used also when the shortcutString is not used? */
|
||||||
virtual bool defaultActiveState() const;
|
bool isIncludedByDefault() const;
|
||||||
void setIncludedByDefault(bool includedByDefault);
|
|
||||||
|
/* Returns whether the filter should be hidden from configuration and menus. */
|
||||||
|
bool isHidden() const;
|
||||||
|
|
||||||
static QString trimWildcards(const QString &str) {
|
static QString trimWildcards(const QString &str) {
|
||||||
if (str.isEmpty())
|
if (str.isEmpty())
|
||||||
@@ -143,9 +144,15 @@ public:
|
|||||||
return str.mid(first, last-first+1);
|
return str.mid(first, last-first+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void setShortcutString(const QString &shortcut);
|
||||||
|
void setIncludedByDefault(bool includedByDefault);
|
||||||
|
void setHidden(bool hidden);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_shortcut;
|
QString m_shortcut;
|
||||||
bool m_default;
|
bool m_includedByDefault;
|
||||||
|
bool m_hidden;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QuickOpen
|
} // namespace QuickOpen
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ QuickOpenFiltersFilter::QuickOpenFiltersFilter(QuickOpenPlugin *plugin,
|
|||||||
m_icon(QIcon(Core::Constants::ICON_NEXT))
|
m_icon(QIcon(Core::Constants::ICON_NEXT))
|
||||||
{
|
{
|
||||||
setIncludedByDefault(true);
|
setIncludedByDefault(true);
|
||||||
setShortcutString(QString());
|
setHidden(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QuickOpenFiltersFilter::trName() const
|
QString QuickOpenFiltersFilter::trName() const
|
||||||
@@ -71,8 +71,8 @@ QList<FilterEntry> QuickOpenFiltersFilter::matchesFor(const QString &entry)
|
|||||||
{
|
{
|
||||||
QList<FilterEntry> entries;
|
QList<FilterEntry> entries;
|
||||||
if (entry.isEmpty()) {
|
if (entry.isEmpty()) {
|
||||||
foreach (IQuickOpenFilter* filter, m_plugin->filter()) {
|
foreach (IQuickOpenFilter *filter, m_plugin->filter()) {
|
||||||
if (!filter->shortcutString().isEmpty()) {
|
if (!filter->shortcutString().isEmpty() && !filter->isHidden()) {
|
||||||
FilterEntry entry(this,
|
FilterEntry entry(this,
|
||||||
filter->shortcutString(),
|
filter->shortcutString(),
|
||||||
QVariant::fromValue(filter),
|
QVariant::fromValue(filter),
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ void QuickOpenToolWindow::updateFilterList()
|
|||||||
{
|
{
|
||||||
m_filterMenu->clear();
|
m_filterMenu->clear();
|
||||||
foreach (IQuickOpenFilter *filter, m_quickOpenPlugin->filter()) {
|
foreach (IQuickOpenFilter *filter, m_quickOpenPlugin->filter()) {
|
||||||
if (!filter->shortcutString().isEmpty()) {
|
if (!filter->shortcutString().isEmpty() && !filter->isHidden()) {
|
||||||
QAction *action = m_filterMenu->addAction(filter->trName(), this, SLOT(filterSelected()));
|
QAction *action = m_filterMenu->addAction(filter->trName(), this, SLOT(filterSelected()));
|
||||||
action->setData(qVariantFromValue(filter));
|
action->setData(qVariantFromValue(filter));
|
||||||
}
|
}
|
||||||
@@ -396,7 +396,7 @@ QList<IQuickOpenFilter*> QuickOpenToolWindow::filtersFor(const QString &text, QS
|
|||||||
searchText = text;
|
searchText = text;
|
||||||
QList<IQuickOpenFilter*> activeFilters;
|
QList<IQuickOpenFilter*> activeFilters;
|
||||||
foreach (IQuickOpenFilter *filter, filters)
|
foreach (IQuickOpenFilter *filter, filters)
|
||||||
if (filter->defaultActiveState())
|
if (filter->isIncludedByDefault())
|
||||||
activeFilters << filter;
|
activeFilters << filter;
|
||||||
return activeFilters;
|
return activeFilters;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,8 +121,11 @@ void SettingsPage::updateFilterList()
|
|||||||
{
|
{
|
||||||
m_ui.filterList->clear();
|
m_ui.filterList->clear();
|
||||||
foreach (IQuickOpenFilter *filter, m_filters) {
|
foreach (IQuickOpenFilter *filter, m_filters) {
|
||||||
|
if (filter->isHidden())
|
||||||
|
continue;
|
||||||
|
|
||||||
QString title;
|
QString title;
|
||||||
if (filter->defaultActiveState())
|
if (filter->isIncludedByDefault())
|
||||||
title = filter->trName();
|
title = filter->trName();
|
||||||
else
|
else
|
||||||
title = tr("%1 (Prefix: %2)").arg(filter->trName()).arg(filter->shortcutString());
|
title = tr("%1 (Prefix: %2)").arg(filter->trName()).arg(filter->shortcutString());
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ void testQMap()
|
|||||||
ggt[11] = QStringList() << "11";
|
ggt[11] = QStringList() << "11";
|
||||||
ggt[22] = QStringList() << "22";
|
ggt[22] = QStringList() << "22";
|
||||||
|
|
||||||
#if 0
|
#if 1
|
||||||
QMap<uint, float> gg0;
|
QMap<uint, float> gg0;
|
||||||
gg0[11] = 11.0;
|
gg0[11] = 11.0;
|
||||||
gg0[22] = 22.0;
|
gg0[22] = 22.0;
|
||||||
@@ -413,16 +413,31 @@ void testStdList()
|
|||||||
|
|
||||||
void testStdMap()
|
void testStdMap()
|
||||||
{
|
{
|
||||||
|
std::map<QString, Foo> gg3;
|
||||||
|
gg3["22.0"] = Foo(22);
|
||||||
|
gg3["33.0"] = Foo(33);
|
||||||
|
gg3["44.0"] = Foo(44);
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
std::map<uint, uint> gg;
|
||||||
|
gg[11] = 1;
|
||||||
|
gg[22] = 2;
|
||||||
|
gg[33] = 3;
|
||||||
|
gg[44] = 4;
|
||||||
|
gg[55] = 5;
|
||||||
|
|
||||||
std::map<uint, QStringList> ggl;
|
std::map<uint, QStringList> ggl;
|
||||||
ggl[11] = QStringList() << "11";
|
ggl[11] = QStringList() << "11";
|
||||||
ggl[22] = QStringList() << "22";
|
ggl[22] = QStringList() << "22";
|
||||||
|
ggl[33] = QStringList() << "33";
|
||||||
|
ggl[44] = QStringList() << "44";
|
||||||
|
ggl[55] = QStringList() << "55";
|
||||||
|
|
||||||
typedef std::map<uint, QStringList> T;
|
typedef std::map<uint, QStringList> T;
|
||||||
T ggt;
|
T ggt;
|
||||||
ggt[11] = QStringList() << "11";
|
ggt[11] = QStringList() << "11";
|
||||||
ggt[22] = QStringList() << "22";
|
ggt[22] = QStringList() << "22";
|
||||||
|
|
||||||
#if 0
|
|
||||||
std::map<uint, float> gg0;
|
std::map<uint, float> gg0;
|
||||||
gg0[11] = 11.0;
|
gg0[11] = 11.0;
|
||||||
gg0[22] = 22.0;
|
gg0[22] = 22.0;
|
||||||
@@ -434,15 +449,11 @@ void testStdMap()
|
|||||||
std::map<int, QString> gg2;
|
std::map<int, QString> gg2;
|
||||||
gg2[22] = "22.0";
|
gg2[22] = "22.0";
|
||||||
|
|
||||||
std::map<QString, Foo> gg3;
|
|
||||||
gg3["22.0"] = Foo(22);
|
|
||||||
gg3["33.0"] = Foo(33);
|
|
||||||
|
|
||||||
QObject ob;
|
QObject ob;
|
||||||
std::map<QString, QPointer<QObject> > map;
|
std::map<QString, QPointer<QObject> > map;
|
||||||
map.insert("Hallo", QPointer<QObject>(&ob));
|
map["Hallo"] = QPointer<QObject>(&ob);
|
||||||
map.insert("Welt", QPointer<QObject>(&ob));
|
map["Welt"] = QPointer<QObject>(&ob);
|
||||||
map.insert(".", QPointer<QObject>(&ob));
|
map["."] = QPointer<QObject>(&ob);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user