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

Method validateP4user

plugins/perforce/ui/perforceimportmetadatawidget.cpp:130–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130bool PerforceImportMetadataWidget::validateP4user(const QString& projectDir) const
131{
132 QProcess exec;
133 QProcessEnvironment p4execEnvironment;
134 p4execEnvironment.insert(QStringLiteral("P4PORT"), m_ui->p4portEdit->displayText());
135 exec.setWorkingDirectory(projectDir);
136 exec.setProcessEnvironment(p4execEnvironment);
137 exec.start(m_ui->executableLoc->url().toLocalFile(), QStringList{QStringLiteral("workspaces"),
138 QStringLiteral("-u"), m_ui->p4userEdit->text()}
139 );
140 exec.waitForFinished();
141
142 const auto processStdout = QString::fromUtf8(exec.readAllStandardOutput());
143 const auto processStderr = QString::fromUtf8(exec.readAllStandardError());
144
145 // std::cout << "Exited with code: " << exec.exitCode() << std::endl;
146 // std::cout << "Exited with stdout" << processStdout.toStdString() << std::endl;
147 // std::cout << "Exited with stderr" << processStderr.toStdString() << std::endl;
148 if (exec.exitCode() != 0) {
149 if(!processStderr.isEmpty()) {
150 m_ui->errorMsg->setText(processStderr);
151 } else {
152 m_ui->errorMsg->setText(i18n("P4 Client failed with exit code: %1", exec.exitCode()));
153 }
154 return false;
155 }
156 if(!processStdout.isEmpty()) {
157 const auto clientCmdOutput = QStringView{processStdout}.split(QLatin1Char('\n'), Qt::SkipEmptyParts);
158 QStringList clientItems;
159 clientItems.reserve(clientCmdOutput.size());
160 for (const auto clientLine : clientCmdOutput) {
161 const auto wordsInLine = clientLine.split(QLatin1Char(' '));
162 // Client mvo_testkdevinteg 2017/05/22 root C:\P4repo 'Created by mvo. ' -- Line would be expected to look like so
163 clientItems.append(wordsInLine.at(1).toString());
164 }
165 m_ui->p4clientEdit->addItems(clientItems);
166 }
167 return true;
168}
169
170bool PerforceImportMetadataWidget::validateP4port(const QString& projectDir) const
171{

Callers

nothing calls this directly

Calls 15

toLocalFileMethod · 0.80
insertMethod · 0.45
setWorkingDirectoryMethod · 0.45
startMethod · 0.45
urlMethod · 0.45
textMethod · 0.45
isEmptyMethod · 0.45
setTextMethod · 0.45
splitMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected