1 /****************************************************************************
2 **
3 ** Copyright (C) 2008-2010 Andrey Rijov <ANDron142@yandex.ru>
4 ** Copyright (C) 2016      Tobias Gläßer
5 **
6 ** This file is part of AQEMU.
7 **
8 ** This program is free software; you can redistribute it and/or modify
9 ** it under the terms of the GNU General Public License as published by
10 ** the Free Software Foundation; either version 2 of the License.
11 **
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ** GNU General Public License for more details.
16 **
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; if not, write to the Free Software
19 ** Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 ** Boston, MA  02110-1301, USA.
21 **
22 ****************************************************************************/
23 
24 #ifndef UTILS_H
25 #define UTILS_H
26 
27 #include <QString>
28 #include <QList>
29 
30 #include "VM_Devices.h"
31 
32 class Disable_User_Graphic_Warning
33 {
34     public:
35         Disable_User_Graphic_Warning();
36         ~Disable_User_Graphic_Warning();
37 };
38 
39 void AQDebug( const QString &sender, const QString &mes );
40 void AQWarning( const QString &sender, const QString &mes );
41 void AQError( const QString &sender, const QString &mes );
42 
43 void AQGraphic_Warning( const QString &caption, const QString &mes );
44 void AQGraphic_Warning( const QString &sender, const QString &caption, const QString &mes, bool fatal = false );
45 void AQGraphic_Error( const QString &sender, const QString &caption, const QString &mes, bool fatal = false );
46 
47 void AQUse_Log( bool use );
48 void AQUse_Debug_Output( bool use, bool d, bool w, bool e );
49 void AQLog_Path( const QString &path );
50 void AQSave_To_Log( const QString &mes_type, const QString &sender, const QString &mes );
51 
52 bool Create_New_HDD_Image( bool encrypted, const QString &base_image,
53 						   const QString &file_name, const QString &format, VM::Device_Size size, bool verbose );
54 bool Create_New_HDD_Image( const QString &file_name, VM::Device_Size size );
55 bool Format_HDD_Image( const QString &file_name, VM::Disk_Info info );
56 
57 QList<QString> Get_Templates_List();
58 
59 QString Get_FS_Compatible_VM_Name( const QString &name );
60 QString Get_Complete_VM_File_Path( const QString &vm_name );
61 
62 QString Get_TR_Size_Suffix( VM::Device_Size suf );
63 
64 QString Get_Last_Dir_Path( const QString &path );
65 
66 bool It_Host_Device( const QString &path );
67 
68 void Check_AQEMU_Permissions();
69 
70 VM::Emulator_Version String_To_Emulator_Version( const QString &str );
71 QString Emulator_Version_To_String( VM::Emulator_Version ver );
72 
73 bool Update_Emulators_List();
74 const QList<Emulator> &Get_Emulators_List();
75 bool Remove_All_Emulators_Files();
76 const Emulator &Get_Default_Emulator( );
77 const Emulator &Get_Emulator_By_Name( const QString &name );
78 
79 int Get_Random( int min, int max );
80 
81 void Load_Recent_Images_List();
82 const QStringList &Get_CD_Recent_Images_List();
83 void Add_To_Recent_CD_Files( const QString &path );
84 const QStringList &Get_FDD_Recent_Images_List();
85 void Add_To_Recent_FDD_Files( const QString &path );
86 
87 bool Get_Show_Error_Window();
88 void Set_Show_Error_Window( bool show );
89 
90 class QWidget;
91 class QCheckBox;
92 
93 void Checkbox_Dependend_Set_Enabled(QList<QWidget*>& children_to_enable, QCheckBox* checkbox, bool enabled);
94 
95 #endif
96 
97