source: calamares/trunk/fuentes/src/libcalamaresui/viewpages/PythonQtUtilsWrapper.h @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 2.6 KB
Line 
1/* === This file is part of Calamares - <https://github.com/calamares> ===
2 *
3 *   Copyright 2016, Teo Mrnjavac <teo@kde.org>
4 *
5 *   Calamares is free software: you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation, either version 3 of the License, or
8 *   (at your option) any later version.
9 *
10 *   Calamares is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *   GNU General Public License for more details.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with Calamares. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef PYTHONQTUTILSWRAPPER_H
20#define PYTHONQTUTILSWRAPPER_H
21
22#include <PythonQtObjectPtr.h>
23
24#include <QObject>
25
26
27/**
28 * @brief The Utils class wraps around functions from CalamaresUtils to make them
29 * available in the PythonQt interface.
30 */
31class Utils : public QObject
32{
33    Q_OBJECT
34public:
35    explicit Utils( QObject* parent = nullptr );
36    virtual ~Utils() {}
37
38public slots:
39    void debug( const QString& s ) const;
40
41    int mount( const QString& device_path,
42               const QString& mount_point,
43               const QString& filesystem_name,
44               const QString& options ) const;
45
46    int target_env_call( const QString& command,
47                         const QString& stdin = QString(),
48                         int timeout = 0 ) const;
49
50    int target_env_call( const QStringList& args,
51                         const QString& stdin = QString(),
52                         int timeout = 0 ) const;
53
54    int check_target_env_call( const QString& command,
55                               const QString& stdin = QString(),
56                               int timeout = 0 ) const;
57
58    int check_target_env_call( const QStringList& args,
59                               const QString& stdin = QString(),
60                               int timeout = 0 ) const;
61
62    QString check_target_env_output( const QString& command,
63                                     const QString& stdin = QString(),
64                                     int timeout = 0 ) const;
65
66    QString check_target_env_output( const QStringList& args,
67                                     const QString& stdin = QString(),
68                                     int timeout = 0 ) const;
69
70    QString obscure( const QString& string ) const;
71
72private:
73    inline int _handle_check_target_env_call_error( int ec, const QString& cmd ) const;
74
75    PythonQtObjectPtr m_exceptionCxt;
76};
77
78#endif // PYTHONQTUTILSWRAPPER_H
Note: See TracBrowser for help on using the repository browser.