@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2012 Canonical, Ltd.
2+ * Copyright (C) 2013 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -17,7 +17,6 @@
1717 */
1818
1919 #include "menucontentactivator.h"
20− #include <QDebug>
2120
2221// Essentially a QTimer wrapper
2322class ContentTimer : public UnityIndicators::AbstractTimer
@@ -96,9 +95,7 @@ void MenuContentActivator::restart()
9695 d->findNextInactiveDelta(&finished);
9796 if (!finished) {
9897 d->m_timer->start();
99− }
100− else {
101− // stop the timer.
98+ } else {
10299 d->m_timer->stop();
103100 }
104101
@@ -131,7 +128,7 @@ void MenuContentActivator::clear()
131128bool MenuContentActivator::isMenuContentActive(int index) const
132129{
133130 if (d->m_content.contains(index))
134− return d->m_content[index]->active();
131+ return d->m_content[index]->isActive();
135132 return false;
136133}
137134
@@ -139,13 +136,12 @@ void MenuContentActivator::setRunning(bool running)
139136{
140137 if (running) {
141138 restart();
142− }
143− else {
139+ } else {
144140 stop();
145141 }
146142}
147143
148−bool MenuContentActivator::running() const
144+bool MenuContentActivator::isRunning() const
149145{
150146 return d->m_running;
151147}
@@ -155,19 +151,10 @@ void MenuContentActivator::setBaseIndex(int index)
155151 if (d->m_baseIndex != index) {
156152 d->m_baseIndex = index;
157153
158− // if we've updated the base index, we need to
159− bool finished = false;
160− d->findNextInactiveDelta(&finished);
161− if (running()) {
162− if (!isMenuContentActive(d->m_baseIndex)) {
163− setMenuContentState(d->m_baseIndex, true);
164− }
165− if (finished) {
166− // stop the timer.
167− d->m_timer->stop();
168− }
154+ if (isRunning()) {
155+ restart();
169156 }
170− setDelta(0);
157+
171158 Q_EMIT baseIndexChanged(index);
172159 }
173160}
@@ -183,7 +170,7 @@ void MenuContentActivator::setCount(int count)
183170 d->m_count = count;
184171 Q_EMIT countChanged(count);
185172
186− if (running()) {
173+ if (isRunning()) {
187174 restart();
188175 }
189176 }
@@ -225,7 +212,6 @@ void MenuContentActivator::onTimeout()
225212 }
226213
227214 if (finished) {
228− // just stop the timer.
229215 d->m_timer->stop();
230216 }
231217}
@@ -257,8 +243,7 @@ void MenuContentActivator::setMenuContentState(int index, bool active)
257243{
258244 if (d->m_content.contains(index)) {
259245 d->m_content[index]->setActive(active);
260− }
261− else {
246+ } else {
262247 d->m_content[index] = new MenuContentState(active);
263248 Q_EMIT contentChanged();
264249 }
@@ -292,8 +277,7 @@ int MenuContentActivatorPrivate::findNextInactiveDelta(bool* finished)
292277 }
293278 continue;
294279 }
295− }
296− else {
280+ } else {
297281 // positive of baseIndex
298282 tmpDelta = (-tmpDelta) + 1;
299283 // reached the top?
@@ -344,7 +328,7 @@ MenuContentState::MenuContentState(bool active)
344328{
345329}
346330
347−bool MenuContentState::active() const
331+bool MenuContentState::isActive() const
348332{
349333 return m_active;
350334}