2018-03-10 18:45:06 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2018 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "cmakespecificsettingspage.h"
|
2020-01-10 13:05:44 +01:00
|
|
|
#include "cmakespecificsettings.h"
|
|
|
|
|
#include "ui_cmakespecificsettingspage.h"
|
2018-03-22 14:53:53 +01:00
|
|
|
|
2018-03-10 18:45:06 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2018-03-22 14:53:53 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2018-03-10 18:45:06 +01:00
|
|
|
|
|
|
|
|
namespace CMakeProjectManager {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2020-01-10 13:05:44 +01:00
|
|
|
class CMakeSpecificSettingWidget final : public Core::IOptionsPageWidget
|
|
|
|
|
{
|
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeSpecificSettingWidget)
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit CMakeSpecificSettingWidget(CMakeSpecificSettings *settings);
|
|
|
|
|
|
|
|
|
|
void apply() final;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Ui::CMakeSpecificSettingForm m_ui;
|
|
|
|
|
CMakeSpecificSettings *m_settings;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CMakeSpecificSettingWidget::CMakeSpecificSettingWidget(CMakeSpecificSettings *settings)
|
|
|
|
|
: m_settings(settings)
|
2018-03-10 18:45:06 +01:00
|
|
|
{
|
|
|
|
|
m_ui.setupUi(this);
|
|
|
|
|
m_ui.newFileAddedCopyToCpliSettingGroup->setId(m_ui.alwaysAskRadio,
|
|
|
|
|
AfterAddFileAction::ASK_USER);
|
|
|
|
|
m_ui.newFileAddedCopyToCpliSettingGroup->setId(m_ui.neverCopyRadio,
|
|
|
|
|
AfterAddFileAction::NEVER_COPY_FILE_PATH);
|
|
|
|
|
m_ui.newFileAddedCopyToCpliSettingGroup->setId(m_ui.alwaysCopyRadio,
|
|
|
|
|
AfterAddFileAction::COPY_FILE_PATH);
|
|
|
|
|
|
2020-01-10 13:05:44 +01:00
|
|
|
const AfterAddFileAction mode = settings->afterAddFileSetting();
|
2018-03-10 18:45:06 +01:00
|
|
|
switch (mode) {
|
2020-01-10 13:05:44 +01:00
|
|
|
case ASK_USER:
|
2018-03-10 18:45:06 +01:00
|
|
|
m_ui.alwaysAskRadio->setChecked(true);
|
|
|
|
|
break;
|
2020-01-10 13:05:44 +01:00
|
|
|
case COPY_FILE_PATH:
|
2018-03-10 18:45:06 +01:00
|
|
|
m_ui.alwaysCopyRadio->setChecked(true);
|
|
|
|
|
break;
|
2020-01-10 13:05:44 +01:00
|
|
|
case NEVER_COPY_FILE_PATH:
|
2018-03-10 18:45:06 +01:00
|
|
|
m_ui.neverCopyRadio->setChecked(true);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-10 13:05:44 +01:00
|
|
|
void CMakeSpecificSettingWidget::apply()
|
2018-03-10 18:45:06 +01:00
|
|
|
{
|
2020-01-10 13:05:44 +01:00
|
|
|
int popupSetting = m_ui.newFileAddedCopyToCpliSettingGroup->checkedId();
|
|
|
|
|
m_settings->setAfterAddFileSetting(popupSetting == -1 ? AfterAddFileAction::ASK_USER
|
|
|
|
|
: static_cast<AfterAddFileAction>(popupSetting));
|
2018-03-10 18:45:06 +01:00
|
|
|
m_settings->toSettings(Core::ICore::settings());
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-10 13:05:44 +01:00
|
|
|
// CMakeSpecificSettingsPage
|
|
|
|
|
|
|
|
|
|
CMakeSpecificSettingsPage::CMakeSpecificSettingsPage(CMakeSpecificSettings *settings)
|
2018-03-23 13:55:16 +03:00
|
|
|
{
|
2020-01-10 13:05:44 +01:00
|
|
|
setId("CMakeSpecificSettings");
|
|
|
|
|
setDisplayName(CMakeSpecificSettingWidget::tr("CMake"));
|
|
|
|
|
setCategory(ProjectExplorer::Constants::BUILD_AND_RUN_SETTINGS_CATEGORY);
|
|
|
|
|
setWidgetCreator([settings] { return new CMakeSpecificSettingWidget(settings); });
|
2018-03-23 13:55:16 +03:00
|
|
|
}
|
|
|
|
|
|
2018-03-16 12:53:33 +01:00
|
|
|
} // Internal
|
|
|
|
|
} // CMakeProjectManager
|