LibrePCB Developers Documentation
Loading...
Searching...
No Matches
initializeworkspacewizardcontext.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program 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
20#ifndef LIBREPCB_EDITOR_INITIALIZEWORKSPACEWIZARDCONTEXT_H
21#define LIBREPCB_EDITOR_INITIALIZEWORKSPACEWIZARDCONTEXT_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
29
30#include <QtCore>
31
32/*******************************************************************************
33 * Namespace / Forward Declarations
34 ******************************************************************************/
35namespace librepcb {
36namespace editor {
37
38/*******************************************************************************
39 * Class InitializeWorkspaceWizardContext
40 ******************************************************************************/
41
45class InitializeWorkspaceWizardContext final : public QObject {
46 Q_OBJECT
47
48public:
49 // Types
57
58 // Constructors / Destructor
60 const InitializeWorkspaceWizardContext& other) = delete;
61 explicit InitializeWorkspaceWizardContext(QObject* parent = nullptr) noexcept;
63
64 // Getters
65 const FilePath& getWorkspacePath() const noexcept { return mWorkspacePath; }
66 bool isWorkspacePathValid() const noexcept { return mWorkspacePathValid; }
67 bool getWorkspaceExists() const noexcept { return mWorkspaceExists; }
68 const QString& getDataDir() const noexcept { return mDataDir; }
69 const std::pair<QString, QString>& getUpgradeCopyDirs() const noexcept {
70 return mUpgradeCopyDirs;
71 }
72 bool getNeedsInitialization() const noexcept {
73 return !mDataDirs.contains(mDataDir);
74 }
75 bool getNeedsUpgrade() const noexcept {
76 return !mUpgradeCopyDirs.first.isEmpty();
77 }
78 bool getWorkspaceContainsNewerFileFormats() const noexcept;
79
80 // Setters
81 void setWorkspacePath(const FilePath& fp);
82 void setAppLocale(const QString& locale) noexcept { mAppLocale = locale; }
83 void setLengthUnit(const LengthUnit& unit) noexcept { mLengthUnit = unit; }
84 void setLibraryNormOrder(const QStringList& order) noexcept {
85 mLibraryNormOrder = order;
86 }
87 void setUserName(const QString& name) noexcept { mUserName = name; }
88
89 // General Methods
90 void initializeEmptyWorkspace() const;
91 void installExampleProjects() const noexcept;
92
93 // Operator Overloadings
95 const InitializeWorkspaceWizardContext& rhs) = delete;
96
97private: // Data
101 QMap<QString, Version> mDataDirs;
102 QString mDataDir;
103 std::pair<QString, QString> mUpgradeCopyDirs;
104
105 // Settings.
106 QString mAppLocale;
108 QStringList mLibraryNormOrder;
109 QString mUserName;
110};
111
112/*******************************************************************************
113 * End of File
114 ******************************************************************************/
115
116} // namespace editor
117} // namespace librepcb
118
119#endif
This class represents absolute, well-formatted paths to files or directories.
Definition filepath.h:127
The LengthUnit class represents a length unit (millimeters, inches,...) and provides some useful meth...
Definition lengthunit.h:60
The Version class represents a version number in the format "1.42.7".
Definition version.h:58
The InitializeWorkspaceWizardContext class.
Definition initializeworkspacewizardcontext.h:45
void initializeEmptyWorkspace() const
Definition initializeworkspacewizardcontext.cpp:96
bool getWorkspaceContainsNewerFileFormats() const noexcept
Definition initializeworkspacewizardcontext.cpp:65
QString mAppLocale
Definition initializeworkspacewizardcontext.h:106
QMap< QString, Version > mDataDirs
Definition initializeworkspacewizardcontext.h:101
const QString & getDataDir() const noexcept
Definition initializeworkspacewizardcontext.h:68
bool getWorkspaceExists() const noexcept
Definition initializeworkspacewizardcontext.h:67
const FilePath & getWorkspacePath() const noexcept
Definition initializeworkspacewizardcontext.h:65
bool getNeedsInitialization() const noexcept
Definition initializeworkspacewizardcontext.h:72
PageId
Definition initializeworkspacewizardcontext.h:50
@ ID_ChooseSettings
Definition initializeworkspacewizardcontext.h:55
@ ID_None
last page
Definition initializeworkspacewizardcontext.h:51
@ ID_ChooseWorkspace
Definition initializeworkspacewizardcontext.h:53
@ ID_Upgrade
Definition initializeworkspacewizardcontext.h:54
@ ID_Welcome
Definition initializeworkspacewizardcontext.h:52
bool mWorkspacePathValid
Definition initializeworkspacewizardcontext.h:99
bool getNeedsUpgrade() const noexcept
Definition initializeworkspacewizardcontext.h:75
bool isWorkspacePathValid() const noexcept
Definition initializeworkspacewizardcontext.h:66
LengthUnit mLengthUnit
Definition initializeworkspacewizardcontext.h:107
void setUserName(const QString &name) noexcept
Definition initializeworkspacewizardcontext.h:87
void setLengthUnit(const LengthUnit &unit) noexcept
Definition initializeworkspacewizardcontext.h:83
void setLibraryNormOrder(const QStringList &order) noexcept
Definition initializeworkspacewizardcontext.h:84
QStringList mLibraryNormOrder
Definition initializeworkspacewizardcontext.h:108
bool mWorkspaceExists
Definition initializeworkspacewizardcontext.h:100
FilePath mWorkspacePath
Definition initializeworkspacewizardcontext.h:98
void setAppLocale(const QString &locale) noexcept
Definition initializeworkspacewizardcontext.h:82
QString mDataDir
Definition initializeworkspacewizardcontext.h:102
std::pair< QString, QString > mUpgradeCopyDirs
Definition initializeworkspacewizardcontext.h:103
void installExampleProjects() const noexcept
Definition initializeworkspacewizardcontext.cpp:109
QString mUserName
Definition initializeworkspacewizardcontext.h:109
const std::pair< QString, QString > & getUpgradeCopyDirs() const noexcept
Definition initializeworkspacewizardcontext.h:69
InitializeWorkspaceWizardContext(const InitializeWorkspaceWizardContext &other)=delete
void setWorkspacePath(const FilePath &fp)
Definition initializeworkspacewizardcontext.cpp:72
Definition occmodel.cpp:76
Definition uuid.h:186