src: applied clang-format
This commit is contained in:
@@ -4,14 +4,13 @@
|
||||
#include <QRegularExpression>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include "ProjectSettings.h"
|
||||
#include "FileSystem.h"
|
||||
#include "ProjectSettings.h"
|
||||
|
||||
QtProjectWizardContentProjectData::QtProjectWizardContentProjectData(
|
||||
std::shared_ptr<ProjectSettings> projectSettings,
|
||||
QtProjectWizardWindow* window,
|
||||
bool disableNameEditing
|
||||
)
|
||||
bool disableNameEditing)
|
||||
: QtProjectWizardContent(window)
|
||||
, m_projectSettings(projectSettings)
|
||||
, m_disableNameEditing(disableNameEditing)
|
||||
@@ -33,7 +32,11 @@ void QtProjectWizardContentProjectData::populate(QGridLayout* layout, int& row)
|
||||
m_projectName->setObjectName("name");
|
||||
m_projectName->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||
m_projectName->setEnabled(!m_disableNameEditing);
|
||||
connect(m_projectName, &QLineEdit::textEdited, this, &QtProjectWizardContentProjectData::onProjectNameEdited);
|
||||
connect(
|
||||
m_projectName,
|
||||
&QLineEdit::textEdited,
|
||||
this,
|
||||
&QtProjectWizardContentProjectData::onProjectNameEdited);
|
||||
|
||||
layout->addWidget(nameLabel, row, QtProjectWizardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_projectName, row, QtProjectWizardWindow::BACK_COL);
|
||||
@@ -47,7 +50,11 @@ void QtProjectWizardContentProjectData::populate(QGridLayout* layout, int& row)
|
||||
|
||||
layout->addWidget(locationLabel, row, QtProjectWizardWindow::FRONT_COL, Qt::AlignRight);
|
||||
layout->addWidget(m_projectFileLocation, row, QtProjectWizardWindow::BACK_COL, Qt::AlignTop);
|
||||
addHelpButton("Sourcetrail Project Location", "The directory the Sourcetrail project file (.srctrlprj) will be saved to.", layout, row);
|
||||
addHelpButton(
|
||||
"Sourcetrail Project Location",
|
||||
"The directory the Sourcetrail project file (.srctrlprj) will be saved to.",
|
||||
layout,
|
||||
row);
|
||||
layout->setRowMinimumHeight(row, 30);
|
||||
row++;
|
||||
|
||||
@@ -61,15 +68,15 @@ void QtProjectWizardContentProjectData::populate(QGridLayout* layout, int& row)
|
||||
void QtProjectWizardContentProjectData::load()
|
||||
{
|
||||
m_projectName->setText(QString::fromStdWString(m_projectSettings->getProjectName()));
|
||||
m_projectFileLocation->setText(QString::fromStdWString(m_projectSettings->getProjectDirectoryPath().wstr()));
|
||||
m_projectFileLocation->setText(
|
||||
QString::fromStdWString(m_projectSettings->getProjectDirectoryPath().wstr()));
|
||||
}
|
||||
|
||||
void QtProjectWizardContentProjectData::save()
|
||||
{
|
||||
m_projectSettings->setProjectFilePath(
|
||||
m_projectName->text().toStdWString(),
|
||||
FilePath(m_projectFileLocation->getText().toStdWString())
|
||||
);
|
||||
FilePath(m_projectFileLocation->getText().toStdWString()));
|
||||
}
|
||||
|
||||
bool QtProjectWizardContentProjectData::check()
|
||||
@@ -85,7 +92,9 @@ bool QtProjectWizardContentProjectData::check()
|
||||
if (!boost::filesystem::portable_file_name(m_projectName->text().toStdString()))
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("The provided project name is not a valid file name. Please adjust the name accordingly.");
|
||||
msgBox.setText(
|
||||
"The provided project name is not a valid file name. Please adjust the name "
|
||||
"accordingly.");
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
@@ -98,24 +107,27 @@ bool QtProjectWizardContentProjectData::check()
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<FilePath> paths = FilePath(m_projectFileLocation->getText().toStdWString()).expandEnvironmentVariables();
|
||||
std::vector<FilePath> paths =
|
||||
FilePath(m_projectFileLocation->getText().toStdWString()).expandEnvironmentVariables();
|
||||
if (paths.size() != 1 || !paths[0].isAbsolute())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("The specified location is invalid. Please enter an absolute directory path.");
|
||||
msgBox.setText(
|
||||
"The specified location is invalid. Please enter an absolute directory path.");
|
||||
msgBox.exec();
|
||||
return false;
|
||||
}
|
||||
else if (!paths[0].exists())
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("The specified location does not exist. Do you want to create the directory?");
|
||||
msgBox.setText(
|
||||
"The specified location does not exist. Do you want to create the directory?");
|
||||
msgBox.addButton("Abort", QMessageBox::ButtonRole::NoRole);
|
||||
QPushButton* createButton = msgBox.addButton("Create", QMessageBox::ButtonRole::YesRole);
|
||||
msgBox.setDefaultButton(createButton);
|
||||
msgBox.setIcon(QMessageBox::Icon::Question);
|
||||
int ret = msgBox.exec();
|
||||
if (ret == 1) // QMessageBox::Yes
|
||||
if (ret == 1) // QMessageBox::Yes
|
||||
{
|
||||
FileSystem::createDirectory(paths[0]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user