alkimia  8.0.3
alkonlinequotesprofilemanager.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright 2018 Ralf Habacker <ralf.habacker@freenet.de> *
3  * *
4  * This file is part of libalkimia. *
5  * *
6  * libalkimia is free software; you can redistribute it and/or *
7  * modify it under the terms of the GNU Lesser General Public License *
8  * as published by the Free Software Foundation; either version 2.1 of *
9  * the License or (at your option) version 3 or any later version. *
10  * *
11  * libalkimia is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
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/> *
18  ***************************************************************************/
19 
21 #include "alkonlinequotesprofile.h"
22 #include "alkwebpage.h"
23 
24 #include <QPointer>
25 
27 {
28 public:
30  QPointer<AlkWebPage> m_page;
31  bool m_withPage;
32  Private()
33  : m_withPage(false)
34  {
35  }
36 
37  ~Private()
38  {
39  m_page.data()->deleteLater();
40  }
41 };
42 
44  : d(new Private)
45 {
46 }
47 
49 {
50  delete d;
51 }
52 
54 {
55  return d->m_withPage;
56 }
57 
59 {
60  d->m_withPage = enable;
61 }
62 
64 {
65  if (!d->m_profiles.contains(profile)) {
66  d->m_profiles.append(profile);
67  profile->setManager(this);
68  }
69 }
70 
72 {
73  return d->m_profiles;
74 }
75 
77 {
79  if (name == profile->name()) {
80  return profile;
81  }
82  }
83  return nullptr;
84 }
85 
87 {
88  QStringList profiles;
90  profiles.append(profile->name());
91  }
92  return profiles;
93 }
94 
96 {
97  if (!d->m_page)
98  d->m_page = new AlkWebPage;
99  return d->m_page;
100 }
101 
103 {
104  static AlkOnlineQuotesProfileManager manager;
105  return manager;
106 }
AlkOnlineQuotesProfileManager::Private::Private
Private()
Definition: alkonlinequotesprofilemanager.cpp:49
AlkOnlineQuotesProfileManager::~AlkOnlineQuotesProfileManager
~AlkOnlineQuotesProfileManager()
Definition: alkonlinequotesprofilemanager.cpp:48
AlkOnlineQuotesProfileManager::Private::m_profiles
AlkOnlineQuotesProfileList m_profiles
Definition: alkonlinequotesprofilemanager.cpp:46
AlkOnlineQuotesProfileManager::profileNames
QStringList profileNames()
Definition: alkonlinequotesprofilemanager.cpp:86
AlkOnlineQuotesProfileManager::Private::m_withPage
bool m_withPage
Definition: alkonlinequotesprofilemanager.cpp:48
AlkWebPage
Definition: alkwebpage.h:70
AlkOnlineQuotesProfileManager
Definition: alkonlinequotesprofilemanager.h:33
AlkOnlineQuotesProfile
Definition: alkonlinequotesprofile.h:35
AlkOnlineQuotesProfileManager::Private
Definition: alkonlinequotesprofilemanager.cpp:27
AlkOnlineQuotesProfileManager::Private::~Private
~Private()
Definition: alkonlinequotesprofilemanager.cpp:54
AlkOnlineQuotesProfileManager::profile
AlkOnlineQuotesProfile * profile(const QString &name)
Definition: alkonlinequotesprofilemanager.cpp:76
AlkOnlineQuotesProfileManager::instance
static AlkOnlineQuotesProfileManager & instance()
Definition: alkonlinequotesprofilemanager.cpp:102
AlkOnlineQuotesProfile::setManager
void setManager(AlkOnlineQuotesProfileManager *manager)
Definition: alkonlinequotesprofile.cpp:408
AlkOnlineQuotesProfileManager::webPageEnabled
bool webPageEnabled()
Definition: alkonlinequotesprofilemanager.cpp:53
AlkOnlineQuotesProfileManager::AlkOnlineQuotesProfileManager
AlkOnlineQuotesProfileManager()
Definition: alkonlinequotesprofilemanager.cpp:43
AlkOnlineQuotesProfileList
QList< AlkOnlineQuotesProfile * > AlkOnlineQuotesProfileList
Definition: alkonlinequotesprofilemanager.h:28
alkonlinequotesprofile.h
AlkOnlineQuotesProfileManager::webPage
AlkWebPage * webPage()
Definition: alkonlinequotesprofilemanager.cpp:95
AlkOnlineQuotesProfile::name
QString name() const
Definition: alkonlinequotesprofile.cpp:312
alkwebpage.h
AlkOnlineQuotesProfileManager::setWebPageEnabled
void setWebPageEnabled(bool enable)
Definition: alkonlinequotesprofilemanager.cpp:58
alkonlinequotesprofilemanager.h
AlkOnlineQuotesProfileManager::profiles
AlkOnlineQuotesProfileList profiles()
Definition: alkonlinequotesprofilemanager.cpp:71
AlkOnlineQuotesProfileManager::d
Private *const d
Definition: alkonlinequotesprofilemanager.h:48
AlkOnlineQuotesProfileManager::addProfile
void addProfile(AlkOnlineQuotesProfile *profile)
Definition: alkonlinequotesprofilemanager.cpp:63
AlkOnlineQuotesProfileManager::Private::m_page
QPointer< AlkWebPage > m_page
Definition: alkonlinequotesprofilemanager.cpp:47