diff --git a/plugins/Example/example.cpp b/plugins/Example/example.cpp index f2317d0..da59489 100644 --- a/plugins/Example/example.cpp +++ b/plugins/Example/example.cpp @@ -60,18 +60,19 @@ void Example::save(int lang, QString code) } // language: C/C++ | std: c++11, gnu98 etc. -void Example::compile(int lang, QString std) +void Example::compile(int lang, int std) { std::string command; std::string file = std::string(path); if (lang == 0) { // C file.append("file.c"); - command = std::string("gcc ") + file + " --std c11"; //+ std.toStdString(); + command = std::string("gcc ") + file + " --std c" + std::to_string(std); } else { // C++ file.append("file.cpp"); - command = std::string("g++ ") + file + " --std c++11"; //+ std.toStdString(); + command = std::string("g++ ") + file + " --std c++" + std::to_string(std); } + if (system(command.c_str()) == 0) qDebug() << "Compiled succesfully!"; else @@ -107,7 +108,8 @@ void run() } void Example::runAsync(QString qargs) -{ qDebug() << qargs; +{ + qDebug() << qargs; std::string temp = qargs.toStdString(); args.push_back(temp); //qDebug() << "Starting Async"; diff --git a/plugins/Example/example.h b/plugins/Example/example.h index 2eae759..9bab8b8 100644 --- a/plugins/Example/example.h +++ b/plugins/Example/example.h @@ -36,7 +36,7 @@ class Example: public QObject ~Example() = default; Q_INVOKABLE void save(int lang, QString code); - Q_INVOKABLE void compile(int lang, QString std); + Q_INVOKABLE void compile(int lang, int std); //Q_INVOKABLE static void run(); Q_INVOKABLE void runAsync(QString args); Q_INVOKABLE QString getOutput(); diff --git a/po/cide.ikozyris.pot b/po/cide.ikozyris.pot index 0d1c081..de82418 100644 --- a/po/cide.ikozyris.pot +++ b/po/cide.ikozyris.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: cide.ikozyris\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-21 17:47+0000\n" +"POT-Creation-Date: 2023-05-21 19:18+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -45,18 +45,22 @@ msgstr "" msgid "Save" msgstr "" -#: ../qml/Settings.qml:26 +#: ../qml/Settings.qml:28 msgid "Language: " msgstr "" -#: ../qml/Settings.qml:28 +#: ../qml/Settings.qml:30 msgid "C " msgstr "" -#: ../qml/Settings.qml:29 +#: ../qml/Settings.qml:31 msgid "C++ " msgstr "" +#: ../qml/Settings.qml:39 +msgid "Standard version: " +msgstr "" + #: cide.desktop.in.h:1 msgid "C IDE" msgstr "" diff --git a/qml/CodeEditor.qml b/qml/CodeEditor.qml index e8d0394..2123d9f 100644 --- a/qml/CodeEditor.qml +++ b/qml/CodeEditor.qml @@ -33,7 +33,7 @@ Page { iconName: "settings" text: i18n.tr("Compile") onTriggered: { - Example.compile(Options.compiler, Options.standard); + Example.compile(Options.compiler, Options.std); } }, Action { diff --git a/qml/Settings.qml b/qml/Settings.qml index 53ff63c..91e5168 100644 --- a/qml/Settings.qml +++ b/qml/Settings.qml @@ -7,10 +7,11 @@ Page { Label { id: args anchors.top: parent.top - text: "Command line arguments:" + text: "Command line arguments: (Experimental)" } TextField { id: argsText + width: parent.width / 1.5 anchors.top: args.bottom onAccepted: Options.argv = this.text } @@ -22,6 +23,7 @@ Page { } OptionSelector { + id: langSelect anchors.top: argsText.bottom text: i18n.tr("Language: ") model: [ @@ -32,5 +34,43 @@ Page { Options.lang = this.selectedIndex } } - + OptionSelector { + anchors.top: langSelect.bottom + text: i18n.tr("Standard version: ") + model: [ + "89", + "90", + "95", + "99", + "11", + "17"/*, + "20"*/ + ] + selectedIndex: 4 + onSelectedIndexChanged: { + switch (selectedIndex) { + case 0: + Options.std = 89; + break; + case 1: + Options.std = 90; + break; + case 2: + Options.std = 95 + break; + case 3: + Options.std = 99 + break; + case 4: + Options.std = 11 + break; + case 5: + Options.std = 17 + break;/* + case 6: + Options.std = 20 + break;*/ + } + } + } } diff --git a/qml/Singleton.qml b/qml/Singleton.qml index c48bf31..53b57a0 100644 --- a/qml/Singleton.qml +++ b/qml/Singleton.qml @@ -5,5 +5,5 @@ import QtQuick 2.7 Item { property var argv: ""; property int lang: 0; - property var standard: "c++11"; + property int std: 11; } \ No newline at end of file