[gui][script] Dashcam / Reworks
This commit is contained in:
parent
77cdf52cd2
commit
3a59525055
BIN
assets/bg_buttons.png
Normal file
BIN
assets/bg_buttons.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
BIN
assets/bg_dashcam.png
Normal file
BIN
assets/bg_dashcam.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
BIN
assets/record-hot.png
Normal file
BIN
assets/record-hot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
@ -18,5 +18,10 @@
|
|||||||
<file>day-hot.png</file>
|
<file>day-hot.png</file>
|
||||||
<file>night-hot.png</file>
|
<file>night-hot.png</file>
|
||||||
<file>slider.png</file>
|
<file>slider.png</file>
|
||||||
|
<file>bg_dashcam.png</file>
|
||||||
|
<file>bg_buttons.png</file>
|
||||||
|
<file>record-hot.png</file>
|
||||||
|
<file>stop-hot.png</file>
|
||||||
|
<file>save-hot.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
BIN
assets/save-hot.png
Normal file
BIN
assets/save-hot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
assets/stop-hot.png
Normal file
BIN
assets/stop-hot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
@ -50,7 +50,11 @@ signals:
|
|||||||
void toggleCursor();
|
void toggleCursor();
|
||||||
void TriggerScriptDay();
|
void TriggerScriptDay();
|
||||||
void TriggerScriptNight();
|
void TriggerScriptNight();
|
||||||
void toggleCamera();
|
void cameraShow();
|
||||||
|
void cameraHide();
|
||||||
|
void cameraStop();
|
||||||
|
void cameraSave();
|
||||||
|
void cameraRecord();
|
||||||
void openConnectDialog();
|
void openConnectDialog();
|
||||||
void showBrightnessSlider();
|
void showBrightnessSlider();
|
||||||
|
|
||||||
@ -62,6 +66,8 @@ private slots:
|
|||||||
void switchGuiToDay();
|
void switchGuiToDay();
|
||||||
void switchGuiToNight();
|
void switchGuiToNight();
|
||||||
void showTime();
|
void showTime();
|
||||||
|
void cameraControlShow();
|
||||||
|
void cameraControlHide();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow* ui_;
|
Ui::MainWindow* ui_;
|
||||||
@ -78,6 +84,9 @@ private:
|
|||||||
bool wallpaperNightFileExists = false;
|
bool wallpaperNightFileExists = false;
|
||||||
bool wallpaperDevFileExists = false;
|
bool wallpaperDevFileExists = false;
|
||||||
bool wallpaperDevNightFileExists = false;
|
bool wallpaperDevNightFileExists = false;
|
||||||
|
|
||||||
|
bool masterButtonBGState = false;
|
||||||
|
bool dashcamBGState = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,13 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
|||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
connect(ui_->pushButtonSettings, &QPushButton::clicked, this, &MainWindow::openSettings);
|
connect(ui_->pushButtonSettings, &QPushButton::clicked, this, &MainWindow::openSettings);
|
||||||
connect(ui_->pushButtonExit, &QPushButton::clicked, this, &MainWindow::exit);
|
connect(ui_->pushButtonExit, &QPushButton::clicked, this, &MainWindow::exit);
|
||||||
connect(ui_->pushButtonToggleCamera, &QPushButton::clicked, this, &MainWindow::toggleCamera);
|
connect(ui_->pushButtonCameraShow, &QPushButton::clicked, this, &MainWindow::cameraShow);
|
||||||
|
connect(ui_->pushButtonCameraShow, &QPushButton::clicked, this, &MainWindow::cameraControlShow);
|
||||||
|
connect(ui_->pushButtonCameraHide, &QPushButton::clicked, this, &MainWindow::cameraHide);
|
||||||
|
connect(ui_->pushButtonCameraHide, &QPushButton::clicked, this, &MainWindow::cameraControlHide);
|
||||||
|
connect(ui_->pushButtonStop, &QPushButton::clicked, this, &MainWindow::cameraStop);
|
||||||
|
connect(ui_->pushButtonRecord, &QPushButton::clicked, this, &MainWindow::cameraRecord);
|
||||||
|
connect(ui_->pushButtonSave, &QPushButton::clicked, this, &MainWindow::cameraSave);
|
||||||
connect(ui_->pushButtonToggleCursor, &QPushButton::clicked, this, &MainWindow::toggleCursor);
|
connect(ui_->pushButtonToggleCursor, &QPushButton::clicked, this, &MainWindow::toggleCursor);
|
||||||
connect(ui_->pushButtonDay, &QPushButton::clicked, this, &MainWindow::TriggerScriptDay);
|
connect(ui_->pushButtonDay, &QPushButton::clicked, this, &MainWindow::TriggerScriptDay);
|
||||||
connect(ui_->pushButtonDay, &QPushButton::clicked, this, &MainWindow::switchGuiToDay);
|
connect(ui_->pushButtonDay, &QPushButton::clicked, this, &MainWindow::switchGuiToDay);
|
||||||
@ -119,8 +125,19 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
|||||||
ui_->pushButtonToggleCursor->hide();
|
ui_->pushButtonToggleCursor->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QPixmap image;
|
||||||
|
image.load(":/bg_buttons.png");
|
||||||
|
ui_->masterButtonBG->setPixmap(image);
|
||||||
|
ui_->pushButtonStop->hide();
|
||||||
|
ui_->pushButtonRecord->hide();
|
||||||
|
ui_->pushButtonSave->hide();
|
||||||
|
|
||||||
if (!cameraButtonForce) {
|
if (!cameraButtonForce) {
|
||||||
ui_->pushButtonToggleCamera->hide();
|
ui_->pushButtonCameraShow->hide();
|
||||||
|
ui_->pushButtonCameraHide->hide();
|
||||||
|
} else {
|
||||||
|
ui_->pushButtonCameraShow->show();
|
||||||
|
ui_->pushButtonCameraHide->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wifiButtonForce) {
|
if (!wifiButtonForce) {
|
||||||
@ -185,6 +202,7 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonBrightness_clicked()
|
|||||||
{
|
{
|
||||||
this->brightnessSliderVisible = !this->brightnessSliderVisible;
|
this->brightnessSliderVisible = !this->brightnessSliderVisible;
|
||||||
if (this->brightnessSliderVisible) {
|
if (this->brightnessSliderVisible) {
|
||||||
|
f1x::openauto::autoapp::ui::MainWindow::cameraControlHide();
|
||||||
// Get the current brightness value
|
// Get the current brightness value
|
||||||
this->brightnessFile = new QFile(this->brightnessFilename);
|
this->brightnessFile = new QFile(this->brightnessFilename);
|
||||||
if (this->brightnessFile->open(QIODevice::ReadOnly)) {
|
if (this->brightnessFile->open(QIODevice::ReadOnly)) {
|
||||||
@ -261,6 +279,31 @@ void f1x::openauto::autoapp::ui::MainWindow::switchGuiToDay()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void f1x::openauto::autoapp::ui::MainWindow::cameraControlHide()
|
||||||
|
{
|
||||||
|
ui_->pushButtonCameraHide->hide();
|
||||||
|
ui_->pushButtonStop->hide();
|
||||||
|
ui_->pushButtonRecord->hide();
|
||||||
|
ui_->pushButtonSave->hide();
|
||||||
|
ui_->dashcamBG->hide();
|
||||||
|
this->dashcamBGState = false;
|
||||||
|
ui_->pushButtonCameraShow->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void f1x::openauto::autoapp::ui::MainWindow::cameraControlShow()
|
||||||
|
{
|
||||||
|
ui_->pushButtonCameraShow->hide();
|
||||||
|
QPixmap image;
|
||||||
|
image.load(":/bg_dashcam.png");
|
||||||
|
ui_->dashcamBG->setPixmap(image);
|
||||||
|
ui_->dashcamBG->show();
|
||||||
|
ui_->pushButtonStop->show();
|
||||||
|
ui_->pushButtonRecord->show();
|
||||||
|
ui_->pushButtonSave->show();
|
||||||
|
this->dashcamBGState = true;
|
||||||
|
ui_->pushButtonCameraHide->show();
|
||||||
|
}
|
||||||
|
|
||||||
void f1x::openauto::autoapp::ui::MainWindow::showTime()
|
void f1x::openauto::autoapp::ui::MainWindow::showTime()
|
||||||
{
|
{
|
||||||
QTime time=QTime::currentTime();
|
QTime time=QTime::currentTime();
|
||||||
|
@ -14,6 +14,16 @@
|
|||||||
<string>MainWindow</string>
|
<string>MainWindow</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<widget class="QLabel" name="masterButtonBG">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>640</width>
|
||||||
|
<height>440</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
<widget class="QLabel" name="Digital_clock">
|
<widget class="QLabel" name="Digital_clock">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
@ -43,12 +53,6 @@
|
|||||||
<height>64</height>
|
<height>64</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="default">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -101,12 +105,6 @@
|
|||||||
<height>64</height>
|
<height>64</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="default">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -136,12 +134,6 @@
|
|||||||
<height>64</height>
|
<height>64</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="default">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -171,12 +163,6 @@
|
|||||||
<height>64</height>
|
<height>64</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="default">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -200,12 +186,6 @@
|
|||||||
<height>64</height>
|
<height>64</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="default">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -235,7 +215,7 @@
|
|||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="pushButtonToggleCamera">
|
<widget class="QPushButton" name="pushButtonCameraShow">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>30</x>
|
<x>30</x>
|
||||||
@ -254,8 +234,28 @@
|
|||||||
<height>64</height>
|
<height>64</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
<property name="flat">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="pushButtonCameraHide">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>314</y>
|
||||||
|
<width>64</width>
|
||||||
|
<height>64</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../assets/resources.qrc">
|
||||||
|
<normaloff>:/camera-hot.png</normaloff>:/camera-hot.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>64</width>
|
||||||
|
<height>64</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -280,8 +280,84 @@
|
|||||||
<height>64</height>
|
<height>64</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
<property name="flat">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="dashcamBG">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>130</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>640</width>
|
||||||
|
<height>440</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="pushButtonStop">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>146</x>
|
||||||
|
<y>384</y>
|
||||||
|
<width>64</width>
|
||||||
|
<height>64</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../assets/resources.qrc">
|
||||||
|
<normaloff>:/stop-hot.png</normaloff>:/stop-hot.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>64</width>
|
||||||
|
<height>64</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="pushButtonRecord">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>216</x>
|
||||||
|
<y>384</y>
|
||||||
|
<width>64</width>
|
||||||
|
<height>64</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../assets/resources.qrc">
|
||||||
|
<normaloff>:/record-hot.png</normaloff>:/record-hot.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>64</width>
|
||||||
|
<height>64</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="pushButtonSave">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>690</x>
|
||||||
|
<y>384</y>
|
||||||
|
<width>64</width>
|
||||||
|
<height>64</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../../assets/resources.qrc">
|
||||||
|
<normaloff>:/save-hot.png</normaloff>:/save-hot.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>64</width>
|
||||||
|
<height>64</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="flat">
|
<property name="flat">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -110,10 +110,46 @@ int main(int argc, char* argv[])
|
|||||||
qApplication.setOverrideCursor(cursor);
|
qApplication.setOverrideCursor(cursor);
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::toggleCamera, [&qApplication]() {
|
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraHide, [&qApplication]() {
|
||||||
#ifdef RASPBERRYPI3
|
#ifdef RASPBERRYPI3
|
||||||
system("/opt/crankshaft/toggle_rpicam.sh &");
|
system("/opt/crankshaft/cameracontrol.py Background &");
|
||||||
OPENAUTO_LOG(info) << "[CS] Ran RPiCam script.";
|
OPENAUTO_LOG(info) << "[CS] Ran RPiCameraControl script.";
|
||||||
|
#else
|
||||||
|
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
|
||||||
|
#endif
|
||||||
|
});
|
||||||
|
|
||||||
|
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraShow, [&qApplication]() {
|
||||||
|
#ifdef RASPBERRYPI3
|
||||||
|
system("/opt/crankshaft/cameracontrol.py Foreground &");
|
||||||
|
OPENAUTO_LOG(info) << "[CS] Ran RPiCameraControl script.";
|
||||||
|
#else
|
||||||
|
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
|
||||||
|
#endif
|
||||||
|
});
|
||||||
|
|
||||||
|
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraRecord, [&qApplication]() {
|
||||||
|
#ifdef RASPBERRYPI3
|
||||||
|
system("/opt/crankshaft/cameracontrol.py Record &");
|
||||||
|
OPENAUTO_LOG(info) << "[CS] Ran RPiCameraControl script.";
|
||||||
|
#else
|
||||||
|
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
|
||||||
|
#endif
|
||||||
|
});
|
||||||
|
|
||||||
|
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraStop, [&qApplication]() {
|
||||||
|
#ifdef RASPBERRYPI3
|
||||||
|
system("/opt/crankshaft/cameracontrol.py Stop &");
|
||||||
|
OPENAUTO_LOG(info) << "[CS] Ran RPiCameraControl script.";
|
||||||
|
#else
|
||||||
|
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
|
||||||
|
#endif
|
||||||
|
});
|
||||||
|
|
||||||
|
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::cameraSave, [&qApplication]() {
|
||||||
|
#ifdef RASPBERRYPI3
|
||||||
|
system("/opt/crankshaft/cameracontrol.py Save &");
|
||||||
|
OPENAUTO_LOG(info) << "[CS] Ran RPiCameraControl script.";
|
||||||
#else
|
#else
|
||||||
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
|
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Cam script.";
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user