MCPcopy Create free account
hub / github.com/KDE/kdevelop / CMakeBuildDirChooser

Method CMakeBuildDirChooser

plugins/cmake/cmakebuilddirchooser.cpp:26–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24using namespace KDevelop;
25
26CMakeBuildDirChooser::CMakeBuildDirChooser(QWidget* parent)
27 : QDialog(parent)
28{
29 setWindowTitle(i18nc("@title:window", "Configure a Build Directory - %1", ICore::self()->runtimeController()->currentRuntime()->name()));
30
31 m_buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
32 m_buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
33 connect(m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
34 connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
35
36 auto mainWidget = new QWidget(this);
37 auto mainLayout = new QVBoxLayout;
38 setLayout(mainLayout);
39 mainLayout->addWidget(mainWidget);
40
41 m_chooserUi = new Ui::CMakeBuildDirChooser;
42 m_chooserUi->setupUi(mainWidget);
43 setShowAvailableBuildDirs(false);
44 mainLayout->addWidget(m_buttonBox);
45
46 m_chooserUi->buildFolder->setMode(KFile::Directory|KFile::ExistingOnly);
47 m_chooserUi->installPrefix->setMode(KFile::Directory|KFile::ExistingOnly);
48
49 // configure the extraArguments widget to span the widget width but not
50 // expand the dialog to the width of the longest element in the argument history.
51 m_chooserUi->extraArguments->setMinimumWidth(m_chooserUi->extraArguments->minimumSizeHint().width());
52 m_extraArgumentsHistory = new CMakeExtraArgumentsHistory(m_chooserUi->extraArguments);
53
54 connect(m_chooserUi->buildFolder, &KUrlRequester::textChanged, this, &CMakeBuildDirChooser::updated);
55 connect(m_chooserUi->buildType, &QComboBox::currentTextChanged,
56 this, &CMakeBuildDirChooser::updated);
57 connect(m_chooserUi->extraArguments, &KComboBox::editTextChanged, this, &CMakeBuildDirChooser::updated);
58 connect(m_chooserUi->availableBuildDirs, QOverload<int>::of(&QComboBox::currentIndexChanged),
59 this, &CMakeBuildDirChooser::adoptPreviousBuildDirectory);
60
61 const auto defaultInstallPrefix = ICore::self()->runtimeController()->currentRuntime()->getenv("KDEV_DEFAULT_INSTALL_PREFIX");
62 if (!defaultInstallPrefix.isEmpty()) {
63 m_chooserUi->installPrefix->setUrl(QUrl::fromLocalFile(QFile::decodeName(defaultInstallPrefix)));
64 }
65
66 updated();
67}
68
69CMakeBuildDirChooser::~CMakeBuildDirChooser()
70{

Callers

nothing calls this directly

Calls 11

currentRuntimeMethod · 0.80
runtimeControllerMethod · 0.80
buttonMethod · 0.80
setupUiMethod · 0.80
nameMethod · 0.45
addWidgetMethod · 0.45
setModeMethod · 0.45
minimumSizeHintMethod · 0.45
getenvMethod · 0.45
isEmptyMethod · 0.45
setUrlMethod · 0.45

Tested by

no test coverage detected