summaryrefslogtreecommitdiffstats
path: root/application/pages/BasePageProvider.h
diff options
context:
space:
mode:
Diffstat (limited to 'application/pages/BasePageProvider.h')
-rw-r--r--application/pages/BasePageProvider.h67
1 files changed, 34 insertions, 33 deletions
diff --git a/application/pages/BasePageProvider.h b/application/pages/BasePageProvider.h
index 1cc7458a..ad29f163 100644
--- a/application/pages/BasePageProvider.h
+++ b/application/pages/BasePageProvider.h
@@ -1,4 +1,4 @@
-/* Copyright 2013-2018 MultiMC Contributors
+/* Copyright 2013-2019 MultiMC Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,46 +22,47 @@
class BasePageProvider
{
public:
- virtual QList<BasePage *> getPages() = 0;
- virtual QString dialogTitle() = 0;
+ virtual QList<BasePage *> getPages() = 0;
+ virtual QString dialogTitle() = 0;
};
class GenericPageProvider : public BasePageProvider
{
- typedef std::function<BasePage *()> PageCreator;
+ typedef std::function<BasePage *()> PageCreator;
public:
- explicit GenericPageProvider(const QString &dialogTitle)
- : m_dialogTitle(dialogTitle)
- {
- }
+ explicit GenericPageProvider(const QString &dialogTitle)
+ : m_dialogTitle(dialogTitle)
+ {
+ }
+ virtual ~GenericPageProvider() {}
- QList<BasePage *> getPages() override
- {
- QList<BasePage *> pages;
- for (PageCreator creator : m_creators)
- {
- pages.append(creator());
- }
- return pages;
- }
- QString dialogTitle() override { return m_dialogTitle; }
+ QList<BasePage *> getPages() override
+ {
+ QList<BasePage *> pages;
+ for (PageCreator creator : m_creators)
+ {
+ pages.append(creator());
+ }
+ return pages;
+ }
+ QString dialogTitle() override { return m_dialogTitle; }
- void setDialogTitle(const QString &title)
- {
- m_dialogTitle = title;
- }
- void addPageCreator(PageCreator page)
- {
- m_creators.append(page);
- }
+ void setDialogTitle(const QString &title)
+ {
+ m_dialogTitle = title;
+ }
+ void addPageCreator(PageCreator page)
+ {
+ m_creators.append(page);
+ }
- template<typename PageClass>
- void addPage()
- {
- addPageCreator([](){return new PageClass();});
- }
+ template<typename PageClass>
+ void addPage()
+ {
+ addPageCreator([](){return new PageClass();});
+ }
private:
- QList<PageCreator> m_creators;
- QString m_dialogTitle;
+ QList<PageCreator> m_creators;
+ QString m_dialogTitle;
};