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

new design

владелец 3460d6f3
#include "bluetoothmode.h"
#include "ui_bluetoothmode.h"
#include <QFileInfo>
#include <QDesktopServices>
#include <QCoreApplication>
#include <QUrl>
#include <QKeyEvent>
#include <QShortcut>
......@@ -27,11 +23,8 @@ BluetoothMode::BluetoothMode(Vench *vench, QWidget *parent) :
(new QShortcut(QKeySequence(Qt::Key_Space), this, [this](){ m_vench->on_BStop_B_clicked(); }))->setAutoRepeat(false);
(new QShortcut(QKeySequence(Qt::Key_R), this, SLOT(RecClicked())))->setAutoRepeat(false);
(new QShortcut(QKeySequence(Qt::Key_P), this, SLOT(PlayClicked())))->setAutoRepeat(false);
(new QShortcut(QKeySequence(Qt::Key_H), this, SLOT(OpenGuidDoc())))->setAutoRepeat(false);
//--------------------------------------------//
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);
......@@ -128,15 +121,6 @@ void BluetoothMode::SetLStatus()
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;
......
......@@ -24,7 +24,6 @@ protected slots:
void RuchnCommClicked();
void RecClicked();
void PlayClicked();
void OpenGuidDoc();
void SetLStatus();
private:
......
Это отличие свёрнуто
......@@ -3,6 +3,11 @@
#include "bluetoothmode.h"
#include <QMessageBox>
#include <QFileInfo>
#include <QDesktopServices>
#include <QCoreApplication>
#include <QUrl>
#include <QShortcut>
MainWindow::MainWindow(QString kat, QString prt, QWidget *parent) :
QMainWindow(parent),
......@@ -16,10 +21,43 @@ MainWindow::MainWindow(QString kat, QString prt, QWidget *parent) :
m_vench = new Vench(kat, prt);
connect(m_vench, &Vench::informationMessage, this, [this](QString title, QString text, QString buttonText)
{
QMessageBox::information(this, title, text, buttonText);
QMessageBox::critical(this, title, text, buttonText);
});
ui->centralwidget->layout()->addWidget(new BluetoothMode(m_vench, this));
m_vench->PortConnected();
connect(ui->actionGuide, &QAction::triggered, this, &MainWindow::OpenGuideDoc);
connect(ui->actionReference, &QAction::triggered, this, &MainWindow::OpenReference);
(new QShortcut(QKeySequence(Qt::Key_H), this, SLOT(OpenGuideDoc())))->setAutoRepeat(false);
}
void MainWindow::OpenGuideDoc()
{
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 MainWindow::OpenReference()
{
QMessageBox msgBox;
msgBox.setWindowTitle("Справка");
msgBox.setText("Горячие клавиши");
QString informativeText =
QString("H - Документация\n")
+ QString("W - Команда \"Вперед\"\n")
+ QString("A - Команда \"Влево\"\n")
+ QString("S - Команда \"Назад\"\n")
+ QString("D - Команда \"Вправо\"\n")
+ QString("B - Команда \"Сигнал (Бип)\"\n")
+ QString("L - Команда \"Свет\"\n")
+ QString("Space (Пробел) - Команда \"Стоп\"\n")
+ QString("R - Запись\n")
+ QString("P - Воспроизведение\n");
msgBox.setInformativeText(informativeText);
msgBox.exec();
}
MainWindow::~MainWindow()
......
......@@ -16,6 +16,10 @@ public:
explicit MainWindow(QString kat, QString prt, QWidget *parent = nullptr);
~MainWindow();
protected slots:
void OpenGuideDoc();
void OpenReference();
private:
Ui::MainWindow *ui;
Vench* m_vench;
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>882</width>
<height>623</height>
<width>282</width>
<height>291</height>
</rect>
</property>
<property name="windowTitle">
......@@ -25,12 +25,30 @@
<rect>
<x>0</x>
<y>0</y>
<width>882</width>
<width>282</width>
<height>30</height>
</rect>
</property>
<widget class="QMenu" name="menuHelp">
<property name="title">
<string>Помощь</string>
</property>
<addaction name="actionGuide"/>
<addaction name="actionReference"/>
</widget>
<addaction name="menuHelp"/>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<action name="actionGuide">
<property name="text">
<string>Руководство</string>
</property>
</action>
<action name="actionReference">
<property name="text">
<string>Справка</string>
</property>
</action>
</widget>
<resources>
<include location="../res.qrc"/>
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать