From d9c6f17e42b3dc4d23e0bbf81594665f68b8a83d Mon Sep 17 00:00:00 2001 From: vladest Date: Mon, 30 Oct 2017 20:06:17 +0100 Subject: [PATCH] Coding standards --- interface/src/Application.cpp | 2 +- ...ggestionsengine.cpp => WebBrowserSuggestionsEngine.cpp} | 7 ++++--- ...ersuggestionsengine.h => WebBrowserSuggestionsEngine.h} | 0 3 files changed, 5 insertions(+), 4 deletions(-) rename interface/src/webbrowser/{webbrowsersuggestionsengine.cpp => WebBrowserSuggestionsEngine.cpp} (92%) rename interface/src/webbrowser/{webbrowsersuggestionsengine.h => WebBrowserSuggestionsEngine.h} (100%) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index bf2754917b..ab1884f67a 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -203,7 +203,7 @@ #include "commerce/Wallet.h" #include "commerce/QmlCommerce.h" -#include "webbrowser/webbrowsersuggestionsengine.h" +#include "webbrowser/WebBrowserSuggestionsEngine.h" // On Windows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU // FIXME seems to be broken. diff --git a/interface/src/webbrowser/webbrowsersuggestionsengine.cpp b/interface/src/webbrowser/WebBrowserSuggestionsEngine.cpp similarity index 92% rename from interface/src/webbrowser/webbrowsersuggestionsengine.cpp rename to interface/src/webbrowser/WebBrowserSuggestionsEngine.cpp index 546d9c68b0..40af21753b 100644 --- a/interface/src/webbrowser/webbrowsersuggestionsengine.cpp +++ b/interface/src/webbrowser/WebBrowserSuggestionsEngine.cpp @@ -9,7 +9,7 @@ // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // -#include "webbrowsersuggestionsengine.h" +#include "WebBrowserSuggestionsEngine.h" #include "qregexp.h" #include @@ -26,6 +26,7 @@ #include const QString GoogleSuggestionsUrl = "https://suggestqueries.google.com/complete/search?output=firefox&q=%1"; +const int SUGGESTIONS_LIST_INDEX = 2; WebBrowserSuggestionsEngine::WebBrowserSuggestionsEngine(QObject* parent) : QObject(parent) @@ -72,12 +73,12 @@ void WebBrowserSuggestionsEngine::suggestionsFinished(QNetworkReply *reply) { const QVariantList list = res.toList(); - if (list.size() < 2) { + if (list.size() <= SUGGESTIONS_LIST_INDEX) { return; } QStringList out; - const QVariantList& suggList = list.at(1).toList(); + const QVariantList& suggList = list.at(SUGGESTIONS_LIST_INDEX).toList(); foreach (const QVariant &v, suggList) { out.append(v.toString()); diff --git a/interface/src/webbrowser/webbrowsersuggestionsengine.h b/interface/src/webbrowser/WebBrowserSuggestionsEngine.h similarity index 100% rename from interface/src/webbrowser/webbrowsersuggestionsengine.h rename to interface/src/webbrowser/WebBrowserSuggestionsEngine.h