ui: language standard
Added language standard select functionality to gui and language standard to project settings.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "vld.h"
|
||||
|
||||
//#define DEPLOY
|
||||
// #define DEPLOY
|
||||
|
||||
#ifdef DEPLOY
|
||||
static std::string appSettingsPath = std::string(std::getenv("APPDATA")) + "/../local/Coati Software/Coati/ApplicationSettings.xml";
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "qt/window/QtProjectSetupScreen.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QFileDialog>
|
||||
#include <QFormLayout>
|
||||
#include <QLineEdit>
|
||||
@@ -53,7 +52,6 @@ void QtTextLine::handleButtonPress()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QtProjectSetupScreen::QtProjectSetupScreen(QWidget *parent)
|
||||
: QtSettingsWindow(parent)
|
||||
, m_frameworkPaths(nullptr)
|
||||
@@ -108,6 +106,15 @@ void QtProjectSetupScreen::loadProjectSettings()
|
||||
m_projectName->setText(QString::fromStdString(projSettings->getFilePath().withoutExtension().fileName()));
|
||||
m_projectFileLocation->setText(QString::fromStdString(projSettings->getFilePath().parentDirectory().str()));
|
||||
|
||||
if (projSettings->getLanguage().length() > 0)
|
||||
{
|
||||
m_language->setCurrentText(QString::fromStdString(projSettings->getLanguage()));
|
||||
}
|
||||
if (projSettings->getStandard().length() > 0)
|
||||
{
|
||||
m_cppStandard->setCurrentText(QString::fromStdString(projSettings->getStandard()));
|
||||
}
|
||||
|
||||
m_sourcePaths->setList(projSettings->getSourcePaths());
|
||||
m_includePaths->setList(projSettings->getHeaderSearchPaths());
|
||||
|
||||
@@ -134,9 +141,16 @@ void QtProjectSetupScreen::populateForm(QFormLayout* layout)
|
||||
layout->addRow(locationLabel, m_projectFileLocation);
|
||||
|
||||
QLabel* languageLabel = new QLabel("Language");
|
||||
QComboBox* language = new QComboBox();
|
||||
language->insertItem(0, "C++");
|
||||
layout->addRow(languageLabel, language);
|
||||
m_language = new QComboBox();
|
||||
m_language->insertItem(0, "C++");
|
||||
m_language->insertItem(1, "C");
|
||||
connect(m_language, SIGNAL(currentIndexChanged(int)), this, SLOT(handleSelectionChanged(int)));
|
||||
layout->addRow(languageLabel, m_language);
|
||||
|
||||
m_standardLabel = new QLabel("Standard");
|
||||
m_cppStandard = new QComboBox();
|
||||
m_cppStandard->insertItem(0, "11");
|
||||
layout->addRow(m_standardLabel, m_cppStandard);
|
||||
|
||||
QPushButton* helpButton;
|
||||
|
||||
@@ -197,6 +211,11 @@ void QtProjectSetupScreen::handleUpdateButtonPress()
|
||||
|
||||
projSettings->clear();
|
||||
|
||||
projSettings->setLanguage(m_language->currentText().toStdString());
|
||||
if (m_cppStandard->isVisible())
|
||||
{
|
||||
projSettings->setStandard(m_cppStandard->currentText().toStdString());
|
||||
}
|
||||
projSettings->setSourcePaths(m_sourcePaths->getList());
|
||||
projSettings->setHeaderSearchPaths(m_includePaths->getList());
|
||||
|
||||
@@ -209,6 +228,13 @@ void QtProjectSetupScreen::handleUpdateButtonPress()
|
||||
m_projectFileLocation->getText().toStdString() + "/" + m_projectName->text().toStdString() + ".coatiproject";
|
||||
projSettings->save(projectFile);
|
||||
|
||||
projSettings->setLanguage(m_language->currentText().toStdString());
|
||||
|
||||
if (m_cppStandard->isVisible())
|
||||
{
|
||||
projSettings->setStandard(m_cppStandard->currentText().toStdString());
|
||||
}
|
||||
|
||||
MessageLoadProject(projectFile).dispatch();
|
||||
clear();
|
||||
|
||||
@@ -245,3 +271,17 @@ void QtProjectSetupScreen::handlePreferencesButtonPress()
|
||||
{
|
||||
emit showPreferences();
|
||||
}
|
||||
|
||||
void QtProjectSetupScreen::handleSelectionChanged(int index)
|
||||
{
|
||||
if (index != 0)
|
||||
{
|
||||
m_standardLabel->hide();
|
||||
m_cppStandard->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_standardLabel->show();
|
||||
m_cppStandard->show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef QT_PROJECT_SETUP_SCREEN_H
|
||||
#define QT_PROJECT_SETUP_SCREEN_H
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
|
||||
@@ -56,6 +57,7 @@ protected:
|
||||
private slots:
|
||||
void handleCancelButtonPress();
|
||||
void handleUpdateButtonPress();
|
||||
void handleSelectionChanged(int index);
|
||||
|
||||
void handleSourcePathHelpPress();
|
||||
void handleIncludePathHelpPress();
|
||||
@@ -72,6 +74,11 @@ private:
|
||||
QtDirectoryListBox* m_frameworkPaths;
|
||||
|
||||
QPushButton* m_preferencesButton;
|
||||
|
||||
QComboBox* m_language;
|
||||
QComboBox* m_cppStandard;
|
||||
|
||||
QLabel* m_standardLabel;
|
||||
};
|
||||
|
||||
#endif //QT_PROJECT_SETUP_SCREEN_H
|
||||
|
||||
Reference in New Issue
Block a user