diff options
author | Clinton Stimpson <clinton@elemtech.com> | 2008-12-16 20:00:17 (GMT) |
---|---|---|
committer | Clinton Stimpson <clinton@elemtech.com> | 2008-12-16 20:00:17 (GMT) |
commit | 64b377d7074a4c070384630938c2d317348df165 (patch) | |
tree | 4f9fa3a5e57969aebdf84c0dc81bc63f95f4a0ee /Source | |
parent | 2d842b6798cb51bc8c2006b708c348af8720fca6 (diff) | |
download | CMake-64b377d7074a4c070384630938c2d317348df165.zip CMake-64b377d7074a4c070384630938c2d317348df165.tar.gz CMake-64b377d7074a4c070384630938c2d317348df165.tar.bz2 |
ENH:
For bug #7191.
Improvements to the dialog that sets up the first configure.
Fixing the large size of it by breaking it up into a wizard.
Also incorporated suggestions from bug report.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/QtDialog/CMakeFirstConfigure.cxx | 244 | ||||
-rw-r--r-- | Source/QtDialog/CMakeFirstConfigure.h | 48 | ||||
-rw-r--r-- | Source/QtDialog/CMakeFirstConfigure.ui | 606 | ||||
-rw-r--r-- | Source/QtDialog/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 77 | ||||
-rw-r--r-- | Source/QtDialog/Compilers.h | 21 | ||||
-rw-r--r-- | Source/QtDialog/Compilers.ui | 87 | ||||
-rw-r--r-- | Source/QtDialog/CrossCompiler.ui | 218 | ||||
-rw-r--r-- | Source/QtDialog/FirstConfigure.cxx | 509 | ||||
-rw-r--r-- | Source/QtDialog/FirstConfigure.h | 177 |
10 files changed, 1055 insertions, 942 deletions
diff --git a/Source/QtDialog/CMakeFirstConfigure.cxx b/Source/QtDialog/CMakeFirstConfigure.cxx deleted file mode 100644 index 8e81956..0000000 --- a/Source/QtDialog/CMakeFirstConfigure.cxx +++ /dev/null @@ -1,244 +0,0 @@ - -#include "CMakeFirstConfigure.h" - -#include <QSettings> - -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 2cb6220..0000000 --- a/Source/QtDialog/CMakeFirstConfigure.h +++ /dev/null @@ -1,48 +0,0 @@ - -#ifndef CMakeFirstConfigure_h -#define CMakeFirstConfigure_h - -#include <QDialog> -#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 d5413f3..0000000 --- a/Source/QtDialog/CMakeFirstConfigure.ui +++ /dev/null @@ -1,606 +0,0 @@ -<ui version="4.0" > - <class>CMakeFirstConfigure</class> - <widget class="QDialog" name="CMakeFirstConfigure" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>609</width> - <height>547</height> - </rect> - </property> - <property name="windowTitle" > - <string>First Configure Setup</string> - </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="label" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Minimum" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>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.</string> - </property> - <property name="wordWrap" > - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="0" > - <layout class="QHBoxLayout" > - <item> - <widget class="QComboBox" name="generators" /> - </item> - <item> - <spacer> - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" > - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item row="2" column="0" > - <layout class="QVBoxLayout" > - <item> - <widget class="QRadioButton" name="useDefaults" > - <property name="text" > - <string>Use Defaults</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="compilerSetup" > - <property name="text" > - <string>Compiler Setup</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="crossCompilerSetup" > - <property name="text" > - <string>Cross Compiler Setup</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="3" column="0" > - <widget class="Line" name="line" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item row="4" column="0" > - <widget class="QStackedWidget" name="stackedWidget" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="currentIndex" > - <number>2</number> - </property> - <widget class="QWidget" name="defaultPage" > - <layout class="QGridLayout" > - <property name="leftMargin" > - <number>0</number> - </property> - <property name="topMargin" > - <number>0</number> - </property> - <property name="rightMargin" > - <number>0</number> - </property> - <property name="bottomMargin" > - <number>0</number> - </property> - <item row="0" column="1" > - <widget class="QLabel" name="label_2" > - <property name="text" > - <string>The default compilers will be used.</string> - </property> - <property name="alignment" > - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - <property name="wordWrap" > - <bool>true</bool> - </property> - </widget> - </item> - <item row="1" column="1" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="compilerPage" > - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QGroupBox" name="groupBox_4" > - <property name="title" > - <string>Compilers</string> - </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="label_16" > - <property name="text" > - <string>C</string> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QCMakeFilePathEditor" name="CCompiler" /> - </item> - <item row="0" column="2" > - <widget class="QLabel" name="label_17" > - <property name="text" > - <string>C++</string> - </property> - </widget> - </item> - <item row="0" column="3" > - <widget class="QCMakeFilePathEditor" name="CXXCompiler" /> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="label_18" > - <property name="text" > - <string>Fortran</string> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QCMakeFilePathEditor" name="FortranCompiler" /> - </item> - </layout> - </widget> - </item> - <item row="1" column="0" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" > - <size> - <width>566</width> - <height>71</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="crossCompilerPage" > - <layout class="QGridLayout" > - <property name="leftMargin" > - <number>0</number> - </property> - <property name="topMargin" > - <number>0</number> - </property> - <property name="rightMargin" > - <number>0</number> - </property> - <property name="bottomMargin" > - <number>0</number> - </property> - <item row="1" column="0" > - <widget class="QStackedWidget" name="toolChainStack" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="currentIndex" > - <number>1</number> - </property> - <widget class="QWidget" name="page" > - <layout class="QGridLayout" > - <property name="leftMargin" > - <number>9</number> - </property> - <property name="topMargin" > - <number>9</number> - </property> - <property name="rightMargin" > - <number>9</number> - </property> - <property name="bottomMargin" > - <number>9</number> - </property> - <item row="0" column="1" > - <widget class="QCMakeFilePathEditor" name="toolChainFile" /> - </item> - <item row="1" column="1" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" > - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item row="0" column="0" > - <widget class="QLabel" name="label_5" > - <property name="text" > - <string>Tool Chain File</string> - </property> - <property name="wordWrap" > - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="page_2" > - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QGroupBox" name="groupBox" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title" > - <string>System</string> - </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <layout class="QHBoxLayout" > - <item> - <widget class="QLabel" name="label_6" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Name</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="systemName" /> - </item> - <item> - <widget class="QLabel" name="label_10" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Version</string> - </property> - <property name="wordWrap" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="systemVersion" /> - </item> - <item> - <widget class="QLabel" name="label_11" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Processor</string> - </property> - <property name="wordWrap" > - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="systemProcessor" /> - </item> - </layout> - </item> - </layout> - </widget> - </item> - <item row="1" column="0" > - <widget class="QGroupBox" name="groupBox_3" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title" > - <string>Compilers</string> - </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="label_8" > - <property name="text" > - <string>C</string> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QCMakeFilePathEditor" name="crossCCompiler" /> - </item> - <item row="0" column="2" > - <widget class="QLabel" name="label_7" > - <property name="text" > - <string>C++</string> - </property> - </widget> - </item> - <item row="0" column="3" > - <widget class="QCMakeFilePathEditor" name="crossCXXCompiler" /> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="label_15" > - <property name="text" > - <string>Fortran</string> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QCMakeFilePathEditor" name="crossFortranCompiler" /> - </item> - </layout> - </widget> - </item> - <item row="2" column="0" > - <widget class="QGroupBox" name="groupBox_2" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title" > - <string>Find Program/Library/Include</string> - </property> - <layout class="QGridLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="label_9" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Root</string> - </property> - <property name="wordWrap" > - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QCMakePathEditor" name="crossFindRoot" /> - </item> - <item row="0" column="2" > - <widget class="QLabel" name="label_12" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Program Mode</string> - </property> - </widget> - </item> - <item row="0" column="3" > - <widget class="QComboBox" name="crossProgramMode" > - <item> - <property name="text" > - <string>Find from Root then system</string> - </property> - </item> - <item> - <property name="text" > - <string>Only find from Root</string> - </property> - </item> - <item> - <property name="text" > - <string>Don't find from Root</string> - </property> - </item> - </widget> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="label_13" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Library Mode</string> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QComboBox" name="crossLibraryMode" > - <item> - <property name="text" > - <string>Find from Root then system</string> - </property> - </item> - <item> - <property name="text" > - <string>Only find from Root</string> - </property> - </item> - <item> - <property name="text" > - <string>Don't find from Root</string> - </property> - </item> - </widget> - </item> - <item row="1" column="2" > - <widget class="QLabel" name="label_14" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Include Mode</string> - </property> - </widget> - </item> - <item row="1" column="3" > - <widget class="QComboBox" name="crossIncludeMode" > - <item> - <property name="text" > - <string>Find from Root then system</string> - </property> - </item> - <item> - <property name="text" > - <string>Only find from Root</string> - </property> - </item> - <item> - <property name="text" > - <string>Don't find from Root</string> - </property> - </item> - </widget> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item row="0" column="0" > - <widget class="QCheckBox" name="useToolChainFile" > - <property name="text" > - <string>Use ToolChain File</string> - </property> - <property name="checked" > - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - </item> - <item row="6" column="0" > - <widget class="QDialogButtonBox" name="buttonBox" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons" > - <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - <item row="5" column="0" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Expanding</enum> - </property> - <property name="sizeHint" > - <size> - <width>0</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>QCMakeFilePathEditor</class> - <extends>QLineEdit</extends> - <header>QCMakeWidgets.h</header> - </customwidget> - <customwidget> - <class>QCMakePathEditor</class> - <extends>QLineEdit</extends> - <header>QCMakeWidgets.h</header> - </customwidget> - </customwidgets> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>CMakeFirstConfigure</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel" > - <x>227</x> - <y>284</y> - </hint> - <hint type="destinationlabel" > - <x>157</x> - <y>274</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>CMakeFirstConfigure</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel" > - <x>295</x> - <y>290</y> - </hint> - <hint type="destinationlabel" > - <x>286</x> - <y>274</y> - </hint> - </hints> - </connection> - </connections> -</ui> diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index b74987e..9918d49 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 32e6516..c4047ab 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()) - { - m->insertProperty(QCMakeProperty::FILEPATH, "CMAKE_TOOLCHAIN_FILE", - "Cross Compile ToolChain File", toolchainFile, false); - } - else + QString fortranCompiler = dialog.getFortranCompiler(); + if(!fortranCompiler.isEmpty()) { - 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 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); + 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 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 0000000..e9c90a5 --- /dev/null +++ b/Source/QtDialog/Compilers.h @@ -0,0 +1,21 @@ + + +#ifndef COMPILERS_HPP +#define COMPILERS_HPP + +#include <QWidget> +#include <ui_Compilers.h> + +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 0000000..41f70ac --- /dev/null +++ b/Source/QtDialog/Compilers.ui @@ -0,0 +1,87 @@ +<ui version="4.0" > + <class>Compilers</class> + <widget class="QWidget" name="Compilers" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>506</width> + <height>115</height> + </rect> + </property> + <property name="windowTitle" > + <string>Form</string> + </property> + <layout class="QGridLayout" > + <property name="leftMargin" > + <number>0</number> + </property> + <property name="topMargin" > + <number>0</number> + </property> + <property name="rightMargin" > + <number>0</number> + </property> + <property name="bottomMargin" > + <number>0</number> + </property> + <item row="0" column="0" > + <widget class="QGroupBox" name="groupBox_4" > + <property name="title" > + <string>Compilers</string> + </property> + <layout class="QGridLayout" > + <property name="leftMargin" > + <number>4</number> + </property> + <property name="topMargin" > + <number>4</number> + </property> + <property name="rightMargin" > + <number>4</number> + </property> + <item row="0" column="0" > + <widget class="QLabel" name="label_16" > + <property name="text" > + <string>C</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QCMakeFilePathEditor" name="CCompiler" /> + </item> + <item row="0" column="2" > + <widget class="QLabel" name="label_17" > + <property name="text" > + <string>C++</string> + </property> + </widget> + </item> + <item row="0" column="3" > + <widget class="QCMakeFilePathEditor" name="CXXCompiler" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="label_18" > + <property name="text" > + <string>Fortran</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QCMakeFilePathEditor" name="FortranCompiler" /> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>QCMakeFilePathEditor</class> + <extends>QLineEdit</extends> + <header>QCMakeWidgets.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/Source/QtDialog/CrossCompiler.ui b/Source/QtDialog/CrossCompiler.ui new file mode 100644 index 0000000..71a36b8 --- /dev/null +++ b/Source/QtDialog/CrossCompiler.ui @@ -0,0 +1,218 @@ +<ui version="4.0" > + <class>CrossCompiler</class> + <widget class="QWidget" name="CrossCompiler" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>433</width> + <height>319</height> + </rect> + </property> + <property name="windowTitle" > + <string>CrossCompiler</string> + </property> + <layout class="QGridLayout" > + <item row="0" column="0" > + <widget class="QGroupBox" name="groupBox" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title" > + <string>Target System</string> + </property> + <layout class="QGridLayout" > + <item row="0" column="0" > + <widget class="QLabel" name="label_6" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Operating System</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QCMakeFilePathEditor" name="systemName" /> + </item> + <item row="0" column="2" colspan="2" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="label_10" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Version</string> + </property> + <property name="wordWrap" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="systemVersion" /> + </item> + <item row="1" column="2" > + <widget class="QLabel" name="label_11" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Processor</string> + </property> + <property name="wordWrap" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="1" column="3" > + <widget class="QLineEdit" name="systemProcessor" /> + </item> + </layout> + </widget> + </item> + <item row="2" column="0" > + <widget class="QGroupBox" name="groupBox_2" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title" > + <string>Find Program/Library/Include</string> + </property> + <layout class="QGridLayout" > + <item row="0" column="0" > + <widget class="QLabel" name="label_9" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Target Root</string> + </property> + <property name="wordWrap" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QCMakePathEditor" name="crossFindRoot" /> + </item> + <item row="0" column="2" > + <widget class="QLabel" name="label_12" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Program Mode</string> + </property> + </widget> + </item> + <item row="0" column="3" > + <widget class="QComboBox" name="crossProgramMode" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="label_13" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Library Mode</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QComboBox" name="crossLibraryMode" /> + </item> + <item row="1" column="2" > + <widget class="QLabel" name="label_14" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Include Mode</string> + </property> + </widget> + </item> + <item row="1" column="3" > + <widget class="QComboBox" name="crossIncludeMode" /> + </item> + </layout> + </widget> + </item> + <item row="1" column="0" > + <widget class="Compilers" native="1" name="CrossCompilers" > + <property name="focusPolicy" > + <enum>Qt::TabFocus</enum> + </property> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>QCMakePathEditor</class> + <extends>QLineEdit</extends> + <header>QCMakeWidgets.h</header> + </customwidget> + <customwidget> + <class>Compilers</class> + <extends>QWidget</extends> + <header>Compilers.h</header> + <container>1</container> + </customwidget> + <customwidget> + <class>QCMakeFilePathEditor</class> + <extends>QLineEdit</extends> + <header>QCMakeWidgets.h</header> + </customwidget> + </customwidgets> + <tabstops> + <tabstop>systemVersion</tabstop> + <tabstop>systemProcessor</tabstop> + <tabstop>CrossCompilers</tabstop> + <tabstop>crossFindRoot</tabstop> + <tabstop>crossProgramMode</tabstop> + <tabstop>crossLibraryMode</tabstop> + <tabstop>crossIncludeMode</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx new file mode 100644 index 0000000..f522760 --- /dev/null +++ b/Source/QtDialog/FirstConfigure.cxx @@ -0,0 +1,509 @@ + +#include "FirstConfigure.h" +#include "Compilers.h" + +#include <QSettings> +#include <QRadioButton> +#include <QComboBox> +#include <QVBoxLayout> + + +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 0000000..f4e368b --- /dev/null +++ b/Source/QtDialog/FirstConfigure.h @@ -0,0 +1,177 @@ + +#ifndef FirstConfigure_h +#define FirstConfigure_h + +#include <QWizard> +#include <QWizardPage> +#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 + |