-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dodanie kodów źródłowych aplikacji PLCino pozwalającej na programowanie
układów Arduino za pomocą kodu drabinkowego
- Loading branch information
Showing
26 changed files
with
5,822 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#------------------------------------------------- | ||
# | ||
# Project created by QtCreator 2017-08-02T12:27:50 | ||
# | ||
#------------------------------------------------- | ||
|
||
QT += core gui | ||
QT += serialport | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
|
||
TARGET = PLCino | ||
TEMPLATE = app | ||
|
||
# The following define makes your compiler emit warnings if you use | ||
# any feature of Qt which as been marked as deprecated (the exact warnings | ||
# depend on your compiler). Please consult the documentation of the | ||
# deprecated API in order to know how to port your code away from it. | ||
DEFINES += QT_DEPRECATED_WARNINGS | ||
|
||
# You can also make your code fail to compile if you use deprecated APIs. | ||
# In order to do so, uncomment the following line. | ||
# You can also select to disable deprecated APIs only up to a certain version of Qt. | ||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 | ||
|
||
|
||
SOURCES += \ | ||
main.cpp \ | ||
plcino.cpp \ | ||
elementy_drabinki.cpp \ | ||
uzywane_zmienne.cpp \ | ||
dodawanie_zmiennej.cpp \ | ||
model_uzywane_zmienne.cpp \ | ||
model_drabinka.cpp \ | ||
wybor_portu.cpp \ | ||
edycja_specjalna.cpp | ||
|
||
HEADERS += \ | ||
plcino.h \ | ||
elementy_drabinki.h \ | ||
typy_wyliczeniowe.h \ | ||
uzywane_zmienne.h \ | ||
dodawanie_zmiennej.h \ | ||
model_uzywane_zmienne.h \ | ||
model_drabinka.h \ | ||
wybor_portu.h \ | ||
zmienna_w_arduino.h \ | ||
edycja_specjalna.h \ | ||
elementy_schematu.h | ||
|
||
FORMS += \ | ||
plcino.ui \ | ||
uzywane_zmienne.ui \ | ||
dodawanie_zmiennej.ui \ | ||
wybor_portu.ui | ||
|
||
DISTFILES += \ | ||
C:/Users/Łukasz/Box Sync/Inżynierka/Ikony/dodaj_kolumne.png \ | ||
C:/Users/Łukasz/Box Sync/Inżynierka/Ikony/dodaj_wiersz.png \ | ||
C:/Users/Łukasz/Box Sync/Inżynierka/Ikony/nowa_linia.png \ | ||
C:/Users/Łukasz/Box Sync/Inżynierka/Ikony/rsz_dodaj_wiersz.png \ | ||
C:/Users/Łukasz/Box Sync/Inżynierka/Ikony/usun_kolumne.png \ | ||
C:/Users/Łukasz/Box Sync/Inżynierka/Ikony/usun_linie.png \ | ||
C:/Users/Łukasz/Box Sync/Inżynierka/Ikony/usun_wiersz.png | ||
|
||
RESOURCES += \ | ||
zasoby.qrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#include "dodawanie_zmiennej.h" | ||
#include "ui_dodawanie_zmiennej.h" | ||
#include <QString> | ||
#include <QMessageBox> | ||
|
||
dodawanie_zmiennej::dodawanie_zmiennej(QMap<QString, zmienna_w_arduino> *lista, model_uzywane_zmienne *model, QString nazwa_zmiennej, QString *adres_nazwy_zmiennej_z_modelu_drabinki, QString numer_pinu, quint32 rodzaj_zmiennej, quint32 typ_pinu, QWidget *parent) : | ||
QDialog(parent), | ||
ui(new Ui::dodawanie_zmiennej) | ||
{ | ||
ui->setupUi(this); | ||
lista_uzywanych_zmiennych = lista; | ||
model_temp = model; | ||
ui->nazwa_zmiennej->setText(nazwa_zmiennej); | ||
ui->numer_pinu->setText(numer_pinu); | ||
ui->rodzaj_zmiennej_comboBox->setCurrentIndex(rodzaj_zmiennej); | ||
ui->typ_pinu_comboBox->setCurrentIndex(typ_pinu); | ||
nazwa_wybranej_zmiennej = adres_nazwy_zmiennej_z_modelu_drabinki; | ||
|
||
if(lista_uzywanych_zmiennych->contains(nazwa_zmiennej)) | ||
ui->nazwa_zmiennej->setReadOnly(true); | ||
else | ||
ui->nazwa_zmiennej->setReadOnly(false); | ||
} | ||
|
||
dodawanie_zmiennej::~dodawanie_zmiennej() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void dodawanie_zmiennej::on_buttonBox_accepted() | ||
{ | ||
if(ui->nazwa_zmiennej->text().isEmpty()) { | ||
QMessageBox msgBox; | ||
msgBox.setText("Pole nazwy zmiennej nie może być puste!!!"); | ||
msgBox.setIcon(QMessageBox::Critical); | ||
msgBox.exec(); | ||
} | ||
else if(lista_uzywanych_zmiennych->contains(ui->nazwa_zmiennej->text())) { | ||
if (ui->nazwa_zmiennej->isReadOnly()) { | ||
lista_uzywanych_zmiennych->insert(ui->nazwa_zmiennej->text(), {ui->numer_pinu->text(), ui->rodzaj_zmiennej_comboBox->currentIndex() + 1, ui->typ_pinu_comboBox->currentIndex() + 1}); | ||
QMessageBox msgBox; | ||
msgBox.setText("Dokonano edycji zmiennej"); | ||
msgBox.setIcon(QMessageBox::Information); | ||
msgBox.exec(); | ||
} | ||
else { | ||
QMessageBox msgBox; | ||
msgBox.setText("Istnieje już taka zmienna!!!"); | ||
msgBox.setIcon(QMessageBox::Critical); | ||
msgBox.exec(); | ||
} | ||
} | ||
else { | ||
if(model_temp != NULL) | ||
model_temp->dodaj_zmienna(ui->nazwa_zmiennej->text(), {ui->numer_pinu->text(), ui->rodzaj_zmiennej_comboBox->currentIndex() + 1, ui->typ_pinu_comboBox->currentIndex() + 1}); //index'y dopasowane do wartości z definicji dla danych zmiennych z pliku typy_wyliczeniowe.h | ||
else | ||
lista_uzywanych_zmiennych->insert(ui->nazwa_zmiennej->text(), {ui->numer_pinu->text(), ui->rodzaj_zmiennej_comboBox->currentIndex() + 1, ui->typ_pinu_comboBox->currentIndex() + 1}); //index'y dopasowane do wartości z definicji dla danych zmiennych z pliku typy_wyliczeniowe.h | ||
if (nazwa_wybranej_zmiennej != NULL) { | ||
*nazwa_wybranej_zmiennej = ui->nazwa_zmiennej->text(); | ||
nazwa_wybranej_zmiennej = NULL; | ||
} | ||
ui->nazwa_zmiennej->clear(); | ||
ui->numer_pinu->clear(); | ||
ui->rodzaj_zmiennej_comboBox->setCurrentIndex(0); | ||
ui->typ_pinu_comboBox->setCurrentIndex(0); | ||
this->hide(); | ||
QMessageBox msgBox; | ||
msgBox.setText("Pomyślnie dodano zmienną."); | ||
msgBox.setIcon(QMessageBox::Information); | ||
msgBox.exec(); | ||
} | ||
} | ||
|
||
void dodawanie_zmiennej::on_buttonBox_rejected() | ||
{ | ||
this->hide(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef DODAWANIE_ZMIENNEJ_H | ||
#define DODAWANIE_ZMIENNEJ_H | ||
|
||
#include <QDialog> | ||
#include <QMap> | ||
#include <QString> | ||
#include "model_uzywane_zmienne.h" | ||
#include <zmienna_w_arduino.h> | ||
|
||
namespace Ui { | ||
class dodawanie_zmiennej; | ||
} | ||
|
||
class dodawanie_zmiennej : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit dodawanie_zmiennej(QMap<QString, zmienna_w_arduino> *lista, model_uzywane_zmienne *model, QString nazwa_zmiennej = "", QString *adres_nazwy_zmiennej_z_modelu_drabinki = NULL, QString numer_pinu = "", quint32 rodzaj_zmiennej = 0, quint32 typ_pinu = 0, QWidget *parent = 0); | ||
~dodawanie_zmiennej(); | ||
|
||
private slots: | ||
void on_buttonBox_accepted(); | ||
|
||
void on_buttonBox_rejected(); | ||
|
||
public: | ||
Ui::dodawanie_zmiennej *ui; | ||
private: | ||
QMap<QString, zmienna_w_arduino> *lista_uzywanych_zmiennych; //adres do listy używanych zmiennych w głównej klasie | ||
model_uzywane_zmienne *model_temp; //adres do modelu danych używanego przez listę używanych zmiennych | ||
QString* nazwa_wybranej_zmiennej; | ||
}; | ||
|
||
#endif // DODAWANIE_ZMIENNEJ_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>dodawanie_zmiennej</class> | ||
<widget class="QDialog" name="dodawanie_zmiennej"> | ||
<property name="windowModality"> | ||
<enum>Qt::WindowModal</enum> | ||
</property> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>400</width> | ||
<height>188</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Dodaj nową zmienną</string> | ||
</property> | ||
<property name="modal"> | ||
<bool>false</bool> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="1" column="0"> | ||
<widget class="QDialogButtonBox" name="buttonBox"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="standardButtons"> | ||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="0" column="0"> | ||
<layout class="QGridLayout" name="gridLayout_2"> | ||
<property name="sizeConstraint"> | ||
<enum>QLayout::SetDefaultConstraint</enum> | ||
</property> | ||
<item row="0" column="0"> | ||
<widget class="QLabel" name="label"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="text"> | ||
<string>Podaj nazwę zmiennej:</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="5" column="0"> | ||
<spacer name="verticalSpacer"> | ||
<property name="orientation"> | ||
<enum>Qt::Vertical</enum> | ||
</property> | ||
<property name="sizeHint" stdset="0"> | ||
<size> | ||
<width>20</width> | ||
<height>40</height> | ||
</size> | ||
</property> | ||
</spacer> | ||
</item> | ||
<item row="4" column="0"> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<layout class="QVBoxLayout" name="verticalLayout_2"> | ||
<item> | ||
<widget class="QLabel" name="label_3"> | ||
<property name="text"> | ||
<string>Rodzaj zmiennej:</string> | ||
</property> | ||
<property name="alignment"> | ||
<set>Qt::AlignCenter</set> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QComboBox" name="rodzaj_zmiennej_comboBox"> | ||
<item> | ||
<property name="text"> | ||
<string>Nie dotyczy</string> | ||
</property> | ||
</item> | ||
<item> | ||
<property name="text"> | ||
<string>Dyskretna</string> | ||
</property> | ||
</item> | ||
<item> | ||
<property name="text"> | ||
<string>Analogowa</string> | ||
</property> | ||
</item> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<widget class="QLabel" name="label_4"> | ||
<property name="text"> | ||
<string>Typ pinu:</string> | ||
</property> | ||
<property name="alignment"> | ||
<set>Qt::AlignCenter</set> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QComboBox" name="typ_pinu_comboBox"> | ||
<item> | ||
<property name="text"> | ||
<string>Nie dotyczy</string> | ||
</property> | ||
</item> | ||
<item> | ||
<property name="text"> | ||
<string>Wejście</string> | ||
</property> | ||
</item> | ||
<item> | ||
<property name="text"> | ||
<string>Wyjście</string> | ||
</property> | ||
</item> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</item> | ||
<item row="3" column="0"> | ||
<widget class="QLineEdit" name="numer_pinu"/> | ||
</item> | ||
<item row="2" column="0"> | ||
<widget class="QLabel" name="label_2"> | ||
<property name="sizePolicy"> | ||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> | ||
<horstretch>0</horstretch> | ||
<verstretch>0</verstretch> | ||
</sizepolicy> | ||
</property> | ||
<property name="text"> | ||
<string>Podaj numer pinu:</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item row="1" column="0"> | ||
<widget class="QLineEdit" name="nazwa_zmiennej"> | ||
<property name="readOnly"> | ||
<bool>false</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
<tabstops> | ||
<tabstop>nazwa_zmiennej</tabstop> | ||
<tabstop>numer_pinu</tabstop> | ||
<tabstop>rodzaj_zmiennej_comboBox</tabstop> | ||
<tabstop>typ_pinu_comboBox</tabstop> | ||
</tabstops> | ||
<resources/> | ||
<connections> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>accepted()</signal> | ||
<receiver>dodawanie_zmiennej</receiver> | ||
<slot>accept()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>257</x> | ||
<y>178</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>157</x> | ||
<y>187</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>rejected()</signal> | ||
<receiver>dodawanie_zmiennej</receiver> | ||
<slot>reject()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>325</x> | ||
<y>178</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>286</x> | ||
<y>187</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
</connections> | ||
</ui> |
Oops, something went wrong.