LibrePCB Developers Documentation
Loading...
Searching...
No Matches
desktopintegration.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_DESKTOPINTEGRATION_H
21#define LIBREPCB_EDITOR_DESKTOPINTEGRATION_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34namespace editor {
35
36/*******************************************************************************
37 * Class DesktopIntegration
38 ******************************************************************************/
39
43class DesktopIntegration final {
44 Q_DECLARE_TR_FUNCTIONS(DesktopIntegration)
45
46public:
47 // Types
54 enum class Mode { Install, Uninstall };
55
56 // Constructors / Destructor
58
64 static bool isSupported() noexcept;
65
71 static Status getStatus() noexcept;
72
78 static FilePath getExecutable() noexcept;
79
85 static void install();
86
92 static void uninstall();
93
102 static bool execDialog(Mode mode, QWidget* parent) noexcept;
103
104private:
105 static QHash<FilePath, QByteArray> getFileContentToInstall();
106 static QSet<FilePath> loadInstalledFiles();
107 static void storeInstalledFiles(const QSet<FilePath>& files);
108 static void updateDatabase();
109 static FilePath getDesktopFile() noexcept;
110 static FilePath getConfigFile() noexcept;
111 static FilePath getShareDirectory() noexcept;
112};
113
114/*******************************************************************************
115 * End of File
116 ******************************************************************************/
117
118} // namespace editor
119} // namespace librepcb
120
121#endif
This class represents absolute, well-formatted paths to files or directories.
Definition filepath.h:127
Allow installing/uninstalling LibrePCB to the desktop environment.
Definition desktopintegration.h:43
static void storeInstalledFiles(const QSet< FilePath > &files)
Definition desktopintegration.cpp:236
static FilePath getDesktopFile() noexcept
Definition desktopintegration.cpp:274
static Status getStatus() noexcept
Check which application is currently installed.
Definition desktopintegration.cpp:56
static bool execDialog(Mode mode, QWidget *parent) noexcept
Execute dialog to install or uninstall the desktop integration.
Definition desktopintegration.cpp:120
Mode
Definition desktopintegration.h:54
static FilePath getExecutable() noexcept
Get the path to the executable to be installed.
Definition desktopintegration.cpp:76
static void uninstall()
Uninstall this application from the desktop.
Definition desktopintegration.cpp:103
Status
Definition desktopintegration.h:48
static bool isSupported() noexcept
Check if this feature is available.
Definition desktopintegration.cpp:43
static QSet< FilePath > loadInstalledFiles()
Definition desktopintegration.cpp:222
static FilePath getShareDirectory() noexcept
Definition desktopintegration.cpp:283
static void updateDatabase()
Definition desktopintegration.cpp:252
static QHash< FilePath, QByteArray > getFileContentToInstall()
Definition desktopintegration.cpp:190
static FilePath getConfigFile() noexcept
Definition desktopintegration.cpp:279
static void install()
Install this application to the desktop.
Definition desktopintegration.cpp:85
Definition occmodel.cpp:76