Коммит f9689f65 создал по автору Коул Милена Ричардовна's avatar Коул Милена Ричардовна
Просмотр файлов

remove wasted modes

владелец ffb60994
#include "basemode.h"
#include "ui_basemode.h"
#include "worklogicalmodul.h"
BaseMode::BaseMode(Vench *vench, QWidget *parent) :
WorkLogicalModul(vench, parent),
ui(new Ui::BaseMode)
{
ui->setupUi(this);
LStatusChanged();
ui->listV->clearPropertyFlags();
ui->listV->setSelectionMode(QAbstractItemView::MultiSelection);
ui->listVibr->clearPropertyFlags();
ui->listVibr->setSelectionMode(QAbstractItemView::MultiSelection);
connect(ui->BBell, &QPushButton::pressed, m_vench, &Vench::BPressBip);
connect(ui->BBell, &QPushButton::released, m_vench, &Vench::BReleaseBip);
connect(ui->BLight, &QPushButton::pressed, m_vench, &Vench::BPressLight);
connect(ui->BLight, &QPushButton::released, m_vench, &Vench::BReleaseLight);
/////////////////
connect(ui->BUp, &QPushButton::pressed, m_vench, &Vench::BPressFw);
connect(ui->BUp, &QPushButton::released, m_vench, &Vench::BReleaseFw);
connect(ui->BLeft, &QPushButton::pressed, m_vench, &Vench::BPressLeft);
connect(ui->BLeft, &QPushButton::released, m_vench, &Vench::BReleaseLeft);
connect(ui->BRight, &QPushButton::pressed, m_vench, &Vench::BPressRight);
connect(ui->BRight, &QPushButton::released, m_vench, &Vench::BReleaseRight);
connect(ui->BDown, &QPushButton::pressed, m_vench, &Vench::BPressRv);
connect(ui->BDown, &QPushButton::released, m_vench, &Vench::BReleaseRv);
connect(ui->BStop, &QPushButton::pressed, m_vench, &Vench::BPressStop);
connect(ui->BStop, &QPushButton::released, m_vench, &Vench::BRealeseStop);
connect(ui->BRec, &QPushButton::clicked, this, &BaseMode::RecClicked);
connect(ui->BPlay, &QPushButton::clicked, this, &BaseMode::PlayClicked);
connect(ui->BProgr, &QPushButton::clicked, m_vench, &Vench::ProgrClicked);
connect(ui->BHelp, &QPushButton::clicked, this, &WorkLogicalModul::OpenGuidDoc);
connect(ui->checkDiskr, &QCheckBox::clicked, this, &BaseMode::DiskrChanged);
connect(ui->checkAll, &QCheckBox::clicked, this, &BaseMode::AllDevicesChanged);
connect(ui->checkKumir, &QCheckBox::clicked, this, &BaseMode::KumirChanged);
connect(ui->BUpdate, &QPushButton::clicked, m_vench, &Vench::ObSpActUst);
connect(ui->BWakeUp, &QPushButton::clicked, m_vench, &Vench::SendCommBudil);
connect(ui->BPanIdContr, &QPushButton::clicked, m_vench, &Vench::BPressIzmPANID_KONTR);
connect(ui->BPanId, &QPushButton::clicked, m_vench, &Vench::BPressIzmPANID);
connect(ui->BTemp, &QPushButton::clicked, this, &BaseMode::TempClicked);
connect(ui->BGraph, &QPushButton::clicked, this, &BaseMode::GraphClicked);
connect(ui->BRezult, &QPushButton::clicked, this, &BaseMode::RezultClicked);
ui->BGraph_O->hide();
ui->BGraph_E->hide();
ui->BTemp_E->hide();
ui->BTemp_D->hide();
ui->BGraph_D->hide();
}
BaseMode::~BaseMode()
{
delete ui;
}
void BaseMode::RecClicked()
{
if (fl_rec)
{
ui->BRec->setStyleSheet("");
ui->BRec->setText("Запись");
m_vench->BRealeseRec();
}
else
{
if (!m_vench->BPressRec(ui->listV->count()))
{
ui->BRec->setChecked(false);
return;
}
ui->BRec->setStyleSheet("background: red");
ui->BRec->setText("Стоп");
}
fl_rec = !fl_rec;
}
void BaseMode::PlayClicked()
{
if (fl_play)
{
ui->BPlay->setStyleSheet("");
ui->BPlay->setText("Поехали");
}
else
{
ui->BPlay->setStyleSheet("background: green");
ui->BPlay->setText("Стоп");
}
fl_play = !fl_play;
m_vench->BPressPlay();
}
void BaseMode::DiskrChanged()
{
m_vench->SetDiskrFlag(ui->checkDiskr->isChecked());
}
void BaseMode::AllDevicesChanged()
{
m_vench->SetAllDevicesFlag(ui->checkAll->isChecked());
}
void BaseMode::KumirChanged()
{
m_vench->SetXMLFlag(!ui->checkKumir->isChecked());
}
void BaseMode::TempClicked()
{
m_vench->SetTempFlag(ui->BTemp->isChecked());
m_vench->BPressTemp();
}
void BaseMode::GraphClicked()
{
m_vench->SetGrphFlag(ui->BGraph->isChecked());
m_vench->BPressGrph();
}
void BaseMode::RezultClicked()
{
m_vench->RezultClicked();
m_vench->BPressParam();
}
void BaseMode::LStatusChanged()
{
ui->LStatus->setText(m_vench->AnsStatus());
ui->LStatus->setStyleSheet("background: " + m_vench->AnsStatusColor().name());
}
void BaseMode::RegGrphTextChanged(QString text)
{
ui->LRegGrph->setText(text);
}
#ifndef BASEMODE_H
#define BASEMODE_H
#include <QWidget>
#include "vench.h"
#include "worklogicalmodul.h"
namespace Ui {
class BaseMode;
}
class BaseMode : public WorkLogicalModul
{
Q_OBJECT
public:
explicit BaseMode(Vench *vench, QWidget *parent = nullptr);
~BaseMode();
protected slots:
void RecClicked();
void PlayClicked();
void DiskrChanged();
void AllDevicesChanged();
void KumirChanged();
void TempClicked();
void GraphClicked();
void RezultClicked();
virtual void LStatusChanged();
virtual void RegGrphTextChanged(QString text);
private:
Ui::BaseMode *ui;
bool fl_rec;
bool fl_play;
};
#endif // BASEMODE_H
Это отличие свёрнуто
#include "bluetoothmode.h"
#include "ui_bluetoothmode.h"
#include <QFileInfo>
#include <QDesktopServices>
#include <QCoreApplication>
#include <QUrl>
BluetoothMode::BluetoothMode(Vench *vench, QWidget *parent) :
WorkLogicalModul(vench, parent),
QWidget(parent),
ui(new Ui::BluetoothMode)
{
ui->setupUi(this);
m_vench = vench;
fl_rec = false;
fl_play = false;
LStatusChanged();
connect(m_vench, &Vench::AnsStatusChanged, this, &BluetoothMode::LStatusChanged);
connect(ui->BHelp, &QPushButton::clicked, this, &WorkLogicalModul::OpenGuidDoc);
connect(ui->BHelp, &QPushButton::clicked, this, &BluetoothMode::OpenGuidDoc);
connect(ui->BBell, &QPushButton::clicked, m_vench, &Vench::on_BBip_B_clicked);
connect(ui->BLight, &QPushButton::clicked, m_vench, &Vench::on_BLight_B_clicked);
......@@ -86,6 +93,15 @@ void BluetoothMode::LStatusChanged()
ui->LStatus->setStyleSheet("background: " + m_vench->AnsStatusColor().name());
}
void BluetoothMode::OpenGuidDoc()
{
QString helpFilePath = QCoreApplication::applicationDirPath() + "/umkiguide.pdf";
if (QFileInfo(helpFilePath).exists())
QDesktopServices::openUrl(QUrl(helpFilePath, QUrl::TolerantMode));
else
QDesktopServices::openUrl(QUrl("https://www.umkikit.ru/prog/umkiguide.pdf"));
}
BluetoothMode::~BluetoothMode()
{
delete ui;
......
......@@ -2,14 +2,13 @@
#define BLUETOOTHMODE_H
#include <QWidget>
#include "worklogicalmodul.h"
#include "vench.h"
namespace Ui {
class BluetoothMode;
}
class BluetoothMode : public WorkLogicalModul
class BluetoothMode : public QWidget
{
Q_OBJECT
......@@ -22,12 +21,12 @@ protected slots:
void ChangeVenchXMLFlag();
void RecClicked();
void PlayClicked();
virtual void LStatusChanged();
void OpenGuidDoc();
void LStatusChanged();
private:
Ui::BluetoothMode *ui;
Vench *m_vench;
bool fl_rec;
bool fl_play;
};
......
......@@ -2,9 +2,6 @@
#include "ui_mainwindow.h"
#include "bluetoothmode.h"
#include "zigbeemode.h"
#include "basemode.h"
#include "supermode.h"
MainWindow::MainWindow(QString kat, QString prt, bool isBluetoothMode, int fKon, QString nf, QWidget *parent) :
QMainWindow(parent),
......@@ -17,12 +14,7 @@ MainWindow::MainWindow(QString kat, QString prt, bool isBluetoothMode, int fKon,
setFocusPolicy(Qt::ClickFocus);
m_vench = new Vench(kat, prt, isBluetoothMode, fKon, nf);
if (isBluetoothMode)
ui->centralwidget->layout()->addWidget(new BluetoothMode(m_vench, this));
else
ui->centralwidget->layout()->addWidget(new ZigBeeMode(m_vench, this));
//ui->centralwidget->layout()->addWidget(new SuperMode(m_vench, this));
ui->centralwidget->layout()->addWidget(new BluetoothMode(m_vench, this));
}
MainWindow::~MainWindow()
......
#include "supermode.h"
#include "ui_supermode.h"
SuperMode::SuperMode(Vench *vench, QWidget *parent) :
WorkLogicalModul(vench, parent),
ui(new Ui::SuperMode)
{
ui->setupUi(this);
fl_rec = false;
fl_play = false;
ui->BDopParam->setChecked(true);
DopParamClicked();
LStatusChanged();
ui->listV->clearPropertyFlags();
ui->listV->setSelectionMode(QAbstractItemView::MultiSelection);
ui->list_PANID->clearPropertyFlags();
ui->list_PANID->setSelectionMode(QAbstractItemView::MultiSelection);
ui->listVibr->clearPropertyFlags();
ui->listVibr->setSelectionMode(QAbstractItemView::MultiSelection);
ui->ImpS->setText(QString().setNum(m_vench->speed_car, 10));
ui->BDiscrImp->setText(QString().setNum(m_vench->imp_diskr, 10));
ui->ServerDir->setText(m_vench->ServerDir());
connect(m_vench, &Vench::ServerDirCganged, this, &SuperMode::ServerDirChanged);
connect(ui->BBell, &QPushButton::pressed, m_vench, &Vench::BPressBip);
connect(ui->BBell, &QPushButton::released, m_vench, &Vench::BReleaseBip);
connect(ui->BLight, &QPushButton::pressed, m_vench, &Vench::BPressLight);
connect(ui->BLight, &QPushButton::released, m_vench, &Vench::BReleaseLight);
connect(ui->BUp, &QPushButton::pressed, m_vench, &Vench::BPressFw);
connect(ui->BUp, &QPushButton::released, m_vench, &Vench::BReleaseFw);
connect(ui->BLeft, &QPushButton::pressed, m_vench, &Vench::BPressLeft);
connect(ui->BLeft, &QPushButton::released, m_vench, &Vench::BReleaseLeft);
connect(ui->BRight, &QPushButton::pressed, m_vench, &Vench::BPressRight);
connect(ui->BRight, &QPushButton::released, m_vench, &Vench::BReleaseRight);
connect(ui->BDown, &QPushButton::pressed, m_vench, &Vench::BPressRv);
connect(ui->BDown, &QPushButton::released, m_vench, &Vench::BReleaseRv);
connect(ui->BStop, &QPushButton::pressed, m_vench, &Vench::BPressStop);
connect(ui->BStop, &QPushButton::released, m_vench, &Vench::BRealeseStop);
connect(ui->checkDiskr, &QCheckBox::clicked, this, &SuperMode::DiskrChanged);
connect(m_vench, &Vench::DatChanged, this, &SuperMode::DatChanged);
connect(ui->BUpdate, &QPushButton::clicked, m_vench, &Vench::ObSpActUst);
connect(ui->BDiscrImp, &QPushButton::clicked, m_vench, &Vench::BPressBDiscrImp_Ever);
connect(ui->ZapPanId, &QPushButton::clicked, m_vench, &Vench::BPressZapPANID);
connect(ui->IzmPanId, &QPushButton::clicked, m_vench, &Vench::BPressIzmPANID);
connect(ui->IzmPanIdKONTR, &QPushButton::clicked, m_vench, &Vench::BPressIzmPANID_KONTR);
connect(ui->BDopParam, &QPushButton::clicked, this, &SuperMode::DopParamClicked);
connect(ui->BVibrSp, &QRadioButton::clicked, this, &SuperMode::AllDevicesFlagChanged);
connect(ui->BAll, &QRadioButton::clicked, this, &SuperMode::AllDevicesFlagChanged);
connect(ui->checkUnsleep, &QCheckBox::clicked, this, &SuperMode::UnsleepChanged);
connect(ui->BAntiSleep, &QPushButton::clicked, m_vench, &Vench::SendCommBudil);
connect(ui->BSpeed, &QPushButton::clicked, this, &SuperMode::SpeedClicked);
connect(ui->BRuchnComm, &QPushButton::clicked, this, &SuperMode::RuchnCommClicked);
connect(ui->checkLog, &QCheckBox::clicked, m_vench, &Vench::chLog);
connect(ui->BXML, &QRadioButton::clicked, this, &SuperMode::ChangeVenchXMLFlag);
connect(ui->BKumir, &QRadioButton::clicked, this, &SuperMode::ChangeVenchXMLFlag);
connect(ui->BPokazProgr, &QPushButton::clicked, m_vench, &Vench::ProgramClicked);
connect(ui->BRec, &QPushButton::clicked, this, &SuperMode::RecClicked);
connect(ui->BPlay, &QPushButton::clicked, this, &SuperMode::PlayClicked);
connect(ui->BContinue, &QPushButton::clicked, m_vench, &Vench::BPressProdol);
connect(ui->BLog, &QPushButton::clicked, m_vench, &Vench::BPressLog);
connect(ui->BParam, &QPushButton::clicked, m_vench, &Vench::BPressParam);
connect(ui->BHelp, &QPushButton::clicked, this, &WorkLogicalModul::OpenGuidDoc);
connect(ui->BTemp, &QPushButton::clicked, this, &SuperMode::TempClicked);
connect(ui->BEnerg, &QPushButton::clicked, this, &SuperMode::EnergClicked);
connect(ui->BDim, &QPushButton::clicked, this, &SuperMode::DimClicked);
connect(ui->BBar, &QPushButton::clicked, this, &SuperMode::BarClicked);
connect(ui->BRezult, &QPushButton::clicked, this, &SuperMode::RezultClicked);
connect(ui->BGrph, &QPushButton::clicked, this, &SuperMode::BPressGrph);
connect(ui->BGrphE, &QPushButton::clicked, this, &SuperMode::BPressGrphE);
connect(ui->BGrphO, &QPushButton::clicked, this, &SuperMode::BPressGrphO);
connect(ui->BGrphD, &QPushButton::clicked, this, &SuperMode::BPressGrphD);
connect(ui->BGrphB, &QPushButton::clicked, this, &SuperMode::BPressGrphB);
connect(ui->BGrphVl, &QPushButton::clicked, this, &SuperMode::BPressGrphV);
connect(m_vench, &Vench::LTempChanged, this, &SuperMode::LTempTextChanged);
connect(m_vench, &Vench::LOsvChanged, this, &SuperMode::LOsvTextChanged);
connect(m_vench, &Vench::LEnChanged, this, &SuperMode::LEnTextChanged);
connect(m_vench, &Vench::LDimChanged, this, &SuperMode::LDimTextChanged);
connect(m_vench, &Vench::LBarChanged, this, &SuperMode::LBarTextChanged);
connect(m_vench, &Vench::LVlChanged, this, &SuperMode::LVlTextChanged);
}
SuperMode::~SuperMode()
{
delete ui;
}
void SuperMode::DiskrChanged()
{
m_vench->SetDiskrFlag(ui->checkDiskr->isChecked());
}
void SuperMode::DopParamClicked()
{
if (ui->BDopParam->isChecked())
{
ui->BDopParam->setText("Показать дополнительные параметры \\/ ");
ui->GDopParam->hide();
}
else
{
ui->BDopParam->setText(trUtf8("Скрыть дополнительные параметры /\\ "));
ui->GDopParam->show();
}
}
void SuperMode::AllDevicesFlagChanged()
{
m_vench->SetAllDevicesFlag(ui->BAll->isChecked());
}
void SuperMode::UnsleepChanged()
{
m_vench->SetUnsleepFlag(ui->checkUnsleep);
}
void SuperMode::SpeedClicked()
{
m_vench->SetSpeedCar(ui->ImpS->text().toInt());
}
void SuperMode::RuchnCommClicked()
{
m_vench->RuchnComm(ui->CommTextEdit->text());
}
void SuperMode::ChangeVenchXMLFlag()
{
m_vench->SetXMLFlag(ui->BXML->isChecked());
}
void SuperMode::RecClicked()
{
if (fl_rec)
{
ui->BRec->setStyleSheet("");
ui->BRec->setText("Запись");
m_vench->BRealeseRec();
}
else
{
if (!m_vench->BPressRec(ui->listV->count()))
{
ui->BRec->setChecked(false);
return;
}
ui->BRec->setStyleSheet("background: red");
ui->BRec->setText("Стоп");
}
fl_rec = !fl_rec;
}
void SuperMode::PlayClicked()
{
if (fl_play)
{
ui->BPlay->setStyleSheet("");
ui->BPlay->setText("Поехали");
}
else
{
ui->BPlay->setStyleSheet("background: green");
ui->BPlay->setText("Стоп");
}
fl_play = !fl_play;
m_vench->BPressPlay();
}
void SuperMode::TempClicked()
{
m_vench->SetTempFlag(ui->BTemp->isChecked());
m_vench->BPressTemp();
}
void SuperMode::EnergClicked()
{
m_vench->SetEnergFlag(ui->BEnerg->isChecked());
m_vench->BPressEnerg();
}
void SuperMode::DimClicked()
{
m_vench->SetDimFlag(ui->BDim->isChecked());
m_vench->BPressDim();
}
void SuperMode::BarClicked()
{
m_vench->SetBarFlag(ui->BBar->isChecked());
m_vench->BPressBar();
}
void SuperMode::RezultClicked()
{
m_vench->RezultClicked();
}
void SuperMode::ServerDirChanged()
{
ui->ServerDir->setText(m_vench->ServerDir());
}
void SuperMode::BPressGrph()
{
m_vench->SetGrphFlag(ui->BGrph->isChecked());
m_vench->BPressGrph();
}
void SuperMode::BPressGrphE()
{
m_vench->SetGrphEFlag(ui->BGrphE->isChecked());
m_vench->BPressGrphE();
}
void SuperMode::BPressGrphO()
{
m_vench->SetGrphOFlag(ui->BGrphO->isChecked());
m_vench->BPressGrphO();
}
void SuperMode::BPressGrphD()
{
m_vench->SetGrphDFlag(ui->BGrphD->isChecked());
m_vench->BPressGrphD();
}
void SuperMode::BPressGrphB()
{
m_vench->SetGrphBFlag(ui->BGrphB->isChecked());
m_vench->BPressGrphB();
}
void SuperMode::BPressGrphV()
{
m_vench->SetGrphVlFlag(ui->BGrphVl->isChecked());
m_vench->BPressGrphV();
}
void SuperMode::DatChanged(Dat dat)
{
if (dat == Dat::Right)
{
ui->LeftDat->setStyleSheet("");
ui->RightDat->setStyleSheet("background: red");
}
else if (dat == Dat::Left)
{
ui->LeftDat->setStyleSheet("background: red");
ui->RightDat->setStyleSheet("");
}
else // dat == Dat::None
{
ui->LeftDat->setStyleSheet("");
ui->RightDat->setStyleSheet("");
}
}
void SuperMode::LStatusChanged()
{
ui->LStatus->setText(m_vench->AnsStatus());
ui->LStatus->setStyleSheet("background: " + m_vench->AnsStatusColor().name());
}
void SuperMode::RegGrphTextChanged(QString text)
{
ui->LRegGrph->setText(text);
}
void SuperMode::LTempTextChanged(QString text)
{
ui->LTemp->setText(text);
}
void SuperMode::LOsvTextChanged(QString text)
{
ui->LOsv->setText(text);
}
void SuperMode::LEnTextChanged(QString text)
{
ui->LEn->setText(text);
}
void SuperMode::LDimTextChanged(QString text)
{
ui->LDim->setText(text);
}
void SuperMode::LBarTextChanged(QString text)
{
ui->LBar->setText(text);
}
void SuperMode::LVlTextChanged(QString text)
{
ui->LVl->setText(text);
}
#ifndef SUPERMODE_H
#define SUPERMODE_H
#include <QWidget>
#include "vench.h"
#include "worklogicalmodul.h"
namespace Ui {
class SuperMode;
}
class SuperMode : public WorkLogicalModul
{
Q_OBJECT
public:
explicit SuperMode(Vench *vench, QWidget *parent = nullptr);
~SuperMode();
protected slots:
void DiskrChanged();
void DopParamClicked();
void AllDevicesFlagChanged();
void UnsleepChanged();
void SpeedClicked();
void RuchnCommClicked();
void ChangeVenchXMLFlag();
void RecClicked();
void PlayClicked();
void TempClicked();
void EnergClicked();
void DimClicked();
void BarClicked();
void RezultClicked();
void ServerDirChanged();
void BPressGrph();
void BPressGrphE();
void BPressGrphO();
void BPressGrphD();
void BPressGrphB();
void BPressGrphV();
void DatChanged(Dat dat);
void LTempTextChanged(QString text);
void LOsvTextChanged(QString text);
void LEnTextChanged(QString text);
void LDimTextChanged(QString text);
void LBarTextChanged(QString text);
void LVlTextChanged(QString text);
virtual void LStatusChanged();
virtual void RegGrphTextChanged(QString text);
private:
Ui::SuperMode *ui;
bool fl_rec;
bool fl_play;
};
#endif // SUPERMODE_H
Это отличие свёрнуто
#include "zigbeemode.h"
#include "ui_zigbeemode.h"
#include "worklogicalmodul.h"
#include <QKeyEvent>
ZigBeeMode::ZigBeeMode(Vench *vench, QWidget *parent) :
WorkLogicalModul(vench, parent),
ui(new Ui::ZigBeeMode)
{
ui->setupUi(this);
LStatusChanged();
connect(ui->BHelp, &QPushButton::clicked, this, &WorkLogicalModul::OpenGuidDoc);
connect(ui->BCar_1, &QPushButton::clicked, this, &ZigBeeMode::Car1_ButtonClicked);
connect(ui->BCar_2, &QPushButton::clicked, this, &ZigBeeMode::Car2_ButtonClicked);
connect(ui->BBell, &QPushButton::pressed, m_vench, &Vench::BPressBip);
connect(ui->BBell, &QPushButton::released, m_vench, &Vench::BReleaseBip);
connect(ui->BLight, &QPushButton::pressed, m_vench, &Vench::BPressLight);
connect(ui->BLight, &QPushButton::released, m_vench, &Vench::BReleaseLight);
connect(ui->BUp, &QPushButton::pressed, m_vench, &Vench::BPressFw);
connect(ui->BUp, &QPushButton::released, m_vench, &Vench::BReleaseFw);
connect(ui->BLeft, &QPushButton::pressed, m_vench, &Vench::BPressLeft);
connect(ui->BLeft, &QPushButton::released, m_vench, &Vench::BReleaseLeft);
connect(ui->BRight, &QPushButton::pressed, m_vench, &Vench::BPressRight);
connect(ui->BRight, &QPushButton::released, m_vench, &Vench::BReleaseRight);
connect(ui->BDown, &QPushButton::pressed, m_vench, &Vench::BPressRv);
connect(ui->BDown, &QPushButton::released, m_vench, &Vench::BReleaseRv);
connect(ui->BStop, &QPushButton::pressed, m_vench, &Vench::BPressStop);
connect(ui->BStop, &QPushButton::released, m_vench, &Vench::BRealeseStop);
connect(ui->BUpdate, &QPushButton::clicked, m_vench, &Vench::ObSpActUst);
connect(ui->BWakeUp, &QPushButton::clicked, m_vench, &Vench::SendCommBudil);
}
void ZigBeeMode::keyPressEvent( QKeyEvent *e )
{
/*switch (e->key()) {
case Qt::Key_B:
ui->BBell->pressed();
break;
}*/
}
void ZigBeeMode::keyReleaseEvent( QKeyEvent *e )
{
/*switch (e->key()) {
case Qt::Key_B:
ui->BBell->released();
break;
// L - BLight
}*/
}
void ZigBeeMode::Car1_ButtonClicked()
{
m_vench->CarChanged(1);
ui->BCar_2->setChecked(false);
ui->BCar_1->setChecked(true);
}
void ZigBeeMode::Car2_ButtonClicked()
{
m_vench->CarChanged(2);
ui->BCar_1->setChecked(false);
ui->BCar_2->setChecked(true);
}
void ZigBeeMode::LStatusChanged()
{
ui->LStatus->setText(m_vench->AnsStatus());
ui->LStatus->setStyleSheet("background: " + m_vench->AnsStatusColor().name());
}
ZigBeeMode::~ZigBeeMode()
{
delete ui;
}
#ifndef ZIGBEEMODE_H
#define ZIGBEEMODE_H
#include <QWidget>
#include "worklogicalmodul.h"
#include "vench.h"
namespace Ui {
class ZigBeeMode;
}
class ZigBeeMode : public WorkLogicalModul
{
public:
explicit ZigBeeMode(Vench *vench, QWidget *parent = nullptr);
~ZigBeeMode();
public slots:
void Car1_ButtonClicked();
void Car2_ButtonClicked();
virtual void keyPressEvent( QKeyEvent * e );
virtual void keyReleaseEvent( QKeyEvent * e );
virtual void LStatusChanged();
private:
Ui::ZigBeeMode *ui;
};
#endif // ZIGBEEMODE_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ZigBeeMode</class>
<widget class="QWidget" name="ZigBeeMode">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1064</width>
<height>648</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>15</number>
</property>
<item>
<layout class="QHBoxLayout" name="deviceInfo">
<property name="spacing">
<number>15</number>
</property>
<item>
<widget class="QPushButton" name="BCar_1">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Машинка 1</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="BCar_2">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Машинка 2</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Статус устройства</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="LStatus">
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string>Канал обмена не инициализирован</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="2">
<spacer name="verticalSpacer_4">
<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="1" column="0">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>15</number>
</property>
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="spacing">
<number>15</number>
</property>
<item row="2" column="2">
<widget class="QPushButton" name="BDown">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="text">
<string>Назад (s)</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="BLeft">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="text">
<string>Влево (a)</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QPushButton" name="BStop">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Стоп (пробел)</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="BUp">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="text">
<string>Вперед (w)</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="BRight">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="text">
<string>Вправо (d)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="1" column="3">
<layout class="QVBoxLayout" name="verticalLayout_9">
<property name="spacing">
<number>15</number>
</property>
<item>
<widget class="QPushButton" name="BUpdate">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Обновить</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="BWakeUp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Разбудить</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<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>
<widget class="QPushButton" name="BHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Помощь</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="5">
<widget class="QLabel" name="label_logo_start">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>251</width>
<height>291</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../res.qrc">:/image/image/umki_logo_m.png</pixmap>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Не забудьте переключить раскладку клавиатуры в латинский алфавит (нижний регистр, CapsLock выключен)</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_7">
<property name="spacing">
<number>15</number>
</property>
<item>
<widget class="QPushButton" name="BBell">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Бип</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="BLight">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Свет</string>
</property>
</widget>
</item>
<item>
<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>
</layout>
</item>
<item row="1" column="4">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources>
<include location="../res.qrc"/>
</resources>
<connections/>
</ui>
......@@ -14,7 +14,6 @@
int main( int argc, char ** argv )
{
QApplication a( argc, argv );
bool isBluetoothMode = false;
int flKonsol = 0;
QString name_file;
......@@ -28,12 +27,6 @@ int main( int argc, char ** argv )
QString arg1 = argv[i];
++i;
if (arg1 == "-b")
{
printf("BlueTooth Mode\n");
isBluetoothMode = true;
}
if (arg1 == "-k")
if (i < argc)
{
......@@ -42,8 +35,6 @@ int main( int argc, char ** argv )
} else
printf("ERROR: katalog\n");
if (arg1 == "-d")
if (i < argc)
{
......@@ -72,8 +63,7 @@ int main( int argc, char ** argv )
}
}
//Vench *w = new Vench(0, katalog, port_s, isBluetoothMode, flKonsol, name_file);
MainWindow *w = new MainWindow(katalog, port_s, isBluetoothMode, flKonsol, name_file);
MainWindow *w = new MainWindow(katalog, port_s, true, flKonsol, name_file);
if (!flKonsol) w->show();
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
......
......@@ -26,29 +26,18 @@ QT += xml
# Input
HEADERS += channel.h define.h formview.h formzastav.h vench.h \
forms/basemode.h \
forms/bluetoothmode.h \
forms/mainwindow.h \
forms/supermode.h \
forms/zigbeemode.h \
worklogicalmodul.h
forms/mainwindow.h
FORMS += \
forms/basemode.ui \
forms/bluetoothmode.ui \
forms/mainwindow.ui \
forms/supermode.ui \
forms/zigbeemode.ui
forms/mainwindow.ui
SOURCES += channel.cpp \
forms/basemode.cpp \
forms/bluetoothmode.cpp \
forms/mainwindow.cpp \
forms/supermode.cpp \
forms/zigbeemode.cpp \
formview.cpp \
formzastav.cpp \
main.cpp \
vench.cpp \
worklogicalmodul.cpp
vench.cpp
RESOURCES += \
res.qrc
......
#include "worklogicalmodul.h"
#include <QFileInfo>
#include <QDesktopServices>
#include <QCoreApplication>
#include <QUrl>
#include <QtCore>
WorkLogicalModul::WorkLogicalModul(Vench *vench, QWidget *parent)
: QWidget(parent)
{
m_vench = vench;
connect(m_vench, &Vench::AnsStatusChanged, this, &WorkLogicalModul::LStatusChanged);
connect(m_vench, &Vench::RegGrphTextChanged, this, &WorkLogicalModul::RegGrphTextChanged);
}
void WorkLogicalModul::OpenGuidDoc()
{
QString helpFilePath = QCoreApplication::applicationDirPath() + "/umkiguide.pdf";
if (QFileInfo(helpFilePath).exists())
QDesktopServices::openUrl(QUrl(helpFilePath, QUrl::TolerantMode));
else
QDesktopServices::openUrl(QUrl("https://www.umkikit.ru/prog/umkiguide.pdf"));
}
void WorkLogicalModul::LStatusChanged()
{
}
void WorkLogicalModul::RegGrphTextChanged(QString text)
{
}
#ifndef WORKLOGICALMODUL_H
#define WORKLOGICALMODUL_H
#include <QObject>
#include <QWidget>
#include "vench.h"
class WorkLogicalModul : public QWidget
{
Q_OBJECT
public:
explicit WorkLogicalModul(Vench *vench, QWidget*parent = nullptr);
protected:
Vench *m_vench;
signals:
public slots:
void OpenGuidDoc();
virtual void LStatusChanged();
virtual void RegGrphTextChanged(QString text);
};
#endif // WORKLOGICALMODUL_H
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать