1 /**
2  * UGENE - Integrated Bioinformatics Tools.
3  * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4  * http://ugene.net
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (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, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  */
21 
22 #ifndef _U2_RESOURCE_SETTINGS_GUI_CONTROLLER_H_
23 #define _U2_RESOURCE_SETTINGS_GUI_CONTROLLER_H_
24 
25 #include <ui_ResourceSettingsWidget.h>
26 
27 #include <QUrl>
28 
29 #include <U2Core/NetworkConfiguration.h>
30 
31 #include <U2Gui/AppSettingsGUI.h>
32 
33 namespace U2 {
34 
35 class ResourceSettingsGUIPageController : public AppSettingsGUIPageController {
36     Q_OBJECT
37 public:
38     ResourceSettingsGUIPageController(QObject *p = nullptr);
39 
40     virtual AppSettingsGUIPageState *getSavedState();
41 
42     virtual void saveState(AppSettingsGUIPageState *s);
43 
44     virtual AppSettingsGUIPageWidget *createWidget(AppSettingsGUIPageState *data);
45 
getHelpPageId()46     const QString &getHelpPageId() const {
47         return helpPageId;
48     };
49 
50 private:
51     static const QString helpPageId;
52 };
53 
54 class ResourceSettingsGUIPageState : public AppSettingsGUIPageState {
55     Q_OBJECT
56 public:
ResourceSettingsGUIPageState()57     ResourceSettingsGUIPageState()
58         : nCpus(0), nThreads(0), maxMem(0) {
59     }
60     int nCpus;
61     int nThreads;
62     int maxMem;
63 };
64 
65 class ResourceSettingsGUIPageWidget : public AppSettingsGUIPageWidget, public Ui_ResourceSettingsWidget {
66     Q_OBJECT
67 public:
68     ResourceSettingsGUIPageWidget(ResourceSettingsGUIPageController *ctrl);
69 
70     virtual void setState(AppSettingsGUIPageState *state);
71 
72     virtual AppSettingsGUIPageState *getState(QString &err) const;
73 
74 private slots:
75     void sl_threadsCountChanged(int n);
76     void sl_cpuCountChanged(int n);
77 };
78 
79 }  // namespace U2
80 
81 #endif
82