forked from qt-creator/qt-creator
TextEditor: Hide part of OutlineFactory implementation
Change-Id: Ifb1c743ba53e2e55605b78336b57c993c12ead3e Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
#include "outlinefactory.h"
|
#include "outlinefactory.h"
|
||||||
|
|
||||||
#include "texteditortr.h"
|
#include "texteditortr.h"
|
||||||
|
#include "ioutlinewidget.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -16,6 +17,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QMenu>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
|
||||||
@@ -42,6 +44,37 @@ void IOutlineWidgetFactory::updateOutline()
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class OutlineWidgetStack : public QStackedWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
OutlineWidgetStack(OutlineFactory *factory);
|
||||||
|
~OutlineWidgetStack() override;
|
||||||
|
|
||||||
|
QList<QToolButton *> toolButtons();
|
||||||
|
|
||||||
|
void saveSettings(QSettings *settings, int position);
|
||||||
|
void restoreSettings(QSettings *settings, int position);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool isCursorSynchronized() const;
|
||||||
|
QWidget *dummyWidget() const;
|
||||||
|
void updateFilterMenu();
|
||||||
|
void toggleCursorSynchronization();
|
||||||
|
void toggleSort();
|
||||||
|
void updateEditor(Core::IEditor *editor);
|
||||||
|
void updateCurrentEditor();
|
||||||
|
|
||||||
|
QToolButton *m_toggleSync;
|
||||||
|
QToolButton *m_filterButton;
|
||||||
|
QToolButton *m_toggleSort;
|
||||||
|
QMenu *m_filterMenu;
|
||||||
|
QVariantMap m_widgetSettings;
|
||||||
|
bool m_syncWithEditor;
|
||||||
|
bool m_sorted;
|
||||||
|
};
|
||||||
|
|
||||||
OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
|
OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
|
||||||
m_syncWithEditor(true),
|
m_syncWithEditor(true),
|
||||||
m_sorted(false)
|
m_sorted(false)
|
||||||
@@ -233,3 +266,5 @@ void OutlineFactory::restoreSettings(Utils::QtcSettings *settings, int position,
|
|||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace TextEditor
|
} // namespace TextEditor
|
||||||
|
|
||||||
|
#include "outlinefactory.moc"
|
||||||
|
@@ -3,51 +3,14 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <texteditor/ioutlinewidget.h>
|
|
||||||
#include <coreplugin/inavigationwidgetfactory.h>
|
#include <coreplugin/inavigationwidgetfactory.h>
|
||||||
#include <QStackedWidget>
|
|
||||||
#include <QMenu>
|
|
||||||
|
|
||||||
namespace Core { class IEditor; }
|
namespace TextEditor::Internal {
|
||||||
|
|
||||||
namespace TextEditor {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
class OutlineFactory;
|
|
||||||
|
|
||||||
class OutlineWidgetStack : public QStackedWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
OutlineWidgetStack(OutlineFactory *factory);
|
|
||||||
~OutlineWidgetStack() override;
|
|
||||||
|
|
||||||
QList<QToolButton *> toolButtons();
|
|
||||||
|
|
||||||
void saveSettings(QSettings *settings, int position);
|
|
||||||
void restoreSettings(QSettings *settings, int position);
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool isCursorSynchronized() const;
|
|
||||||
QWidget *dummyWidget() const;
|
|
||||||
void updateFilterMenu();
|
|
||||||
void toggleCursorSynchronization();
|
|
||||||
void toggleSort();
|
|
||||||
void updateEditor(Core::IEditor *editor);
|
|
||||||
void updateCurrentEditor();
|
|
||||||
|
|
||||||
QToolButton *m_toggleSync;
|
|
||||||
QToolButton *m_filterButton;
|
|
||||||
QToolButton *m_toggleSort;
|
|
||||||
QMenu *m_filterMenu;
|
|
||||||
QVariantMap m_widgetSettings;
|
|
||||||
bool m_syncWithEditor;
|
|
||||||
bool m_sorted;
|
|
||||||
};
|
|
||||||
|
|
||||||
class OutlineFactory : public Core::INavigationWidgetFactory
|
class OutlineFactory : public Core::INavigationWidgetFactory
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OutlineFactory();
|
OutlineFactory();
|
||||||
|
|
||||||
@@ -60,5 +23,4 @@ signals:
|
|||||||
void updateOutline();
|
void updateOutline();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // TextEditor::Internal
|
||||||
} // namespace TextEditor
|
|
||||||
|
@@ -43,6 +43,8 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/macroexpander.h>
|
#include <utils/macroexpander.h>
|
||||||
|
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user