LibrePCB Developers Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
projectlibraryupdater.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_PROJECTLIBRARYUPDATER_H
21#define LIBREPCB_EDITOR_PROJECTLIBRARYUPDATER_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
28
29#include <QtCore>
30#include <QtWidgets>
31
32#include <memory>
33
34/*******************************************************************************
35 * Namespace / Forward Declarations
36 ******************************************************************************/
37namespace librepcb {
38
39class TransactionalFileSystem;
40class Workspace;
41class WorkspaceLibraryDb;
42
43namespace editor {
44
45namespace Ui {
46class ProjectLibraryUpdater;
47}
48
49/*******************************************************************************
50 * Class ProjectLibraryUpdater
51 ******************************************************************************/
52
60class ProjectLibraryUpdater : public QDialog {
61 Q_OBJECT
62
63public:
64 typedef std::function<bool(const FilePath&)> CloseCallback;
65
66 explicit ProjectLibraryUpdater(Workspace& ws, const FilePath& project,
67 CloseCallback cb) noexcept;
69
70private slots:
71 void btnUpdateClicked();
72
73signals:
74 void finished(const FilePath& fp);
75
76private:
77 void log(const QString& msg) noexcept;
78 QString prettyPath(const FilePath& fp) const noexcept;
79 template <typename T>
80 void updateElements(std::shared_ptr<TransactionalFileSystem> fs,
81 const QString& type);
82
83private:
87 QScopedPointer<Ui::ProjectLibraryUpdater> mUi;
88};
89
90/*******************************************************************************
91 * End of File
92 ******************************************************************************/
93
94} // namespace editor
95} // namespace librepcb
96
97#endif
This class represents absolute, well-formatted paths to files or directories.
Definition filepath.h:127
The Workspace class represents a workspace with all its data (library, projects, settings,...
Definition workspace.h:54
The ProjectLibraryUpdater class.
Definition projectlibraryupdater.h:60
~ProjectLibraryUpdater()
Definition projectlibraryupdater.cpp:69
const CloseCallback mCloseCallback
Definition projectlibraryupdater.h:86
QScopedPointer< Ui::ProjectLibraryUpdater > mUi
Definition projectlibraryupdater.h:87
void btnUpdateClicked()
Definition projectlibraryupdater.cpp:76
void updateElements(std::shared_ptr< TransactionalFileSystem > fs, const QString &type)
Definition projectlibraryupdater.cpp:169
std::function< bool(const FilePath &)> CloseCallback
Definition projectlibraryupdater.h:64
Workspace & mWorkspace
Definition projectlibraryupdater.h:84
const FilePath mProjectFilePath
Definition projectlibraryupdater.h:85
void finished(const FilePath &fp)
void log(const QString &msg) noexcept
Definition projectlibraryupdater.cpp:158
QString prettyPath(const FilePath &fp) const noexcept
Definition projectlibraryupdater.cpp:164
Definition occmodel.cpp:77