~ps-jenkins/hud/utopic-proposed

« back to all changes in this revision

Viewing changes to service/Factory.cpp

  • Committer: CI bot
  • Author(s): Pete Woods
  • Date: 2014-02-18 14:28:24 UTC
  • mfrom: (370.1.2 trunk)
  • Revision ID: ps-jenkins@lists.canonical.com-20140218142824-kvy7sfapbfoa1m4l
Abstract out settings for improved testability Fixes: 1280559

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <service/ApplicationImpl.h>
21
21
#include <service/ApplicationListImpl.h>
22
22
#include <service/AppmenuRegistrarInterface.h>
 
23
#include <service/HardCodedSearchSettings.h>
23
24
#include <service/HudServiceImpl.h>
24
25
#include <service/WindowImpl.h>
 
26
#include <service/QGSettingsSearchSettings.h>
25
27
#include <service/QueryImpl.h>
26
28
#include <service/SqliteUsageTracker.h>
27
29
#include <service/VoiceImpl.h>
109
111
        return m_usageTracker;
110
112
}
111
113
 
 
114
SearchSettings::Ptr Factory::singletonSearchSettings() {
 
115
        if (m_searchSettings.isNull()) {
 
116
                if (qEnvironmentVariableIsSet("HUD_IGNORE_SEARCH_SETTINGS")) {
 
117
                        m_searchSettings.reset(new HardCodedSearchSettings());
 
118
                } else {
 
119
                        m_searchSettings.reset(new QGSettingsSearchSettings());
 
120
                }
 
121
        }
 
122
        return m_searchSettings;
 
123
}
 
124
 
112
125
Voice::Ptr Factory::singletonVoice() {
113
126
        if (m_voice.isNull()) {
114
127
                QSharedPointer<ComCanonicalUnityVoiceInterface> voiceInterface(
126
139
}
127
140
 
128
141
ItemStore::Ptr Factory::newItemStore(const QString &applicationId) {
129
 
        return ItemStore::Ptr(new ItemStore(applicationId, singletonUsageTracker()));
 
142
        return ItemStore::Ptr(
 
143
                        new ItemStore(applicationId, singletonUsageTracker(),
 
144
                                        singletonSearchSettings()));
130
145
}
131
146
 
132
147
Window::Ptr Factory::newWindow(unsigned int windowId,