Q4Wine  2.0
Q4Wine is a Qt GUI for Wine.
wineprefix.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2008-2016 by Alexey S. Malakhov <brezerk@gmail.com> *
3  * *
4  * This program is free software: you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation, either version 3 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16  * *
17  ***************************************************************************/
18 
19 #pragma once
20 
21 #include <stdint.h>
22 #include <memory>
23 #include <string>
24 #include <sstream>
25 #include <iostream>
26 #include <iterator>
27 #include <regex>
28 
29 #include "src/lib/defines.hpp"
30 #include "src/lib/dbobject.hpp"
31 #include "src/lib/wineversion.hpp"
33 
34 namespace q4wine {
35 namespace lib {
36 
37 const std::string DEFAULT_EXEC_TEMPLATE = "%CONSOLE_BIN% %CONSOLE_ARGS% " \
38  "%ENV_BIN% %ENV_ARGS% " \
39  "%SET_NICE% %WINE_BIN% " \
40  "%VIRTUAL_DESKTOP% %PROGRAM_BIN% %PROGRAM_ARGS% 2>&1";
41 
62 class WinePrefix : public DBObject {
63  public:
65  WinePrefix();
97  WinePrefix(std::string name,
98  std::string path,
99  std::string arch,
100  WineVersion* version,
101  std::string mountPoint = std::string(),
102  std::string virtualDrive = std::string(),
103  std::string execTemplate = DEFAULT_EXEC_TEMPLATE,
104  uintptr_t id = 0);
106  ~WinePrefix();
107 
112  virtual bool save(void);
113 
119  static WinePrefix* getInstance(intptr_t id);
120 
133  std::string getEnvVariables(const WineApplication *wineApp);
134 
142  std::string getExecutionString(const WineApplication* wineApp);
143 
144  void setName(std::string name);
145  void setPath(std::string path);
146  void setArch(std::string arch);
147  void setVersion(WineVersion* version);
148  void setMountPoint(std::string mountPoint);
149  void setVirtualDrive(std::string virtualDevice);
150  void setExecutionTemplate(std::string execTemplate);
151  const std::string getName(void) const;
152  const std::string getPath(void) const;
153  const std::string getArch(void) const;
154  WineVersion* getVersion(void) const;
155  const std::string getMountPoint(void) const;
156  const std::string getVirtualDrive(void) const;
157  const std::string getExecutionTemplate(void) const;
158 
159  private:
161  static const std::string tableName_;
162  std::string name_;
163  std::string path_;
164  std::string arch_;
165  std::shared_ptr<WineVersion> version_;
166  std::string mountPoint_;
167  std::string virtualDrive_;
168  std::string execTemplate_;
169 };
170 
171 } // namespace lib
172 } // namespace q4wine
void setArch(std::string arch)
Definition: wineprefix.cpp:174
const std::string getExecutionTemplate(void) const
Definition: wineprefix.cpp:218
const std::string getVirtualDrive(void) const
Definition: wineprefix.cpp:214
WineVersion * getVersion(void) const
Definition: wineprefix.cpp:206
std::string getEnvVariables(const WineApplication *wineApp)
Definition: wineprefix.cpp:107
Describes an abstract interface of object to q4wine db.
Definition: dbobject.hpp:40
WinePrefix()
Definition: wineprefix.cpp:27
void setExecutionTemplate(std::string execTemplate)
Definition: wineprefix.cpp:190
void setPath(std::string path)
Definition: wineprefix.cpp:170
const std::string getPath(void) const
Definition: wineprefix.cpp:198
void setVirtualDrive(std::string virtualDevice)
Definition: wineprefix.cpp:186
void setMountPoint(std::string mountPoint)
Definition: wineprefix.cpp:182
const std::string DEFAULT_EXEC_TEMPLATE
Definition: wineprefix.hpp:37
Definition: db.cpp:23
static WinePrefix * getInstance(intptr_t id)
Create WinePrefix object from DB by version.id.
Definition: wineprefix.cpp:86
Describes a wine application configuration.
Definition: wineapplication.hpp:60
const std::string getMountPoint(void) const
Definition: wineprefix.cpp:210
const std::string getArch(void) const
Definition: wineprefix.cpp:202
void setVersion(WineVersion *version)
Definition: wineprefix.cpp:178
~WinePrefix()
Definition: wineprefix.cpp:48
const std::string getName(void) const
Definition: wineprefix.cpp:194
std::string getExecutionString(const WineApplication *wineApp)
Definition: wineprefix.cpp:122
Describes a wine version configuration.
Definition: wineversion.hpp:51
Describes a wine prefix configuration.
Definition: wineprefix.hpp:62
void setName(std::string name)
Definition: wineprefix.cpp:166
virtual bool save(void)
Object into DB.
Definition: wineprefix.cpp:52