diff --git a/Source/QtDialog/CMakeFirstConfigure.cxx b/Source/QtDialog/CMakeFirstConfigure.cxx deleted file mode 100644 index 8e81956c3..000000000 --- a/Source/QtDialog/CMakeFirstConfigure.cxx +++ /dev/null @@ -1,244 +0,0 @@ - -#include "CMakeFirstConfigure.h" - -#include - -CMakeFirstConfigure::CMakeFirstConfigure() -{ - this->UI.setupUi(this); - this->UI.useDefaults->setChecked(true); - this->updatePage(); - - this->UI.useToolChainFile->setChecked(true); - this->updateToolChainPage(); - - QObject::connect(this->UI.useDefaults, SIGNAL(toggled(bool)), - this, SLOT(updatePage())); - QObject::connect(this->UI.compilerSetup, SIGNAL(toggled(bool)), - this, SLOT(updatePage())); - QObject::connect(this->UI.crossCompilerSetup, SIGNAL(toggled(bool)), - this, SLOT(updatePage())); - - QObject::connect(this->UI.useToolChainFile, SIGNAL(toggled(bool)), - this, SLOT(updateToolChainPage())); -} - -CMakeFirstConfigure::~CMakeFirstConfigure() -{ -} - -void CMakeFirstConfigure::setGenerators(const QStringList& gens) -{ - this->UI.generators->clear(); - this->UI.generators->addItems(gens); -} - -QString CMakeFirstConfigure::getGenerator() const -{ - return this->UI.generators->currentText(); -} - -void CMakeFirstConfigure::loadFromSettings() -{ - QSettings settings; - settings.beginGroup("Settings/StartPath"); - - // restore generator - QString lastGen = settings.value("LastGenerator").toString(); - int idx = this->UI.generators->findText(lastGen); - if(idx != -1) - { - this->UI.generators->setCurrentIndex(idx); - } - settings.endGroup(); - - // restore compiler setup - settings.beginGroup("Settings/Compiler"); - this->UI.CCompiler->setText(settings.value("CCompiler").toString()); - this->UI.CXXCompiler->setText(settings.value("CXXCompiler").toString()); - this->UI.FortranCompiler->setText(settings.value("FortranCompiler").toString()); - settings.endGroup(); - - // restore cross compiler setup - settings.beginGroup("Settings/CrossCompiler"); - this->UI.crossCCompiler->setText(settings.value("CCompiler").toString()); - this->UI.crossCXXCompiler->setText(settings.value("CXXCompiler").toString()); - this->UI.crossFortranCompiler->setText(settings.value("FortranCompiler").toString()); - this->UI.useToolChainFile->setChecked(settings.value("UseToolChainFile", true).toBool()); - this->UI.toolChainFile->setText(settings.value("ToolChainFile").toString()); - this->UI.systemName->setText(settings.value("SystemName").toString()); - this->UI.systemVersion->setText(settings.value("SystemVersion").toString()); - this->UI.systemProcessor->setText(settings.value("SystemProcessor").toString()); - this->UI.crossFindRoot->setText(settings.value("FindRoot").toString()); - this->UI.crossProgramMode->setCurrentIndex(settings.value("ProgramMode", 0).toInt()); - this->UI.crossLibraryMode->setCurrentIndex(settings.value("LibraryMode", 0).toInt()); - this->UI.crossIncludeMode->setCurrentIndex(settings.value("IncludeMode", 0).toInt()); - settings.endGroup(); -} - -void CMakeFirstConfigure::saveToSettings() -{ - QSettings settings; - settings.beginGroup("Settings/StartPath"); - - // save generator - QString lastGen = this->UI.generators->currentText(); - settings.setValue("LastGenerator", lastGen); - - settings.endGroup(); - - // save compiler setup - settings.beginGroup("Settings/Compiler"); - settings.setValue("CCompiler", this->UI.CCompiler->text()); - settings.setValue("CXXCompiler", this->UI.CXXCompiler->text()); - settings.setValue("FortranCompiler", this->UI.FortranCompiler->text()); - settings.endGroup(); - - // save cross compiler setup - settings.beginGroup("Settings/CrossCompiler"); - settings.setValue("CCompiler", this->UI.crossCCompiler->text()); - settings.setValue("CXXCompiler", this->UI.crossCXXCompiler->text()); - settings.setValue("FortranCompiler", this->UI.crossFortranCompiler->text()); - settings.setValue("UseToolChainFile", this->UI.useToolChainFile->isChecked()); - settings.setValue("ToolChainFile", this->UI.toolChainFile->text()); - settings.setValue("SystemName", this->UI.systemName->text()); - settings.setValue("SystemVersion", this->UI.systemVersion->text()); - settings.setValue("SystemProcessor", this->UI.systemProcessor->text()); - settings.setValue("FindRoot", this->UI.crossFindRoot->text()); - settings.setValue("ProgramMode", this->UI.crossProgramMode->currentIndex()); - settings.setValue("LibraryMode", this->UI.crossLibraryMode->currentIndex()); - settings.setValue("IncludeMode", this->UI.crossIncludeMode->currentIndex()); - settings.endGroup(); -} - -void CMakeFirstConfigure::updatePage() -{ - if(this->UI.useDefaults->isChecked()) - { - this->UI.stackedWidget->setCurrentIndex(0); - } - else if(this->UI.compilerSetup->isChecked()) - { - this->UI.stackedWidget->setCurrentIndex(1); - } - else if(this->UI.crossCompilerSetup->isChecked()) - { - this->UI.stackedWidget->setCurrentIndex(2); - } -} - -void CMakeFirstConfigure::updateToolChainPage() -{ - if(this->UI.useToolChainFile->isChecked()) - { - this->UI.toolChainStack->setCurrentIndex(0); - } - else - { - this->UI.toolChainStack->setCurrentIndex(1); - } -} - -bool CMakeFirstConfigure::defaultSetup() const -{ - return this->UI.useDefaults->isChecked(); -} - -bool CMakeFirstConfigure::compilerSetup() const -{ - return this->UI.compilerSetup->isChecked(); -} - -bool CMakeFirstConfigure::crossCompilerSetup() const -{ - return this->UI.crossCompilerSetup->isChecked(); -} - -QString CMakeFirstConfigure::crossCompilerToolChainFile() const -{ - if(this->UI.useToolChainFile->isChecked()) - { - return this->UI.toolChainFile->text(); - } - return QString(); -} - -QString CMakeFirstConfigure::getSystemName() const -{ - return this->UI.systemName->text(); -} - -QString CMakeFirstConfigure::getCCompiler() const -{ - if(this->compilerSetup()) - { - return this->UI.CCompiler->text(); - } - else if(this->crossCompilerSetup()) - { - return this->UI.crossCCompiler->text(); - } - return QString(); -} - -QString CMakeFirstConfigure::getCXXCompiler() const -{ - if(this->compilerSetup()) - { - return this->UI.CXXCompiler->text(); - } - else if(this->crossCompilerSetup()) - { - return this->UI.crossCXXCompiler->text(); - } - return QString(); -} - -QString CMakeFirstConfigure::getFortranCompiler() const -{ - if(this->compilerSetup()) - { - return this->UI.FortranCompiler->text(); - } - else if(this->crossCompilerSetup()) - { - return this->UI.crossFortranCompiler->text(); - } - return QString(); -} - - -QString CMakeFirstConfigure::getSystemVersion() const -{ - return this->UI.systemVersion->text(); -} - -QString CMakeFirstConfigure::getSystemProcessor() const -{ - return this->UI.systemProcessor->text(); -} - - -QString CMakeFirstConfigure::getCrossRoot() const -{ - return this->UI.crossFindRoot->text(); -} - -static const char* crossModes[3] = {"BOTH", "ONLY", "NEVER" }; - -QString CMakeFirstConfigure::getCrossProgramMode() const -{ - return crossModes[this->UI.crossProgramMode->currentIndex()]; -} - -QString CMakeFirstConfigure::getCrossLibraryMode() const -{ - return crossModes[this->UI.crossLibraryMode->currentIndex()]; -} - -QString CMakeFirstConfigure::getCrossIncludeMode() const -{ - return crossModes[this->UI.crossIncludeMode->currentIndex()]; -} - - diff --git a/Source/QtDialog/CMakeFirstConfigure.h b/Source/QtDialog/CMakeFirstConfigure.h deleted file mode 100644 index 2cb6220c0..000000000 --- a/Source/QtDialog/CMakeFirstConfigure.h +++ /dev/null @@ -1,48 +0,0 @@ - -#ifndef CMakeFirstConfigure_h -#define CMakeFirstConfigure_h - -#include -#include "ui_CMakeFirstConfigure.h" - -class CMakeFirstConfigure : public QDialog -{ - Q_OBJECT -public: - CMakeFirstConfigure(); - ~CMakeFirstConfigure(); - - void setGenerators(const QStringList& gens); - QString getGenerator() const; - - bool defaultSetup() const; - bool compilerSetup() const; - bool crossCompilerSetup() const; - QString crossCompilerToolChainFile() const; - - QString getCCompiler() const; - QString getCXXCompiler() const; - QString getFortranCompiler() const; - - QString getSystemName() const; - QString getSystemVersion() const; - QString getSystemProcessor() const; - - QString getCrossRoot() const; - QString getCrossProgramMode() const; - QString getCrossLibraryMode() const; - QString getCrossIncludeMode() const; - - void loadFromSettings(); - void saveToSettings(); - -protected slots: - void updatePage(); - void updateToolChainPage(); - -protected: - Ui::CMakeFirstConfigure UI; -}; - -#endif // CMakeFirstConfigure_h - diff --git a/Source/QtDialog/CMakeFirstConfigure.ui b/Source/QtDialog/CMakeFirstConfigure.ui deleted file mode 100644 index d5413f393..000000000 --- a/Source/QtDialog/CMakeFirstConfigure.ui +++ /dev/null @@ -1,606 +0,0 @@ - - CMakeFirstConfigure - - - - 0 - 0 - 609 - 547 - - - - First Configure Setup - - - - - - - 0 - 0 - - - - Please select what build system you want CMake to generate files for. You should select the tool that you will use to build the project. - - - true - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - Use Defaults - - - true - - - - - - - Compiler Setup - - - - - - - Cross Compiler Setup - - - - - - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - 2 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - The default compilers will be used. - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - Compilers - - - - - - C - - - - - - - - - - C++ - - - - - - - - - - Fortran - - - - - - - - - - - - - Qt::Vertical - - - - 566 - 71 - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - 1 - - - - - 9 - - - 9 - - - 9 - - - 9 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Tool Chain File - - - true - - - - - - - - - - - - 0 - 0 - - - - System - - - - - - - - - 0 - 0 - - - - Name - - - - - - - - - - - 0 - 0 - - - - Version - - - true - - - - - - - - - - - 0 - 0 - - - - Processor - - - true - - - - - - - - - - - - - - - - 0 - 0 - - - - Compilers - - - - - - C - - - - - - - - - - C++ - - - - - - - - - - Fortran - - - - - - - - - - - - - - 0 - 0 - - - - Find Program/Library/Include - - - - - - - 0 - 0 - - - - Root - - - true - - - - - - - - - - - 0 - 0 - - - - Program Mode - - - - - - - - Find from Root then system - - - - - Only find from Root - - - - - Don't find from Root - - - - - - - - - 0 - 0 - - - - Library Mode - - - - - - - - Find from Root then system - - - - - Only find from Root - - - - - Don't find from Root - - - - - - - - - 0 - 0 - - - - Include Mode - - - - - - - - Find from Root then system - - - - - Only find from Root - - - - - Don't find from Root - - - - - - - - - - - - - - - Use ToolChain File - - - true - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 0 - 20 - - - - - - - - - QCMakeFilePathEditor - QLineEdit -
QCMakeWidgets.h
-
- - QCMakePathEditor - QLineEdit -
QCMakeWidgets.h
-
-
- - - - buttonBox - accepted() - CMakeFirstConfigure - accept() - - - 227 - 284 - - - 157 - 274 - - - - - buttonBox - rejected() - CMakeFirstConfigure - reject() - - - 295 - 290 - - - 286 - 274 - - - - -
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index b74987ef5..9918d490a 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -16,11 +16,11 @@ ELSE(NOT QT4_FOUND) SET(SRCS AddCacheEntry.cxx AddCacheEntry.h - CMakeFirstConfigure.cxx - CMakeFirstConfigure.h CMakeSetup.cxx CMakeSetupDialog.cxx CMakeSetupDialog.h + FirstConfigure.cxx + FirstConfigure.h QCMake.cxx QCMake.h QCMakeCacheView.cxx @@ -31,15 +31,17 @@ ELSE(NOT QT4_FOUND) QMacInstallDialog.h ) QT4_WRAP_UI(UI_SRCS - CMakeFirstConfigure.ui CMakeSetupDialog.ui + Compilers.ui + CrossCompiler.ui AddCacheEntry.ui MacInstallDialog.ui ) QT4_WRAP_CPP(MOC_SRCS AddCacheEntry.h - CMakeFirstConfigure.h + Compilers.h CMakeSetupDialog.h + FirstConfigure.h QCMake.h QCMakeCacheView.h QCMakeWidgets.h diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 32e651670..c4047abca 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -36,7 +36,7 @@ #include "QCMake.h" #include "QCMakeCacheView.h" #include "AddCacheEntry.h" -#include "CMakeFirstConfigure.h" +#include "FirstConfigure.h" QCMakeThread::QCMakeThread(QObject* p) : QThread(p), CMakeInstance(NULL) @@ -552,7 +552,7 @@ void CMakeSetupDialog::setEnabledState(bool enabled) bool CMakeSetupDialog::setupFirstConfigure() { - CMakeFirstConfigure dialog; + FirstConfigure dialog; // initialize dialog and restore saved settings @@ -561,7 +561,7 @@ bool CMakeSetupDialog::setupFirstConfigure() // restore from settings dialog.loadFromSettings(); - + if(dialog.exec() == QDialog::Accepted) { dialog.saveToSettings(); @@ -593,45 +593,42 @@ bool CMakeSetupDialog::setupFirstConfigure() } else if(dialog.crossCompilerSetup()) { - QString toolchainFile = dialog.crossCompilerToolChainFile(); - if(!toolchainFile.isEmpty()) + QString fortranCompiler = dialog.getFortranCompiler(); + if(!fortranCompiler.isEmpty()) { - m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_TOOLCHAIN_FILE", - "Cross Compile ToolChain File", toolchainFile, false); + m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_Fortran_COMPILER", + "Fortran compiler.", fortranCompiler, false); } - else - { - QString fortranCompiler = dialog.getFortranCompiler(); - if(!fortranCompiler.isEmpty()) - { - m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_Fortran_COMPILER", - "Fortran compiler.", fortranCompiler, false); - } - QString mode = dialog.getCrossIncludeMode(); - m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE", - "CMake Find Include Mode", mode, false); - mode = dialog.getCrossLibraryMode(); - m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY", - "CMake Find Library Mode", mode, false); - mode = dialog.getCrossProgramMode(); - m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM", - "CMake Find Program Mode", mode, false); - - QString rootPath = dialog.getCrossRoot(); - m->insertProperty(QCMakeProperty::PATH, "CMAKE_FIND_ROOT_PATH", - "CMake Find Root Path", rootPath, false); + QString mode = dialog.getCrossIncludeMode(); + m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE", + "CMake Find Include Mode", mode, false); + mode = dialog.getCrossLibraryMode(); + m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_LIBRARY", + "CMake Find Library Mode", mode, false); + mode = dialog.getCrossProgramMode(); + m->insertProperty(QCMakeProperty::STRING, "CMAKE_FIND_ROOT_PATH_MODE_PROGRAM", + "CMake Find Program Mode", mode, false); + + QString rootPath = dialog.getCrossRoot(); + m->insertProperty(QCMakeProperty::PATH, "CMAKE_FIND_ROOT_PATH", + "CMake Find Root Path", rootPath, false); - QString systemName = dialog.getSystemName(); - m->insertProperty(QCMakeProperty::STRING, "CMAKE_SYSTEM_NAME", - "CMake System Name", systemName, false); - QString cxxCompiler = dialog.getCXXCompiler(); - m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER", - "CXX compiler.", cxxCompiler, false); - QString cCompiler = dialog.getCCompiler(); - m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER", - "C compiler.", cCompiler, false); - } + QString systemName = dialog.getSystemName(); + m->insertProperty(QCMakeProperty::STRING, "CMAKE_SYSTEM_NAME", + "CMake System Name", systemName, false); + QString cxxCompiler = dialog.getCXXCompiler(); + m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_CXX_COMPILER", + "CXX compiler.", cxxCompiler, false); + QString cCompiler = dialog.getCCompiler(); + m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_C_COMPILER", + "C compiler.", cCompiler, false); + } + else if(dialog.crossCompilerToolChainFile()) + { + QString toolchainFile = dialog.getCrossCompilerToolChainFile(); + m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_TOOLCHAIN_FILE", + "Cross Compile ToolChain File", toolchainFile, false); } return true; } diff --git a/Source/QtDialog/Compilers.h b/Source/QtDialog/Compilers.h new file mode 100644 index 000000000..e9c90a504 --- /dev/null +++ b/Source/QtDialog/Compilers.h @@ -0,0 +1,21 @@ + + +#ifndef COMPILERS_HPP +#define COMPILERS_HPP + +#include +#include + +class Compilers : public QWidget, public Ui::Compilers +{ + Q_OBJECT +public: + Compilers(QWidget* p=NULL) : + QWidget(p) + { + this->setupUi(this); + } +}; + +#endif + diff --git a/Source/QtDialog/Compilers.ui b/Source/QtDialog/Compilers.ui new file mode 100644 index 000000000..41f70acdb --- /dev/null +++ b/Source/QtDialog/Compilers.ui @@ -0,0 +1,87 @@ + + Compilers + + + + 0 + 0 + 506 + 115 + + + + Form + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Compilers + + + + 4 + + + 4 + + + 4 + + + + + C + + + + + + + + + + C++ + + + + + + + + + + Fortran + + + + + + + + + + + + + + QCMakeFilePathEditor + QLineEdit +
QCMakeWidgets.h
+
+
+ + +
diff --git a/Source/QtDialog/CrossCompiler.ui b/Source/QtDialog/CrossCompiler.ui new file mode 100644 index 000000000..71a36b837 --- /dev/null +++ b/Source/QtDialog/CrossCompiler.ui @@ -0,0 +1,218 @@ + + CrossCompiler + + + + 0 + 0 + 433 + 319 + + + + CrossCompiler + + + + + + + 0 + 0 + + + + Target System + + + + + + + 0 + 0 + + + + Operating System + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + Version + + + true + + + + + + + + + + + 0 + 0 + + + + Processor + + + true + + + + + + + + + + + + + + 0 + 0 + + + + Find Program/Library/Include + + + + + + + 0 + 0 + + + + Target Root + + + true + + + + + + + + + + + 0 + 0 + + + + Program Mode + + + + + + + + + + + 0 + 0 + + + + Library Mode + + + + + + + + + + + 0 + 0 + + + + Include Mode + + + + + + + + + + + + + Qt::TabFocus + + + + + + + + QCMakePathEditor + QLineEdit +
QCMakeWidgets.h
+
+ + Compilers + QWidget +
Compilers.h
+ 1 +
+ + QCMakeFilePathEditor + QLineEdit +
QCMakeWidgets.h
+
+
+ + systemVersion + systemProcessor + CrossCompilers + crossFindRoot + crossProgramMode + crossLibraryMode + crossIncludeMode + + + +
diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx new file mode 100644 index 000000000..f522760c0 --- /dev/null +++ b/Source/QtDialog/FirstConfigure.cxx @@ -0,0 +1,509 @@ + +#include "FirstConfigure.h" +#include "Compilers.h" + +#include +#include +#include +#include + + +StartCompilerSetup::StartCompilerSetup(QWidget* p) + : QWizardPage(p) +{ + QVBoxLayout* l = new QVBoxLayout(this); + l->addWidget(new QLabel(tr("Specify the generator for this project"))); + this->GeneratorOptions = new QComboBox(this); + l->addWidget(this->GeneratorOptions); + l->addSpacing(6); + + this->CompilerSetupOptions[0] = new QRadioButton("Use default native compilers", this); + this->CompilerSetupOptions[1] = new QRadioButton("Specify native compilers", this); + this->CompilerSetupOptions[2] = new QRadioButton("Specify toolchain file for cross-compiling", this); + this->CompilerSetupOptions[3] = new QRadioButton("Specify options for cross-compiling", this); + l->addWidget(this->CompilerSetupOptions[0]); + l->addWidget(this->CompilerSetupOptions[1]); + l->addWidget(this->CompilerSetupOptions[2]); + l->addWidget(this->CompilerSetupOptions[3]); + + this->CompilerSetupOptions[0]->setChecked(true); + + QObject::connect(this->CompilerSetupOptions[0], SIGNAL(toggled(bool)), + this, SLOT(onSelectionChanged(bool))); + QObject::connect(this->CompilerSetupOptions[1], SIGNAL(toggled(bool)), + this, SLOT(onSelectionChanged(bool))); + QObject::connect(this->CompilerSetupOptions[2], SIGNAL(toggled(bool)), + this, SLOT(onSelectionChanged(bool))); + QObject::connect(this->CompilerSetupOptions[3], SIGNAL(toggled(bool)), + this, SLOT(onSelectionChanged(bool))); +} + +StartCompilerSetup::~StartCompilerSetup() +{ +} + +void StartCompilerSetup::setGenerators(const QStringList& gens) +{ + this->GeneratorOptions->clear(); + this->GeneratorOptions->addItems(gens); +}; + +void StartCompilerSetup::setCurrentGenerator(const QString& gen) +{ + int idx = this->GeneratorOptions->findText(gen); + if(idx != -1) + { + this->GeneratorOptions->setCurrentIndex(idx); + } +} + +QString StartCompilerSetup::getGenerator() const +{ + return this->GeneratorOptions->currentText(); +}; + +bool StartCompilerSetup::defaultSetup() const +{ + return this->CompilerSetupOptions[0]->isChecked(); +} + +bool StartCompilerSetup::compilerSetup() const +{ + return this->CompilerSetupOptions[1]->isChecked(); +} + +bool StartCompilerSetup::crossCompilerToolChainFile() const +{ + return this->CompilerSetupOptions[2]->isChecked(); +} + +bool StartCompilerSetup::crossCompilerSetup() const +{ + return this->CompilerSetupOptions[3]->isChecked(); +} + +void StartCompilerSetup::onSelectionChanged(bool on) +{ + if(on) + selectionChanged(); +} + +int StartCompilerSetup::nextId() const +{ + if(compilerSetup()) + return NativeSetup; + if(crossCompilerSetup()) + return CrossSetup; + if(crossCompilerToolChainFile()) + return ToolchainSetup; + return -1; +} + +NativeCompilerSetup::NativeCompilerSetup(QWidget* p) + : QWizardPage(p) +{ + QVBoxLayout* l = new QVBoxLayout(this); + QWidget* c = new QWidget(this); + l->addWidget(c); + this->setupUi(c); +} + +NativeCompilerSetup::~NativeCompilerSetup() +{ +} + +QString NativeCompilerSetup::getCCompiler() const +{ + return this->CCompiler->text(); +} + +void NativeCompilerSetup::setCCompiler(const QString& s) +{ + this->CCompiler->setText(s); +} + +QString NativeCompilerSetup::getCXXCompiler() const +{ + return this->CXXCompiler->text(); +} + +void NativeCompilerSetup::setCXXCompiler(const QString& s) +{ + this->CXXCompiler->setText(s); +} + +QString NativeCompilerSetup::getFortranCompiler() const +{ + return this->FortranCompiler->text(); +} + +void NativeCompilerSetup::setFortranCompiler(const QString& s) +{ + this->FortranCompiler->setText(s); +} + + +CrossCompilerSetup::CrossCompilerSetup(QWidget* p) + : QWizardPage(p) +{ + this->setupUi(this); + QWidget::setTabOrder(systemName, systemVersion); + QWidget::setTabOrder(systemVersion, systemProcessor); + QWidget::setTabOrder(systemProcessor, CrossCompilers->CCompiler); + QWidget::setTabOrder(CrossCompilers->CCompiler, CrossCompilers->CXXCompiler); + QWidget::setTabOrder(CrossCompilers->CXXCompiler, CrossCompilers->FortranCompiler); + QWidget::setTabOrder(CrossCompilers->FortranCompiler, crossFindRoot); + QWidget::setTabOrder(crossFindRoot, crossProgramMode); + QWidget::setTabOrder(crossProgramMode, crossLibraryMode); + QWidget::setTabOrder(crossLibraryMode, crossIncludeMode); + + // fill in combo boxes + QStringList modes; + modes << "Search in Target Root, then native system"; + modes << "Search only in Target Root"; + modes << "Search only in native system"; + crossProgramMode->addItems(modes); + crossLibraryMode->addItems(modes); + crossIncludeMode->addItems(modes); + crossProgramMode->setCurrentIndex(2); + crossLibraryMode->setCurrentIndex(1); + crossIncludeMode->setCurrentIndex(1); + + this->registerField("systemName*", this->systemName); +} + +CrossCompilerSetup::~CrossCompilerSetup() +{ +} + +QString CrossCompilerSetup::getCCompiler() const +{ + return this->CrossCompilers->CCompiler->text(); +} + +void CrossCompilerSetup::setCCompiler(const QString& s) +{ + this->CrossCompilers->CCompiler->setText(s); +} + +QString CrossCompilerSetup::getCXXCompiler() const +{ + return this->CrossCompilers->CXXCompiler->text(); +} + +void CrossCompilerSetup::setCXXCompiler(const QString& s) +{ + this->CrossCompilers->CXXCompiler->setText(s); +} + +QString CrossCompilerSetup::getFortranCompiler() const +{ + return this->CrossCompilers->FortranCompiler->text(); +} + +void CrossCompilerSetup::setFortranCompiler(const QString& s) +{ + this->CrossCompilers->FortranCompiler->setText(s); +} + +QString CrossCompilerSetup::getSystem() const +{ + return this->systemName->text(); +} + +void CrossCompilerSetup::setSystem(const QString& t) +{ + this->systemName->setText(t); +} + + +QString CrossCompilerSetup::getVersion() const +{ + return this->systemVersion->text(); +} + +void CrossCompilerSetup::setVersion(const QString& t) +{ + this->systemVersion->setText(t); +} + + +QString CrossCompilerSetup::getProcessor() const +{ + return this->systemProcessor->text(); +} + +void CrossCompilerSetup::setProcessor(const QString& t) +{ + this->systemProcessor->setText(t); +} + +QString CrossCompilerSetup::getFindRoot() const +{ + return this->crossFindRoot->text(); +} + +void CrossCompilerSetup::setFindRoot(const QString& t) +{ + return this->crossFindRoot->setText(t); +} + +int CrossCompilerSetup::getProgramMode() const +{ + return this->crossProgramMode->currentIndex(); +} + +int CrossCompilerSetup::getLibraryMode() const +{ + return this->crossLibraryMode->currentIndex(); +} + +int CrossCompilerSetup::getIncludeMode() const +{ + return this->crossIncludeMode->currentIndex(); +} + +void CrossCompilerSetup::setProgramMode(int m) +{ + this->crossProgramMode->setCurrentIndex(m); +} + +void CrossCompilerSetup::setLibraryMode(int m) +{ + this->crossLibraryMode->setCurrentIndex(m); +} + +void CrossCompilerSetup::setIncludeMode(int m) +{ + this->crossIncludeMode->setCurrentIndex(m); +} + +ToolchainCompilerSetup::ToolchainCompilerSetup(QWidget* p) + : QWizardPage(p) +{ + QVBoxLayout* l = new QVBoxLayout(this); + l->addWidget(new QLabel(tr("Specify the Toolchain file"))); + this->ToolchainFile = new QCMakeFilePathEditor(this); + l->addWidget(this->ToolchainFile); +} + +ToolchainCompilerSetup::~ToolchainCompilerSetup() +{ +} + +QString ToolchainCompilerSetup::toolchainFile() const +{ + return this->ToolchainFile->text(); +} + +void ToolchainCompilerSetup::setToolchainFile(const QString& t) +{ + this->ToolchainFile->setText(t); +} + + + +FirstConfigure::FirstConfigure() +{ + //this->setOption(QWizard::HaveFinishButtonOnEarlyPages, true); + this->mStartCompilerSetupPage = new StartCompilerSetup(this); + this->setPage(Start, this->mStartCompilerSetupPage); + QObject::connect(this->mStartCompilerSetupPage, SIGNAL(selectionChanged()), + this, SLOT(restart())); + + this->mNativeCompilerSetupPage = new NativeCompilerSetup(this); + this->setPage(NativeSetup, this->mNativeCompilerSetupPage); + + this->mCrossCompilerSetupPage = new CrossCompilerSetup(this); + this->setPage(CrossSetup, this->mCrossCompilerSetupPage); + + this->mToolchainCompilerSetupPage = new ToolchainCompilerSetup(this); + this->setPage(ToolchainSetup, this->mToolchainCompilerSetupPage); +} + +FirstConfigure::~FirstConfigure() +{ +} + +void FirstConfigure::setGenerators(const QStringList& gens) +{ + this->mStartCompilerSetupPage->setGenerators(gens); +} + +QString FirstConfigure::getGenerator() const +{ + return this->mStartCompilerSetupPage->getGenerator(); +} + +void FirstConfigure::loadFromSettings() +{ + QSettings settings; + // restore generator + settings.beginGroup("Settings/StartPath"); + QString lastGen = settings.value("LastGenerator").toString(); + this->mStartCompilerSetupPage->setCurrentGenerator(lastGen); + settings.endGroup(); + + // restore compiler setup + settings.beginGroup("Settings/Compiler"); + this->mNativeCompilerSetupPage->setCCompiler(settings.value("CCompiler").toString()); + this->mNativeCompilerSetupPage->setCXXCompiler(settings.value("CXXCompiler").toString()); + this->mNativeCompilerSetupPage->setFortranCompiler(settings.value("FortranCompiler").toString()); + settings.endGroup(); + + // restore cross compiler setup + settings.beginGroup("Settings/CrossCompiler"); + this->mCrossCompilerSetupPage->setCCompiler(settings.value("CCompiler").toString()); + this->mCrossCompilerSetupPage->setCXXCompiler(settings.value("CXXCompiler").toString()); + this->mCrossCompilerSetupPage->setFortranCompiler(settings.value("FortranCompiler").toString()); + this->mToolchainCompilerSetupPage->setToolchainFile(settings.value("ToolChainFile").toString()); + this->mCrossCompilerSetupPage->setSystem(settings.value("SystemName").toString()); + this->mCrossCompilerSetupPage->setVersion(settings.value("SystemVersion").toString()); + this->mCrossCompilerSetupPage->setProcessor(settings.value("SystemProcessor").toString()); + this->mCrossCompilerSetupPage->setFindRoot(settings.value("FindRoot").toString()); + this->mCrossCompilerSetupPage->setProgramMode(settings.value("ProgramMode", 0).toInt()); + this->mCrossCompilerSetupPage->setLibraryMode(settings.value("LibraryMode", 0).toInt()); + this->mCrossCompilerSetupPage->setIncludeMode(settings.value("IncludeMode", 0).toInt()); + settings.endGroup(); +} + +void FirstConfigure::saveToSettings() +{ + QSettings settings; + + // save generator + settings.beginGroup("Settings/StartPath"); + QString lastGen = this->mStartCompilerSetupPage->getGenerator(); + settings.setValue("LastGenerator", lastGen); + settings.endGroup(); + + // save compiler setup + settings.beginGroup("Settings/Compiler"); + settings.setValue("CCompiler", this->mNativeCompilerSetupPage->getCCompiler()); + settings.setValue("CXXCompiler", this->mNativeCompilerSetupPage->getCXXCompiler()); + settings.setValue("FortranCompiler", this->mNativeCompilerSetupPage->getFortranCompiler()); + settings.endGroup(); + + // save cross compiler setup + settings.beginGroup("Settings/CrossCompiler"); + settings.setValue("CCompiler", this->mCrossCompilerSetupPage->getCCompiler()); + settings.setValue("CXXCompiler", this->mCrossCompilerSetupPage->getCXXCompiler()); + settings.setValue("FortranCompiler", this->mCrossCompilerSetupPage->getFortranCompiler()); + settings.setValue("ToolChainFile", this->getCrossCompilerToolChainFile()); + settings.setValue("SystemName", this->mCrossCompilerSetupPage->getSystem()); + settings.setValue("SystemVersion", this->mCrossCompilerSetupPage->getVersion()); + settings.setValue("SystemProcessor", this->mCrossCompilerSetupPage->getProcessor()); + settings.setValue("FindRoot", this->mCrossCompilerSetupPage->getFindRoot()); + settings.setValue("ProgramMode", this->mCrossCompilerSetupPage->getProgramMode()); + settings.setValue("LibraryMode", this->mCrossCompilerSetupPage->getLibraryMode()); + settings.setValue("IncludeMode", this->mCrossCompilerSetupPage->getIncludeMode()); + settings.endGroup(); +} + +bool FirstConfigure::defaultSetup() const +{ + return this->mStartCompilerSetupPage->defaultSetup(); +} + +bool FirstConfigure::compilerSetup() const +{ + return this->mStartCompilerSetupPage->compilerSetup(); +} + +bool FirstConfigure::crossCompilerSetup() const +{ + return this->mStartCompilerSetupPage->crossCompilerSetup(); +} + +bool FirstConfigure::crossCompilerToolChainFile() const +{ + return this->mStartCompilerSetupPage->crossCompilerToolChainFile(); +} + +QString FirstConfigure::getCrossCompilerToolChainFile() const +{ + return this->mToolchainCompilerSetupPage->toolchainFile(); +} + +QString FirstConfigure::getSystemName() const +{ + return this->mCrossCompilerSetupPage->getSystem(); +} + +QString FirstConfigure::getCCompiler() const +{ + if(this->compilerSetup()) + { + return this->mNativeCompilerSetupPage->getCCompiler(); + } + else if(this->crossCompilerSetup()) + { + return this->mCrossCompilerSetupPage->getCCompiler(); + } + return QString(); +} + +QString FirstConfigure::getCXXCompiler() const +{ + if(this->compilerSetup()) + { + return this->mNativeCompilerSetupPage->getCXXCompiler(); + } + else if(this->crossCompilerSetup()) + { + return this->mCrossCompilerSetupPage->getCXXCompiler(); + } + return QString(); +} + +QString FirstConfigure::getFortranCompiler() const +{ + if(this->compilerSetup()) + { + return this->mNativeCompilerSetupPage->getFortranCompiler(); + } + else if(this->crossCompilerSetup()) + { + return this->mCrossCompilerSetupPage->getFortranCompiler(); + } + return QString(); +} + + +QString FirstConfigure::getSystemVersion() const +{ + return this->mCrossCompilerSetupPage->getVersion(); +} + +QString FirstConfigure::getSystemProcessor() const +{ + return this->mCrossCompilerSetupPage->getProcessor(); +} + +QString FirstConfigure::getCrossRoot() const +{ + return this->mCrossCompilerSetupPage->getFindRoot(); +} + +const QString CrossModes[] = +{ + "BOTH", + "ONLY", + "NEVER" +}; + +QString FirstConfigure::getCrossProgramMode() const +{ + return CrossModes[this->mCrossCompilerSetupPage->getProgramMode()]; +} + +QString FirstConfigure::getCrossLibraryMode() const +{ + return CrossModes[this->mCrossCompilerSetupPage->getLibraryMode()]; +} + +QString FirstConfigure::getCrossIncludeMode() const +{ + return CrossModes[this->mCrossCompilerSetupPage->getIncludeMode()]; +} + diff --git a/Source/QtDialog/FirstConfigure.h b/Source/QtDialog/FirstConfigure.h new file mode 100644 index 000000000..f4e368bfc --- /dev/null +++ b/Source/QtDialog/FirstConfigure.h @@ -0,0 +1,177 @@ + +#ifndef FirstConfigure_h +#define FirstConfigure_h + +#include +#include +#include "ui_Compilers.h" +#include "ui_CrossCompiler.h" + +class QRadioButton; +class QComboBox; + +//! the wizard pages we'll use for the first configure of a build +enum FirstConfigurePages +{ + Start, + NativeSetup, + ToolchainSetup, + CrossSetup, + Done +}; + +//! the first page that gives basic options for what compilers setup to choose from +class StartCompilerSetup : public QWizardPage +{ + Q_OBJECT + public: + StartCompilerSetup(QWidget* p); + ~StartCompilerSetup(); + void setGenerators(const QStringList& gens); + void setCurrentGenerator(const QString& gen); + QString getGenerator() const; + + bool defaultSetup() const; + bool compilerSetup() const; + bool crossCompilerSetup() const; + bool crossCompilerToolChainFile() const; + + int nextId() const; + + signals: + void selectionChanged(); + + protected slots: + void onSelectionChanged(bool); + + protected: + QComboBox* GeneratorOptions; + QRadioButton* CompilerSetupOptions[4]; +}; + +//! the page that gives basic options for native compilers +class NativeCompilerSetup : public QWizardPage, protected Ui::Compilers +{ + Q_OBJECT + public: + NativeCompilerSetup(QWidget* p); + ~NativeCompilerSetup(); + + QString getCCompiler() const; + void setCCompiler(const QString&); + + QString getCXXCompiler() const; + void setCXXCompiler(const QString&); + + QString getFortranCompiler() const; + void setFortranCompiler(const QString&); + + int nextId() const { return -1; } +}; + +//! the page that gives options for cross compilers +class CrossCompilerSetup : public QWizardPage, protected Ui::CrossCompiler +{ + Q_OBJECT + public: + CrossCompilerSetup(QWidget* p); + ~CrossCompilerSetup(); + + QString getSystem() const; + void setSystem(const QString&); + + QString getVersion() const; + void setVersion(const QString&); + + QString getProcessor() const; + void setProcessor(const QString&); + + QString getCCompiler() const; + void setCCompiler(const QString&); + + QString getCXXCompiler() const; + void setCXXCompiler(const QString&); + + QString getFortranCompiler() const; + void setFortranCompiler(const QString&); + + QString getFindRoot() const; + void setFindRoot(const QString&); + + enum CrossMode + { + BOTH, + ONLY, + NEVER + }; + + int getProgramMode() const; + void setProgramMode(int); + int getLibraryMode() const; + void setLibraryMode(int); + int getIncludeMode() const; + void setIncludeMode(int); + + int nextId() const { return -1; } +}; + +//! the page that gives options for a toolchain file +class ToolchainCompilerSetup : public QWizardPage +{ + Q_OBJECT + public: + ToolchainCompilerSetup(QWidget* p); + ~ToolchainCompilerSetup(); + + QString toolchainFile() const; + void setToolchainFile(const QString&); + + int nextId() const { return -1; } + + protected: + QCMakeFilePathEditor* ToolchainFile; +}; + +//! the wizard with the pages +class FirstConfigure : public QWizard +{ + Q_OBJECT +public: + FirstConfigure(); + ~FirstConfigure(); + + void setGenerators(const QStringList& gens); + QString getGenerator() const; + + bool defaultSetup() const; + bool compilerSetup() const; + bool crossCompilerSetup() const; + bool crossCompilerToolChainFile() const; + + QString getCCompiler() const; + QString getCXXCompiler() const; + QString getFortranCompiler() const; + + QString getSystemName() const; + QString getSystemVersion() const; + QString getSystemProcessor() const; + QString getCrossRoot() const; + QString getCrossProgramMode() const; + QString getCrossLibraryMode() const; + QString getCrossIncludeMode() const; + + QString getCrossCompilerToolChainFile() const; + + void loadFromSettings(); + void saveToSettings(); + +protected: + StartCompilerSetup* mStartCompilerSetupPage; + NativeCompilerSetup* mNativeCompilerSetupPage; + CrossCompilerSetup* mCrossCompilerSetupPage; + ToolchainCompilerSetup* mToolchainCompilerSetupPage; + +}; + +#endif // FirstConfigure_h +