1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of Qt Creator.
7 **
8 ** Commercial License Usage
9 ** Licensees holding valid commercial Qt licenses may use this file in
10 ** accordance with the commercial license agreement provided with the
11 ** Software or, alternatively, in accordance with the terms contained in
12 ** a written agreement between you and The Qt Company. For licensing terms
13 ** and conditions see https://www.qt.io/terms-conditions. For further
14 ** information use the contact form at https://www.qt.io/contact-us.
15 **
16 ** GNU General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU
18 ** General Public License version 3 as published by the Free Software
19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
20 ** included in the packaging of this file. Please review the following
21 ** information to ensure the GNU General Public License requirements will
22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
23 **
24 ****************************************************************************/
25 
26 #pragma once
27 
28 #include "projectexplorerconstants.h"
29 
30 #include <coreplugin/coreconstants.h>
31 #include <utils/hostosinfo.h>
32 
33 #include <QUuid>
34 
35 namespace ProjectExplorer {
36 namespace Internal {
37 
38 enum class TerminalMode { On, Off, Smart };
39 enum class AppOutputPaneMode { FlashOnOutput, PopupOnOutput, PopupOnFirstOutput };
40 enum class BuildBeforeRunMode { Off, WholeProject, AppOnly };
41 enum class StopBeforeBuild { None, SameProject, All, SameBuildDir, SameApp };
42 
43 class ProjectExplorerSettings
44 {
45 public:
46     BuildBeforeRunMode buildBeforeDeploy = BuildBeforeRunMode::WholeProject;
47     bool deployBeforeRun = true;
48     bool saveBeforeBuild = false;
49     bool useJom = true;
50     bool autorestoreLastSession = false; // This option is set in the Session Manager!
51     bool prompToStopRunControl = false;
52     bool automaticallyCreateRunConfigurations = true;
53     bool addLibraryPathsToRunEnv = true;
54     bool closeSourceFilesWithProject = true;
55     bool clearIssuesOnRebuild = true;
56     bool abortBuildAllOnError = true;
57     bool lowBuildPriority = false;
58     StopBeforeBuild stopBeforeBuild = Utils::HostOsInfo::isWindowsHost()
59                                           ? StopBeforeBuild::SameProject
60                                           : StopBeforeBuild::None;
61     TerminalMode terminalMode = TerminalMode::Off;
62 
63     // Add a UUid which is used to identify the development environment.
64     // This is used to warn the user when he is trying to open a .user file that was created
65     // somewhere else (which might lead to unexpected results).
66     QUuid environmentId;
67 };
68 
69 inline bool operator==(const ProjectExplorerSettings &p1, const ProjectExplorerSettings &p2)
70 {
71     return p1.buildBeforeDeploy == p2.buildBeforeDeploy
72             && p1.deployBeforeRun == p2.deployBeforeRun
73             && p1.saveBeforeBuild == p2.saveBeforeBuild
74             && p1.useJom == p2.useJom
75             && p1.autorestoreLastSession == p2.autorestoreLastSession
76             && p1.prompToStopRunControl == p2.prompToStopRunControl
77             && p1.automaticallyCreateRunConfigurations == p2.automaticallyCreateRunConfigurations
78             && p1.addLibraryPathsToRunEnv == p2.addLibraryPathsToRunEnv
79             && p1.environmentId == p2.environmentId
80             && p1.stopBeforeBuild == p2.stopBeforeBuild
81             && p1.terminalMode == p2.terminalMode
82             && p1.closeSourceFilesWithProject == p2.closeSourceFilesWithProject
83             && p1.clearIssuesOnRebuild == p2.clearIssuesOnRebuild
84             && p1.abortBuildAllOnError == p2.abortBuildAllOnError
85             && p1.lowBuildPriority == p2.lowBuildPriority;
86 }
87 
88 class AppOutputSettings
89 {
90 public:
91     AppOutputPaneMode runOutputMode = AppOutputPaneMode::PopupOnFirstOutput;
92     AppOutputPaneMode debugOutputMode = AppOutputPaneMode::FlashOnOutput;
93     bool cleanOldOutput = false;
94     bool mergeChannels = false;
95     bool wrapOutput = false;
96     int maxCharCount = Core::Constants::DEFAULT_MAX_CHAR_COUNT;
97 };
98 
99 class CompileOutputSettings
100 {
101 public:
102     bool popUp = false;
103     bool wrapOutput = false;
104     int maxCharCount = Core::Constants::DEFAULT_MAX_CHAR_COUNT;
105 };
106 
107 } // namespace ProjectExplorer
108 } // namespace Internal
109