ui: vs plugin integration
Reworked vs solution based project setup to utilize new CDB feature
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "QtTcpWrapper.h"
|
||||
#include "qdatastream.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
@@ -100,12 +101,32 @@ void QtTcpWrapper::acceptConnection()
|
||||
|
||||
void QtTcpWrapper::startRead()
|
||||
{
|
||||
char buffer[1024] = { 0 };
|
||||
QByteArray byteArray;
|
||||
while (m_tcpClient->atEnd() == false)
|
||||
{
|
||||
QByteArray data = m_tcpClient->read(128);
|
||||
byteArray += data;
|
||||
}
|
||||
|
||||
/*QDataStream stream(&byteArray, QIODevice::ReadOnly);
|
||||
QString string;
|
||||
stream >> string;*/
|
||||
|
||||
QString string = QString::fromUtf8(byteArray);
|
||||
|
||||
if (m_readCallback != NULL)
|
||||
{
|
||||
std::string message = string.toStdString();
|
||||
m_readCallback(message);
|
||||
}
|
||||
|
||||
/*char buffer[1024] = { 0 };
|
||||
m_tcpClient->read(buffer, m_tcpClient->bytesAvailable());
|
||||
|
||||
m_tcpClient->close();
|
||||
|
||||
if (m_readCallback != NULL)
|
||||
{
|
||||
m_readCallback(buffer);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
QtMainView::QtMainView()
|
||||
: m_editProjectFunctor(std::bind(&QtMainView::doEditProject, this))
|
||||
, m_createNewProjectFromSolutionFunctor(std::bind(&QtMainView::doCreateNewProjectFromSolution, this, std::placeholders::_1, std::placeholders::_2))
|
||||
, m_createNewProjectFromCDBFunctor(std::bind(&QtMainView::doCreateNewProjectFromCDB, this, std::placeholders::_1, std::placeholders::_2))
|
||||
, m_showStartScreenFunctor(std::bind(&QtMainView::doShowStartScreen, this))
|
||||
, m_hideStartScreenFunctor(std::bind(&QtMainView::doHideStartScreen, this))
|
||||
, m_setTitleFunctor(std::bind(&QtMainView::doSetTitle, this, std::placeholders::_1))
|
||||
@@ -117,7 +118,14 @@ void QtMainView::handleMessage(MessageProjectNew* message)
|
||||
{
|
||||
if (message->ideId.size() != 0 && message->solutionPath.size() != 0)
|
||||
{
|
||||
m_createNewProjectFromSolutionFunctor(message->ideId, message->solutionPath);
|
||||
if (message->fromCDB() == false)
|
||||
{
|
||||
m_createNewProjectFromSolutionFunctor(message->ideId, message->solutionPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_createNewProjectFromCDBFunctor(message->solutionPath, message->headerPaths);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,6 +144,11 @@ void QtMainView::doCreateNewProjectFromSolution(const std::string& ideId, const
|
||||
m_window->newProjectFromSolution(ideId, solutionPath);
|
||||
}
|
||||
|
||||
void QtMainView::doCreateNewProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths)
|
||||
{
|
||||
m_window->newProjectFromCDB(filePath, headerPaths);
|
||||
}
|
||||
|
||||
void QtMainView::doShowStartScreen()
|
||||
{
|
||||
m_window->showStartScreen();
|
||||
|
||||
@@ -58,6 +58,7 @@ private:
|
||||
|
||||
void doEditProject();
|
||||
void doCreateNewProjectFromSolution(const std::string& ideId, const std::string& solutionPath);
|
||||
void doCreateNewProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths);
|
||||
void doShowStartScreen();
|
||||
void doHideStartScreen();
|
||||
void doSetTitle(const std::string& title);
|
||||
@@ -70,6 +71,7 @@ private:
|
||||
|
||||
QtThreadedFunctor<> m_editProjectFunctor;
|
||||
QtThreadedFunctor<const std::string&, const std::string&> m_createNewProjectFromSolutionFunctor;
|
||||
QtThreadedFunctor<const std::string&, const std::vector<std::string>&> m_createNewProjectFromCDBFunctor;
|
||||
QtThreadedFunctor<> m_showStartScreenFunctor;
|
||||
QtThreadedFunctor<> m_hideStartScreenFunctor;
|
||||
QtThreadedFunctor<const std::string&> m_setTitleFunctor;
|
||||
|
||||
@@ -436,6 +436,12 @@ void QtMainWindow::newProjectFromSolution(const std::string& ideId, const std::s
|
||||
wizzard->newProjectFromSolution(ideId, solutionPath);
|
||||
}
|
||||
|
||||
void QtMainWindow::newProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths)
|
||||
{
|
||||
QtProjectWizzard* wizzard = createWindow<QtProjectWizzard>();
|
||||
wizzard->newProjectFromCDB(filePath, headerPaths);
|
||||
}
|
||||
|
||||
void QtMainWindow::openProject()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "", "Coati Project Files (*.coatiproject)");
|
||||
|
||||
@@ -110,6 +110,7 @@ public slots:
|
||||
|
||||
void newProject();
|
||||
void newProjectFromSolution(const std::string& ideId, const std::string& solutionPath);
|
||||
void newProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths);
|
||||
void openProject();
|
||||
void editProject();
|
||||
|
||||
|
||||
@@ -116,6 +116,26 @@ void QtProjectWizzard::newProjectFromSolution(const std::string& ideId, const st
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzard::newProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths)
|
||||
{
|
||||
FilePath fp(filePath);
|
||||
|
||||
std::vector<FilePath> hp;
|
||||
for (int i = 0; i < headerPaths.size(); i++)
|
||||
{
|
||||
hp.push_back(FilePath(headerPaths[i]));
|
||||
}
|
||||
|
||||
std::shared_ptr<CxxProjectSettings> settings = std::make_shared<CxxProjectSettings>();
|
||||
settings->setLanguage(LanguageType::LANGUAGE_CPP);
|
||||
settings->setProjectName(fp.withoutExtension().fileName());
|
||||
settings->setProjectFileLocation(fp.parentDirectory());
|
||||
settings->setCompilationDatabasePath(fp);
|
||||
settings->setSourcePaths(hp);
|
||||
m_settings = settings;
|
||||
emptyProjectCDBVS();
|
||||
}
|
||||
|
||||
void QtProjectWizzard::refreshProjectFromSolution(const std::string& ideId, const std::string& visualStudioSolutionPath)
|
||||
{
|
||||
if (m_parserManager->canParseSolution(ideId))
|
||||
@@ -323,7 +343,7 @@ void QtProjectWizzard::selectedProjectType(LanguageType languageType, QtProjectW
|
||||
break;
|
||||
|
||||
case QtProjectWizzardContentSelect::PROJECT_MANAGED:
|
||||
{
|
||||
/*{
|
||||
std::string fileEndings = "(";
|
||||
for (unsigned int i = 0; i < m_parserManager->getParserCount(); i++)
|
||||
{
|
||||
@@ -346,7 +366,12 @@ void QtProjectWizzard::selectedProjectType(LanguageType languageType, QtProjectW
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
m_settings = std::make_shared<CxxProjectSettings>();
|
||||
m_settings->setLanguage(languageType);
|
||||
emptyProjectCDBVS();
|
||||
break;
|
||||
|
||||
case QtProjectWizzardContentSelect::PROJECT_CDB:
|
||||
m_settings = std::make_shared<CxxProjectSettings>();
|
||||
@@ -428,6 +453,13 @@ void QtProjectWizzard::frameworkSearchPaths()
|
||||
connect(window, SIGNAL(next()), this, SLOT(showSummary()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::emptyProjectCDBVS()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentDataCDBVS>();
|
||||
|
||||
connect(window, SIGNAL(next()), this, SLOT(headerPathsCDB()));
|
||||
}
|
||||
|
||||
void QtProjectWizzard::emptyProjectCDB()
|
||||
{
|
||||
QtProjectWizzardWindow* window = createWindowWithContent<QtProjectWizzardContentDataCDB>();
|
||||
|
||||
@@ -34,6 +34,7 @@ public slots:
|
||||
void newProject();
|
||||
|
||||
void newProjectFromSolution(const std::string& ideId, const std::string& visualStudioSolutionPath);
|
||||
void newProjectFromCDB(const std::string& filePath, const std::vector<std::string>& headerPaths);
|
||||
void refreshProjectFromSolution(const std::string& ideId, const std::string& visualStudioSolutionPath);
|
||||
|
||||
void editProject(const FilePath& settingsPath);
|
||||
@@ -72,6 +73,8 @@ private slots:
|
||||
void headerSearchPathsDone();
|
||||
void frameworkSearchPaths();
|
||||
|
||||
void emptyProjectCDBVS();
|
||||
|
||||
void emptyProjectCDB();
|
||||
void headerPathsCDB();
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "settings/CxxProjectSettings.h"
|
||||
|
||||
#include "utility/messaging/type/MessageIDECreateCDB.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
QtProjectWizzardContentData::QtProjectWizzardContentData(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window)
|
||||
@@ -257,3 +258,81 @@ bool QtProjectWizzardContentDataCDB::check()
|
||||
void QtProjectWizzardContentDataCDB::refreshClicked()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
QtProjectWizzardContentDataCDBVS::QtProjectWizzardContentDataCDBVS(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window)
|
||||
: QtProjectWizzardContentDataCDB(settings, window)
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentDataCDBVS::populate(QGridLayout* layout, int& row)
|
||||
{
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
row++;
|
||||
}
|
||||
|
||||
QLabel* nameLabel = createFormLabel("Create Compilation Database");
|
||||
layout->addWidget(nameLabel, row, QtProjectWizzardWindow::FRONT_COL);
|
||||
|
||||
addHelpButton("To create a new Compilation Database from a Visual Studio Solution, this Solution has to be open in Visual Studio.\n\
|
||||
Coati will call Visual Studio to open the 'Create Compilation Database' dialog.\
|
||||
Please follow the instructions in Visual Studio to complete the process.\n\
|
||||
Note: Coati's Visual Studio plugin has to be installed. Visual Studio has to be running with an eligible Solution, containing C/C++ projects, loaded.", layout, row);
|
||||
|
||||
QLabel* descriptionLabel = createFormLabel("Call Visual Studio to create a Compilation Database from the loaded Solution.");
|
||||
descriptionLabel->setObjectName("description");
|
||||
descriptionLabel->setAlignment(Qt::AlignmentFlag::AlignLeft);
|
||||
layout->addWidget(descriptionLabel, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
|
||||
QPushButton* button = new QPushButton("Create CDB");
|
||||
button->setObjectName("windowButton");
|
||||
layout->addWidget(button, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
|
||||
QLabel* skipLabel = createFormLabel("*Skip this step if you already have a Compilation Database for your Solution.");
|
||||
skipLabel->setObjectName("description");
|
||||
skipLabel->setAlignment(Qt::AlignmentFlag::AlignLeft);
|
||||
layout->addWidget(skipLabel, row, QtProjectWizzardWindow::BACK_COL);
|
||||
row++;
|
||||
|
||||
|
||||
QFrame* separator = new QFrame();
|
||||
separator->setFrameShape(QFrame::HLine);
|
||||
|
||||
QPalette palette = separator->palette();
|
||||
palette.setColor(QPalette::WindowText, Qt::lightGray);
|
||||
separator->setPalette(palette);
|
||||
|
||||
layout->addWidget(separator, row++, 0, 1, -1);
|
||||
|
||||
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(handleVSCDBClicked()));
|
||||
|
||||
addNameAndLocation(layout, row);
|
||||
|
||||
layout->setRowMinimumHeight(row++, 20);
|
||||
|
||||
QString name = "Compilation Database";
|
||||
QString filter = "JSON Compilation Database (*.json)";
|
||||
addBuildFilePicker(layout, row, name, filter);
|
||||
|
||||
if (!isInForm())
|
||||
{
|
||||
layout->setRowMinimumHeight(row, 15);
|
||||
layout->setRowStretch(row, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentDataCDBVS::refreshClicked()
|
||||
{
|
||||
}
|
||||
|
||||
void QtProjectWizzardContentDataCDBVS::handleVSCDBClicked()
|
||||
{
|
||||
MessageIDECreateCDB().dispatch();
|
||||
}
|
||||
|
||||
@@ -55,4 +55,19 @@ private slots:
|
||||
void refreshClicked();
|
||||
};
|
||||
|
||||
class QtProjectWizzardContentDataCDBVS
|
||||
: public QtProjectWizzardContentDataCDB
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtProjectWizzardContentDataCDBVS(std::shared_ptr<ProjectSettings> settings, QtProjectWizzardWindow* window);
|
||||
|
||||
virtual void populate(QGridLayout* layout, int& row) override;
|
||||
|
||||
private slots:
|
||||
void refreshClicked();
|
||||
void handleVSCDBClicked();
|
||||
};
|
||||
|
||||
#endif // QT_PROJECT_WIZZARD_CONTENT_DATA_H
|
||||
|
||||
@@ -44,7 +44,7 @@ void QtProjectWizzardWindow::populateWindow(QWidget* widget)
|
||||
{
|
||||
QGridLayout* layout = new QGridLayout();
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
|
||||
layout->setColumnStretch(QtProjectWizzardWindow::FRONT_COL, 1);
|
||||
layout->setColumnStretch(QtProjectWizzardWindow::BACK_COL, 3);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user