aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Haumann <[email protected]>2016-06-15 21:38:02 +0200
committerDominik Haumann <[email protected]>2016-06-15 21:38:02 +0200
commite3af0edc9108a76c6024724fde07c497bf93a6c8 (patch)
tree4353889342bf5a679d8817fd7b672886af743b5d
parentbe7b90ee88d0f45d59b2fc10b4517709f4ec02a7 (diff)
Rename activeViewSpace to activeTabBar
-rw-r--r--kate/katetabbar.cpp18
-rw-r--r--kate/katetabbar.h20
-rw-r--r--kate/katetabbutton.cpp10
-rw-r--r--kate/katetabbutton.h2
-rw-r--r--kate/kateviewspace.cpp2
5 files changed, 33 insertions, 19 deletions
diff --git a/kate/katetabbar.cpp b/kate/katetabbar.cpp
index 7ae430d..c89f1b6 100644
--- a/kate/katetabbar.cpp
+++ b/kate/katetabbar.cpp
@@ -47,7 +47,7 @@ public:
qreal currentTabWidth;
bool keepTabWidth;
- bool isActiveViewSpace;
+ bool isActive;
QVector<KateTabButton *> tabButtons;
QHash<int, KateTabButton *> idToTab;
@@ -148,7 +148,7 @@ KateTabBar::KateTabBar(QWidget *parent)
d->currentTabWidth = 350;
d->keepTabWidth = false;
- d->isActiveViewSpace = false;
+ d->isActive = false;
d->activeButton = nullptr;
@@ -166,17 +166,17 @@ KateTabBar::~KateTabBar()
delete d;
}
-void KateTabBar::setActiveViewSpace(bool active)
+void KateTabBar::setActive(bool active)
{
- if (active != d->isActiveViewSpace) {
- d->isActiveViewSpace = active;
+ if (active != d->isActive) {
+ d->isActive = active;
update();
}
}
-bool KateTabBar::isActiveViewSpace() const
+bool KateTabBar::isActive() const
{
- return d->isActiveViewSpace;
+ return d->isActive;
}
int KateTabBar::addTab(const QString &text)
@@ -377,7 +377,7 @@ void KateTabBar::tabButtonActivated(KateTabButton *tabButton)
if (tabButton == d->activeButton) {
// make sure we are the currently active view space
- if (! isActiveViewSpace()) {
+ if (! isActive()) {
emit activateViewSpaceRequested();
}
return;
@@ -441,7 +441,7 @@ void KateTabBar::mouseDoubleClickEvent(QMouseEvent *event)
void KateTabBar::mousePressEvent(QMouseEvent *event)
{
- if (! isActiveViewSpace()) {
+ if (! isActive()) {
emit activateViewSpaceRequested();
}
QWidget::mousePressEvent(event);
diff --git a/kate/katetabbar.h b/kate/katetabbar.h
index 121f10c..2e5f5cb 100644
--- a/kate/katetabbar.h
+++ b/kate/katetabbar.h
@@ -40,7 +40,7 @@ class KateTabBarPrivate;
class KateTabBar : public QWidget
{
Q_OBJECT
- Q_PROPERTY(bool isActiveViewSpace READ isActiveViewSpace WRITE setActiveViewSpace)
+ Q_PROPERTY(bool isActive READ isActive WRITE setActive)
public:
explicit KateTabBar(QWidget *parent = 0);
@@ -96,6 +96,7 @@ public:
* Set the button @p id's tool tip to @p tip.
*/
void setTabToolTip(int index, const QString &tip);
+
/**
* Get the button @p id's url. Result is QStrint() if not available.
*/
@@ -106,6 +107,7 @@ public:
* \see tabText()
*/
void setTabText(int index, const QString &text);
+
/**
* Returns the text of the tab with ID \a id. If the button id does not
* exist \a QString() is returned.
@@ -136,8 +138,20 @@ public:
*/
int maxTabCount() const;
- void setActiveViewSpace(bool active);
- bool isActiveViewSpace() const;
+ /**
+ * Marks this tabbar as active. That is, current-tab indicators are
+ * properly highlighted, indicating that child widgets of this tabbar
+ * will get input.
+ *
+ * This concept is mostly useful, if your application has multiple tabbars.
+ * Inactive tabbars are grayed out.
+ */
+ void setActive(bool active);
+
+ /**
+ * Returns whether this tabbar is active.
+ */
+ bool isActive() const;
Q_SIGNALS:
/**
diff --git a/kate/katetabbutton.cpp b/kate/katetabbutton.cpp
index 05b93cb..7998b50 100644
--- a/kate/katetabbutton.cpp
+++ b/kate/katetabbutton.cpp
@@ -125,8 +125,8 @@ void KateTabButton::paintEvent(QPaintEvent *ev)
QColor barColor(palette().color(QPalette::Highlight));
- // read from the parent widget (=KateTabBar) the isActiveViewSpace property
- if (isActiveViewSpace()) {
+ // read from the parent widget (=KateTabBar) the isActiveTabBar property
+ if (!isActiveTabBar()) {
// if inactive, convert color to gray value
const int g = qGray(barColor.rgb());
barColor = QColor(g, g, g);
@@ -242,12 +242,12 @@ void KateTabButton::moveEvent(QMoveEvent *event)
QAbstractButton::moveEvent(event);
}
-bool KateTabButton::isActiveViewSpace() const
+bool KateTabButton::isActiveTabBar() const
{
Q_ASSERT(parentWidget());
- // read from the parent widget (=KateTabBar) the isActiveViewSpace property
- return ! parentWidget()->property("isActiveViewSpace").toBool();
+ // read from the parent widget (=KateTabBar) the isActive property
+ return parentWidget()->property("isActive").toBool();
}
void KateTabButton::setAnimatedGeometry(const QRect & startGeom,
diff --git a/kate/katetabbutton.h b/kate/katetabbutton.h
index a376fcd..a0afb66 100644
--- a/kate/katetabbutton.h
+++ b/kate/katetabbutton.h
@@ -64,7 +64,7 @@ public:
/**
* Returns @e true, if the tabbar is the currently active tab bar.
*/
- bool isActiveViewSpace() const;
+ bool isActiveTabBar() const;
/**
* Check whether a geometry animation is running.
diff --git a/kate/kateviewspace.cpp b/kate/kateviewspace.cpp
index 63f2db1..5f96493 100644
--- a/kate/kateviewspace.cpp
+++ b/kate/kateviewspace.cpp
@@ -325,7 +325,7 @@ bool KateViewSpace::isActiveSpace()
void KateViewSpace::setActive(bool active)
{
m_isActiveSpace = active;
- m_tabBar->setActiveViewSpace(active);
+ m_tabBar->setActive(active);
}
void KateViewSpace::makeActive(bool focusCurrentView)