From 9331a25905348b5dad857f6c6b96f6015b085f22 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 7 May 2019 09:51:23 -0400 Subject: [PATCH] [libcalamares] Remove Typedefs.h - This small header file contained a few unrelated typedefs. Move those typedefs to the classes they relate to. This **does** mean that some consumers need to #include something else instead. - Use type names more consistently. Editorial: why are **pages** responsible for creating the jobs? --- src/calamares/CalamaresApplication.h | 2 - src/libcalamares/CppJob.h | 1 - src/libcalamares/Job.h | 6 ++- src/libcalamares/JobQueue.h | 2 +- src/libcalamares/Typedefs.h | 37 ------------------- src/libcalamaresui/Branding.h | 1 - src/libcalamaresui/ViewManager.h | 7 +--- src/libcalamaresui/modulesystem/Module.h | 3 +- .../modulesystem/ModuleManager.h | 1 - src/libcalamaresui/viewpages/ViewStep.h | 4 +- src/modules/keyboard/KeyboardPage.h | 8 ++-- src/modules/locale/LocalePage.h | 5 +-- src/modules/netinstall/NetInstallPage.h | 1 - .../partition/core/PartitionCoreModule.cpp | 1 - .../partition/core/PartitionCoreModule.h | 5 ++- src/modules/partition/core/PartitionLayout.h | 2 - src/modules/summary/SummaryPage.h | 2 +- src/modules/users/UsersPage.h | 5 +-- 18 files changed, 22 insertions(+), 71 deletions(-) delete mode 100644 src/libcalamares/Typedefs.h diff --git a/src/calamares/CalamaresApplication.h b/src/calamares/CalamaresApplication.h index 71778813e..9f53726ae 100644 --- a/src/calamares/CalamaresApplication.h +++ b/src/calamares/CalamaresApplication.h @@ -20,8 +20,6 @@ #ifndef CALAMARESAPPLICATION_H #define CALAMARESAPPLICATION_H -#include "Typedefs.h" - #include class CalamaresWindow; diff --git a/src/libcalamares/CppJob.h b/src/libcalamares/CppJob.h index d2f5c0f79..36116b3e7 100644 --- a/src/libcalamares/CppJob.h +++ b/src/libcalamares/CppJob.h @@ -24,7 +24,6 @@ #include #include "DllMacro.h" -#include "Typedefs.h" #include "Job.h" namespace Calamares diff --git a/src/libcalamares/Job.h b/src/libcalamares/Job.h index 14924af35..f590ef0ee 100644 --- a/src/libcalamares/Job.h +++ b/src/libcalamares/Job.h @@ -20,9 +20,10 @@ #define CALAMARES_JOB_H #include "DllMacro.h" -#include "Typedefs.h" +#include #include +#include namespace Calamares { @@ -97,6 +98,9 @@ private: bool m_emergency = false; }; +using job_ptr = QSharedPointer< Job >; +using JobList = QList< job_ptr >; + } // namespace Calamares #endif // CALAMARES_JOB_H diff --git a/src/libcalamares/JobQueue.h b/src/libcalamares/JobQueue.h index 5273e0043..4e5dffe8a 100644 --- a/src/libcalamares/JobQueue.h +++ b/src/libcalamares/JobQueue.h @@ -20,7 +20,7 @@ #define CALAMARES_JOBQUEUE_H #include "DllMacro.h" -#include "Typedefs.h" +#include "Job.h" #include diff --git a/src/libcalamares/Typedefs.h b/src/libcalamares/Typedefs.h deleted file mode 100644 index 6d61b6995..000000000 --- a/src/libcalamares/Typedefs.h +++ /dev/null @@ -1,37 +0,0 @@ -/* === This file is part of Calamares - === - * - * Copyright 2014, Teo Mrnjavac - * - * Calamares is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Calamares is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Calamares. If not, see . - */ - -#ifndef TYPEDEFS_H -#define TYPEDEFS_H - -#include -#include - -namespace Calamares -{ -class Job; - -typedef QSharedPointer< Job > job_ptr; -using JobList = QList< job_ptr >; - -class ViewStep; -typedef QList< ViewStep* > ViewStepList; - -} //ns - -#endif // TYPEDEFS_H diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index 572cd3682..29a39f103 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -22,7 +22,6 @@ #define BRANDING_H #include "UiDllMacro.h" -#include "Typedefs.h" #include "utils/NamedSuffix.h" diff --git a/src/libcalamaresui/ViewManager.h b/src/libcalamaresui/ViewManager.h index ee199f725..65d787e44 100644 --- a/src/libcalamaresui/ViewManager.h +++ b/src/libcalamaresui/ViewManager.h @@ -21,19 +21,14 @@ #define VIEWMANAGER_H #include "UiDllMacro.h" -#include "Typedefs.h" +#include "viewpages/ViewStep.h" #include #include #include - namespace Calamares { - -class ViewStep; -class ExecutionViewStep; - /** * @brief The ViewManager class handles progression through view pages. * @note Singleton object, only use through ViewManager::instance(). diff --git a/src/libcalamaresui/modulesystem/Module.h b/src/libcalamaresui/modulesystem/Module.h index 2a283807d..6da9c0ce4 100644 --- a/src/libcalamaresui/modulesystem/Module.h +++ b/src/libcalamaresui/modulesystem/Module.h @@ -20,11 +20,10 @@ #ifndef CALAMARES_MODULE_H #define CALAMARES_MODULE_H +#include "Job.h" #include "Requirement.h" #include "UiDllMacro.h" -#include - #include #include diff --git a/src/libcalamaresui/modulesystem/ModuleManager.h b/src/libcalamaresui/modulesystem/ModuleManager.h index 689d61a77..64db75b6a 100644 --- a/src/libcalamaresui/modulesystem/ModuleManager.h +++ b/src/libcalamaresui/modulesystem/ModuleManager.h @@ -21,7 +21,6 @@ #define MODULELOADER_H #include "Requirement.h" -#include "Typedefs.h" #include #include diff --git a/src/libcalamaresui/viewpages/ViewStep.h b/src/libcalamaresui/viewpages/ViewStep.h index 631c41314..e3d5a021e 100644 --- a/src/libcalamaresui/viewpages/ViewStep.h +++ b/src/libcalamaresui/viewpages/ViewStep.h @@ -20,10 +20,11 @@ #ifndef VIEWSTEP_H #define VIEWSTEP_H +#include #include #include -#include "Typedefs.h" +#include "Job.h" #include "UiDllMacro.h" #include "modulesystem/Requirement.h" @@ -159,6 +160,7 @@ protected: QString m_instanceKey; }; +using ViewStepList = QList< ViewStep* >; } #endif // VIEWSTEP_H diff --git a/src/modules/keyboard/KeyboardPage.h b/src/modules/keyboard/KeyboardPage.h index 99f8ee449..dca8b869a 100644 --- a/src/modules/keyboard/KeyboardPage.h +++ b/src/modules/keyboard/KeyboardPage.h @@ -24,13 +24,11 @@ #ifndef KEYBOARDPAGE_H #define KEYBOARDPAGE_H -#include "keyboardwidget/keyboardglobal.h" - -#include "Typedefs.h" +#include "Job.h" #include -#include #include +#include namespace Ui { @@ -50,7 +48,7 @@ public: QString prettyStatus() const; - QList< Calamares::job_ptr > createJobs( const QString& xOrgConfFileName, + Calamares::JobList createJobs( const QString& xOrgConfFileName, const QString& convertedKeymapPath, bool writeEtcDefaultKeyboard ); diff --git a/src/modules/locale/LocalePage.h b/src/modules/locale/LocalePage.h index 2a9dc8b60..20ad444c9 100644 --- a/src/modules/locale/LocalePage.h +++ b/src/modules/locale/LocalePage.h @@ -20,9 +20,8 @@ #ifndef LOCALEPAGE_H #define LOCALEPAGE_H -#include "Typedefs.h" - #include "LocaleConfiguration.h" +#include "Job.h" #include @@ -44,7 +43,7 @@ public: QString prettyStatus() const; - QList< Calamares::job_ptr > createJobs(); + Calamares::JobList createJobs(); QMap< QString, QString > localesMap(); diff --git a/src/modules/netinstall/NetInstallPage.h b/src/modules/netinstall/NetInstallPage.h index 7ec37e7ac..b2887304b 100644 --- a/src/modules/netinstall/NetInstallPage.h +++ b/src/modules/netinstall/NetInstallPage.h @@ -23,7 +23,6 @@ #include "PackageModel.h" #include "PackageTreeItem.h" -#include "Typedefs.h" #include #include diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index b230a23fb..6dd2b6faf 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -50,7 +50,6 @@ #ifdef DEBUG_PARTITION_LAME #include "JobExample.h" #endif -#include "Typedefs.h" #include "utils/Logger.h" // KPMcore diff --git a/src/modules/partition/core/PartitionCoreModule.h b/src/modules/partition/core/PartitionCoreModule.h index aebf9835f..906119a74 100644 --- a/src/modules/partition/core/PartitionCoreModule.h +++ b/src/modules/partition/core/PartitionCoreModule.h @@ -24,7 +24,8 @@ #include "core/KPMHelpers.h" #include "core/PartitionLayout.h" #include "core/PartitionModel.h" -#include "Typedefs.h" + +#include "Job.h" // KPMcore #include @@ -172,7 +173,7 @@ public: * requested by the user. * @return a list of jobs. */ - QList< Calamares::job_ptr > jobs() const; + Calamares::JobList jobs() const; bool hasRootMountPoint() const; diff --git a/src/modules/partition/core/PartitionLayout.h b/src/modules/partition/core/PartitionLayout.h index 626c90b66..1d2fee410 100644 --- a/src/modules/partition/core/PartitionLayout.h +++ b/src/modules/partition/core/PartitionLayout.h @@ -22,8 +22,6 @@ #include "core/PartUtils.h" -#include "Typedefs.h" - // KPMcore #include #include diff --git a/src/modules/summary/SummaryPage.h b/src/modules/summary/SummaryPage.h index c165d3e33..b9a98f2a1 100644 --- a/src/modules/summary/SummaryPage.h +++ b/src/modules/summary/SummaryPage.h @@ -19,7 +19,7 @@ #ifndef SUMMARYPAGE_H #define SUMMARYPAGE_H -#include "Typedefs.h" +#include "viewpages/ViewStep.h" #include diff --git a/src/modules/users/UsersPage.h b/src/modules/users/UsersPage.h index a238461ec..ac1e1f9db 100644 --- a/src/modules/users/UsersPage.h +++ b/src/modules/users/UsersPage.h @@ -24,9 +24,8 @@ #ifndef USERSPAGE_H #define USERSPAGE_H -#include "Typedefs.h" - #include "CheckPWQuality.h" +#include "Job.h" #include @@ -44,7 +43,7 @@ public: bool isReady(); - QList< Calamares::job_ptr > createJobs( const QStringList& defaultGroupsList ); + Calamares::JobList createJobs( const QStringList& defaultGroupsList ); void onActivate();