Changeset View
Changeset View
Standalone View
Standalone View
src/alkonlinequotesprofilemanager.cpp
Show All 13 Lines | |||||
14 | * GNU General Public License for more details. * | 14 | * GNU General Public License for more details. * | ||
15 | * * | 15 | * * | ||
16 | * You should have received a copy of the GNU General Public License * | 16 | * You should have received a copy of the GNU General Public License * | ||
17 | * along with this program. If not, see <http://www.gnu.org/licenses/> * | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/> * | ||
18 | ***************************************************************************/ | 18 | ***************************************************************************/ | ||
19 | 19 | | |||
20 | #include "alkonlinequotesprofilemanager.h" | 20 | #include "alkonlinequotesprofilemanager.h" | ||
21 | #include "alkonlinequotesprofile.h" | 21 | #include "alkonlinequotesprofile.h" | ||
22 | #include "alkwebpage.h" | ||||
23 | | ||||
24 | #include <QPointer> | ||||
22 | 25 | | |||
23 | class AlkOnlineQuotesProfileManager::Private | 26 | class AlkOnlineQuotesProfileManager::Private | ||
24 | { | 27 | { | ||
25 | public: | 28 | public: | ||
26 | AlkOnlineQuotesProfileList m_profiles; | 29 | AlkOnlineQuotesProfileList m_profiles; | ||
30 | QPointer<AlkWebPage> m_page; | ||||
31 | bool m_withPage; | ||||
32 | Private() | ||||
33 | : m_withPage(false) | ||||
34 | { | ||||
35 | } | ||||
36 | | ||||
37 | ~Private() | ||||
38 | { | ||||
39 | delete m_page; | ||||
40 | } | ||||
27 | }; | 41 | }; | ||
28 | 42 | | |||
29 | AlkOnlineQuotesProfileManager::AlkOnlineQuotesProfileManager() | 43 | AlkOnlineQuotesProfileManager::AlkOnlineQuotesProfileManager() | ||
30 | : d(new Private) | 44 | : d(new Private) | ||
31 | { | 45 | { | ||
32 | } | 46 | } | ||
33 | 47 | | |||
34 | AlkOnlineQuotesProfileManager::~AlkOnlineQuotesProfileManager() | 48 | AlkOnlineQuotesProfileManager::~AlkOnlineQuotesProfileManager() | ||
35 | { | 49 | { | ||
36 | delete d; | 50 | delete d; | ||
37 | } | 51 | } | ||
38 | 52 | | |||
53 | bool AlkOnlineQuotesProfileManager::webPageEnabled() | ||||
54 | { | ||||
55 | return d->m_withPage; | ||||
56 | } | ||||
57 | | ||||
58 | void AlkOnlineQuotesProfileManager::setWebPageEnabled(bool enable) | ||||
59 | { | ||||
60 | d->m_withPage = enable; | ||||
61 | } | ||||
62 | | ||||
39 | void AlkOnlineQuotesProfileManager::addProfile(AlkOnlineQuotesProfile *profile) | 63 | void AlkOnlineQuotesProfileManager::addProfile(AlkOnlineQuotesProfile *profile) | ||
40 | { | 64 | { | ||
41 | if (!d->m_profiles.contains(profile)) { | 65 | if (!d->m_profiles.contains(profile)) { | ||
42 | d->m_profiles.append(profile); | 66 | d->m_profiles.append(profile); | ||
43 | profile->setManager(this); | 67 | profile->setManager(this); | ||
44 | } | 68 | } | ||
45 | } | 69 | } | ||
46 | 70 | | |||
Show All 16 Lines | |||||
63 | { | 87 | { | ||
64 | QStringList profiles; | 88 | QStringList profiles; | ||
65 | foreach(AlkOnlineQuotesProfile *profile, AlkOnlineQuotesProfileManager::instance().profiles()) { | 89 | foreach(AlkOnlineQuotesProfile *profile, AlkOnlineQuotesProfileManager::instance().profiles()) { | ||
66 | profiles.append(profile->name()); | 90 | profiles.append(profile->name()); | ||
67 | } | 91 | } | ||
68 | return profiles; | 92 | return profiles; | ||
69 | } | 93 | } | ||
70 | 94 | | |||
95 | AlkWebPage *AlkOnlineQuotesProfileManager::webPage() | ||||
96 | { | ||||
97 | if (!d->m_page) | ||||
98 | d->m_page = new AlkWebPage; | ||||
99 | return d->m_page; | ||||
100 | } | ||||
101 | | ||||
71 | AlkOnlineQuotesProfileManager &AlkOnlineQuotesProfileManager::instance() | 102 | AlkOnlineQuotesProfileManager &AlkOnlineQuotesProfileManager::instance() | ||
72 | { | 103 | { | ||
73 | static AlkOnlineQuotesProfileManager manager; | 104 | static AlkOnlineQuotesProfileManager manager; | ||
74 | return manager; | 105 | return manager; | ||
75 | } | 106 | } |