Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ikozyris authored May 21, 2023
1 parent ced8880 commit 20c2d53
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 13 deletions.
10 changes: 6 additions & 4 deletions plugins/Example/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion plugins/Example/example.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 8 additions & 4 deletions po/cide.ikozyris.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -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 ""
2 changes: 1 addition & 1 deletion qml/CodeEditor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
44 changes: 42 additions & 2 deletions qml/Settings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -22,6 +23,7 @@ Page {
}

OptionSelector {
id: langSelect
anchors.top: argsText.bottom
text: i18n.tr("Language: ")
model: [
Expand All @@ -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;*/
}
}
}
}
2 changes: 1 addition & 1 deletion qml/Singleton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 20c2d53

Please sign in to comment.