Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use the foreach macro to iterate through pages

  • Loading branch information...
commit d154a65fe88a5656cfc4532d678603686ff6cadd 1 parent 8f8c95d
@mhoran mhoran authored
View
7 src/GetWindowHandles.cpp
@@ -8,14 +8,11 @@ GetWindowHandles::GetWindowHandles(WebPageManager *manager, QStringList &argumen
}
void GetWindowHandles::start() {
- QListIterator<WebPage *> pageIterator = manager()->iterator();
-
QString handles = "[";
QStringList stringList;
- while (pageIterator.hasNext()) {
- stringList.append("\"" + pageIterator.next()->uuid() + "\"");
- }
+ foreach(WebPage *page, manager()->pages())
+ stringList.append("\"" + page->uuid() + "\"");
handles += stringList.join(",") + "]";
View
4 src/WebPageManager.cpp
@@ -11,8 +11,8 @@ void WebPageManager::append(WebPage *value) {
m_pages.append(value);
}
-QListIterator<WebPage *> WebPageManager::iterator() {
- return QListIterator<WebPage *>(m_pages);
+QList<WebPage *> WebPageManager::pages() {
+ return m_pages;
}
void WebPageManager::setCurrentPage(WebPage *page) {
View
2  src/WebPageManager.h
@@ -11,7 +11,7 @@ class WebPageManager : public QObject {
public:
WebPageManager(QObject *parent = 0);
void append(WebPage *value);
- QListIterator<WebPage *> iterator();
+ QList<WebPage *> pages();
void setCurrentPage(WebPage *);
WebPage *currentPage();
WebPage *createPage(QObject *parent);
View
6 src/WindowFocus.cpp
@@ -21,11 +21,7 @@ void WindowFocus::success(WebPage *page) {
}
void WindowFocus::focusWindow(QString selector) {
- QListIterator<WebPage *> pageIterator = manager()->iterator();
-
- while (pageIterator.hasNext()) {
- WebPage *page = pageIterator.next();
-
+ foreach(WebPage *page, manager()->pages()) {
if (page->matchesWindowSelector(selector)) {
success(page);
return;
Please sign in to comment.
Something went wrong with that request. Please try again.