Commit ab6b678d authored by Dominik Haumann's avatar Dominik Haumann

implement correct document switching

parent 5e5ff057
This diff is collapsed.
......@@ -43,17 +43,6 @@ class KateTabBar : public QWidget
* Sort types.
enum SortType {
OpeningOrder = 0, ///< opening order
Name, ///< alphabetically
Extension ///< by file extension (suffix)
Q_DECLARE_FLAGS(SortTypes, SortType)
// NOTE: as the API here is very self-explaining the docs are in the cpp
// file, more clean imho.
......@@ -74,8 +63,8 @@ public:
int tabHeight() const;
int addTab(const QString &text);
int addTab(const QIcon &pixmap, const QString &text);
void removeTab(int index);
int insertTab(int position, const QString & text);
int removeTab(int index);
int currentTab() const;
// corresponding SLOT: void setCurrentTab( int index );
......@@ -96,9 +85,6 @@ public:
int count() const;
void setTabSortType(SortType sort);
SortType tabSortType() const;
void setHighlightMarks(const QMap<QString, QString> &marks);
QMap<QString, QString> highlightMarks() const;
......@@ -107,7 +93,6 @@ public:
public Q_SLOTS:
void setCurrentTab(int index); // does not emit signal
void removeHighlightMarks();
void raiseTab(int index);
......@@ -126,6 +111,20 @@ Q_SIGNALS:
void highlightMarksChanged(KateTabBar *tabbar);
* This signal is emitted whenever the tab bar's width allows to
* show more tabs than currently available. In other words,
* you can safely add @p count tabs which are guaranteed to be visible.
void moreTabsRequested(int count);
* This signal is emitted whenever the tab bar's width is too small,
* such that not all tabs can be shown.
* Therefore, @p count tabs should be removed.
void lessTabsRequested(int count);
protected Q_SLOTS:
void tabButtonActivated(KateTabButton *tabButton);
void tabButtonHighlightChanged(KateTabButton *tabButton);
......@@ -138,8 +137,7 @@ protected:
void updateFixedHeight();
void triggerResizeEvent();
void updateSort();
void updateButtonPositions();
int m_minimumTabWidth;
......@@ -155,8 +153,6 @@ private:
// map of highlighted tabs and colors
QMap< QString, QString > m_highlightedTabs;
SortType m_sortType;
#endif // KATE_TAB_BAR_H
This diff is collapsed.
......@@ -42,7 +42,6 @@ class KateViewSpace : public QWidget
explicit KateViewSpace(KateViewManager *, QWidget *parent = 0, const char *name = 0);
bool isActiveSpace();
void setActive(bool b, bool showled = false);
......@@ -60,12 +59,7 @@ public:
bool showView(KTextEditor::Document *document);
KTextEditor::View *viewForDocument(KTextEditor::Document *document) const;
KTextEditor::View *currentView();
int viewCount() const {
return mViewList.count();
void saveConfig(KConfigBase *config, int myIndex, const QString &viewConfGrp);
void restoreConfig(KateViewManager *viewMan, const KConfigBase *config, const QString &group);
......@@ -89,19 +83,53 @@ private Q_SLOTS:
void statusBarToggled();
void changeView(int buttonId);
* Add a tab for @p doc at position @p index.
void insertTab(int index, KTextEditor::Document * doc);
* Remove tab for @p doc, and return the index (position)
* of the removed tab.
int removeTab(KTextEditor::Document * doc);
* Remove @p count tabs, since the tab bar shrinked.
void removeTabs(int count);
* Add @p count tabs, since the tab bar grew.
void addTabs(int count);
QStackedWidget *stack;
bool mIsActiveSpace;
/// This list is necessary to only save the order of the accessed views.
/// The order is important. The least recently viewed view is always the
/// last entry in the list, i.e. mViewList.last()
/// mViewList.count() == stack.count() is always true!
QList<KTextEditor::View *> mViewList;
// Kate's view manager
KateViewManager *m_viewManager;
// config group string, used for restoring View session configuration
QString m_group;
// flag that indicates whether this view space is the active one.
// correct setter: m_viewManager->setActiveSpace(this);
bool mIsActiveSpace;
// widget stack that contains all KTE::Views
QStackedWidget *stack;
// document's in the view space, sorted in LRU mode:
// the least recently used Document is at the end of the list
QVector<KTextEditor::Document *> m_lruDocList;
// the list of views that are contained in this view space,
// mapped through a hash from Document to View.
// note: the number of entries match stack->count();
QHash<KTextEditor::Document*, KTextEditor::View*> m_docToView;
// tab bar that contains viewspace tabs
KateTabBar *m_tabBar;
// map from Document to button id
QHash<KTextEditor::Document *, int> m_docToTabId;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment