Rework with new gui

This commit is contained in:
hawkeyexp 2018-08-31 14:04:55 +02:00
parent baae26932c
commit 0bba0e5612
21 changed files with 3133 additions and 1186 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -5,33 +5,27 @@
<file>ico_setting.png</file>
<file>ico_info.png</file>
<file>ico_bluetooth.png</file>
<file>connect.png</file>
<file>cursor-hot.png</file>
<file>power-hot.png</file>
<file>settings-hot.png</file>
<file>circle.png</file>
<file>circle-hot.png</file>
<file>circle-pressed.png</file>
<file>sleep-hot.png</file>
<file>wifi-hot.png</file>
<file>brightness-hot.png</file>
<file>camera-hot.png</file>
<file>day-hot.png</file>
<file>night-hot.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>
<file>reboot-hot.png</file>
<file>back-hot.png</file>
<file>bg_exit.png</file>
<file>kodi-hot.png</file>
<file>bg_rearcam.png</file>
<file>rearcam-hot.png</file>
<file>recordactive-hot.png</file>
<file>lock-hot.png</file>
<file>volume-hot.png</file>
<file>bug-hot.png</file>
<file>eye-hot.png</file>
<file>skin-hot.png</file>
<file>black.png</file>
<file>Roboto-Regular.ttf</file>
</qresource>

BIN
assets/circle-hot.png → assets/skin-hot.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -46,6 +46,13 @@ public:
void showClock(bool value) override;
bool showClock() const override;
void showBigClock(bool value) override;
bool showBigClock() const override;
void oldGUI(bool value) override;
bool oldGUI() const override;
void setAlphaTrans(size_t value) override;
size_t getAlphaTrans() const override;
aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const override;
void setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) override;
aasdk::proto::enums::VideoResolution::Enum getVideoResolution() const override;
@ -81,6 +88,11 @@ private:
HandednessOfTrafficType handednessOfTrafficType_;
bool showClock_;
bool showBigClock_;
bool oldGUI_;
size_t alphaTrans_;
aasdk::proto::enums::VideoFPS::Enum videoFPS_;
aasdk::proto::enums::VideoResolution::Enum videoResolution_;
size_t screenDPI_;
@ -97,6 +109,11 @@ private:
static const std::string cConfigFileName;
static const std::string cGeneralShowClockKey;
static const std::string cGeneralShowBigClockKey;
static const std::string cGeneralOldGUIKey;
static const std::string cGeneralAlphaTransKey;
static const std::string cGeneralHandednessOfTrafficTypeKey;
static const std::string cVideoFPSKey;

View File

@ -54,6 +54,12 @@ public:
virtual HandednessOfTrafficType getHandednessOfTrafficType() const = 0;
virtual void showClock(bool value) = 0;
virtual bool showClock() const = 0;
virtual void showBigClock(bool value) = 0;
virtual bool showBigClock() const = 0;
virtual void oldGUI(bool value) = 0;
virtual bool oldGUI() const = 0;
virtual void setAlphaTrans(size_t value) = 0;
virtual size_t getAlphaTrans() const = 0;
virtual aasdk::proto::enums::VideoFPS::Enum getVideoFPS() const = 0;
virtual void setVideoFPS(aasdk::proto::enums::VideoFPS::Enum value) = 0;

View File

@ -58,39 +58,86 @@ signals:
void cameraRecord();
void openConnectDialog();
void showBrightnessSlider();
void startKodi();
void showVolumeSlider();
void showAlphaSlider();
void showRearCam();
void hideRearCam();
private slots:
void on_horizontalSliderBrightness_valueChanged(int value);
void on_horizontalSliderVolume_valueChanged(int value);
void on_horizontalSliderAlpha_valueChanged(int value);
private slots:
void on_pushButtonBrightness_clicked();
void on_pushButtonBrightness2_clicked();
void on_pushButtonVolume_clicked();
void on_pushButtonVolume2_clicked();
void on_pushButtonAlpha_clicked();
void switchGuiToDay();
void switchGuiToNight();
void showTime();
void cameraControlShow();
void cameraControlHide();
void toggleExit();
void showRearCamBG();
void hideRearCamBG();
void createDebuglog();
void setPairable();
void toggleMuteButton();
void toggleGUI();
void setMute();
void setUnMute();
void customButtonPressed1();
void customButtonPressed2();
void customButtonPressed3();
void customButtonPressed4();
void customButtonPressed5();
void customButtonPressed6();
void customButtonPressed7();
void customButtonPressed8();
private:
Ui::MainWindow* ui_;
bool brightnessSliderVisible = false;
QString brightnessFilename = "/sys/class/backlight/rpi_backlight/brightness";
QString brightnessFilenameAlt = "/tmp/custombrightness";
QFile *brightnessFile;
QFile *brightnessFileAlt;
char brightness_str[6];
char volume_str[6];
char alpha_str[6];
QString bversion;
QString bdate;
QString custom_button_file_c1 = "/boot/crankshaft/button_1";
QString custom_button_file_c2 = "/boot/crankshaft/button_2";
QString custom_button_file_c3 = "/boot/crankshaft/button_3";
QString custom_button_file_c4 = "/boot/crankshaft/button_4";
QString custom_button_file_c5 = "/boot/crankshaft/button_5";
QString custom_button_file_c6 = "/boot/crankshaft/button_6";
QString custom_button_file_c7 = "/boot/crankshaft/button_7";
QString custom_button_file_c8 = "/boot/crankshaft/button_8";
QString custom_button_command_c1;
QString custom_button_command_c2;
QString custom_button_command_c3;
QString custom_button_command_c4;
QString custom_button_command_c5;
QString custom_button_command_c6;
QString custom_button_command_c7;
QString custom_button_command_c8;
QString custom_button_color_c1 = "186,189,192";
QString custom_button_color_c2 = "186,189,192";
QString custom_button_color_c3 = "186,189,192";
QString custom_button_color_c4 = "186,189,192";
QString custom_button_color_c5 = "186,189,192";
QString custom_button_color_c6 = "186,189,192";
QString custom_button_color_c7 = "186,189,192";
QString custom_button_color_c8 = "186,189,192";
bool customBrightnessControl = false;
bool wifiButtonForce = false;
bool cameraButtonForce = false;
bool kodiButtonForce = false;
bool brightnessButtonForce = false;
bool nightModeEnabled = false;
@ -100,18 +147,35 @@ private:
bool wallpaperDayFileExists = false;
bool wallpaperNightFileExists = false;
bool wallpaperDevFileExists = false;
bool wallpaperDevNightFileExists = false;
bool wallpaperClassicDayFileExists = false;
bool wallpaperClassicNightFileExists = false;
bool masterButtonBGState = false;
bool exitMenuVisible = false;
bool rearCamEnabled = false;
bool dashcamBGState = false;
bool rearcamState = false;
bool rearCamVisible = false;
bool dashCamRecording = false;
bool systemDebugmode = false;
bool bluetoothEnabled = false;
bool toggleMute = false;
bool oldGUIStyle = false;
bool UseBigClock = false;
bool NoClock = false;
bool c1ButtonForce = false;
bool c2ButtonForce = false;
bool c3ButtonForce = false;
bool c4ButtonForce = false;
bool c5ButtonForce = false;
bool c6ButtonForce = false;
bool c7ButtonForce = false;
bool c8ButtonForce = false;
int screen_width = 800;
int screen_height = 480;
};
}

View File

@ -51,6 +51,7 @@ private slots:
void onSave();
void onResetToDefaults();
void onUpdateScreenDPI(int value);
void onUpdateAlphaTrans(int value);
void onShowBindings();
void onUpdateSystemVolume(int value);
void onUpdateSystemCapture(int value);

View File

@ -32,6 +32,11 @@ namespace configuration
const std::string Configuration::cConfigFileName = "openauto.ini";
const std::string Configuration::cGeneralShowClockKey = "General.ShowClock";
const std::string Configuration::cGeneralShowBigClockKey = "General.ShowBigClock";
const std::string Configuration::cGeneralOldGUIKey = "General.OldGUI";
const std::string Configuration::cGeneralAlphaTransKey = "General.AlphaTrans";
const std::string Configuration::cGeneralHandednessOfTrafficTypeKey = "General.HandednessOfTrafficType";
const std::string Configuration::cVideoFPSKey = "Video.FPS";
@ -83,6 +88,10 @@ void Configuration::load()
static_cast<uint32_t>(HandednessOfTrafficType::LEFT_HAND_DRIVE)));
showClock_ = iniConfig.get<bool>(cGeneralShowClockKey, true);
showBigClock_ = iniConfig.get<bool>(cGeneralShowBigClockKey, false);
oldGUI_ = iniConfig.get<bool>(cGeneralOldGUIKey, false);
alphaTrans_ = iniConfig.get<size_t>(cGeneralAlphaTransKey, 50);
videoFPS_ = static_cast<aasdk::proto::enums::VideoFPS::Enum>(iniConfig.get<uint32_t>(cVideoFPSKey,
aasdk::proto::enums::VideoFPS::_60));
@ -118,6 +127,9 @@ void Configuration::reset()
{
handednessOfTrafficType_ = HandednessOfTrafficType::LEFT_HAND_DRIVE;
showClock_ = true;
showBigClock_ = false;
oldGUI_ = false;
alphaTrans_ = 50;
videoFPS_ = aasdk::proto::enums::VideoFPS::_60;
videoResolution_ = aasdk::proto::enums::VideoResolution::_480p;
screenDPI_ = 140;
@ -136,7 +148,11 @@ void Configuration::save()
{
boost::property_tree::ptree iniConfig;
iniConfig.put<uint32_t>(cGeneralHandednessOfTrafficTypeKey, static_cast<uint32_t>(handednessOfTrafficType_));
iniConfig.put<bool>(cGeneralShowClockKey, showClock_);
iniConfig.put<bool>(cGeneralShowBigClockKey, showBigClock_);
iniConfig.put<bool>(cGeneralOldGUIKey, oldGUI_);
iniConfig.put<size_t>(cGeneralAlphaTransKey, alphaTrans_);
iniConfig.put<uint32_t>(cVideoFPSKey, static_cast<uint32_t>(videoFPS_));
iniConfig.put<uint32_t>(cVideoResolutionKey, static_cast<uint32_t>(videoResolution_));
@ -196,6 +212,36 @@ bool Configuration::showClock() const
return showClock_;
}
void Configuration::showBigClock(bool value)
{
showBigClock_ = value;
}
bool Configuration::showBigClock() const
{
return showBigClock_;
}
void Configuration::oldGUI(bool value)
{
oldGUI_ = value;
}
bool Configuration::oldGUI() const
{
return oldGUI_;
}
size_t Configuration::getAlphaTrans() const
{
return alphaTrans_;
}
void Configuration::setAlphaTrans(size_t value)
{
alphaTrans_ = value;
}
aasdk::proto::enums::VideoFPS::Enum Configuration::getVideoFPS() const
{
return videoFPS_;

File diff suppressed because it is too large Load Diff

View File

@ -43,6 +43,7 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat
connect(ui_->pushButtonSave, &QPushButton::clicked, this, &SettingsWindow::onSave);
connect(ui_->pushButtonUnpair , &QPushButton::clicked, this, &SettingsWindow::unpairAll);
connect(ui_->horizontalSliderScreenDPI, &QSlider::valueChanged, this, &SettingsWindow::onUpdateScreenDPI);
connect(ui_->horizontalSliderAlphaTrans, &QSlider::valueChanged, this, &SettingsWindow::onUpdateAlphaTrans);
connect(ui_->radioButtonUseExternalBluetoothAdapter, &QRadioButton::clicked, [&](bool checked) { ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(checked); });
connect(ui_->radioButtonDisableBluetooth, &QRadioButton::clicked, [&]() { ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(false); });
connect(ui_->radioButtonUseLocalBluetoothAdapter, &QRadioButton::clicked, [&]() { ui_->lineEditExternalBluetoothAdapterAddress->setEnabled(false); });
@ -63,7 +64,12 @@ SettingsWindow::~SettingsWindow()
void SettingsWindow::onSave()
{
configuration_->setHandednessOfTrafficType(ui_->radioButtonLeftHandDrive->isChecked() ? configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE : configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE);
configuration_->showClock(ui_->checkBoxShowClock->isChecked());
configuration_->showBigClock(ui_->checkBoxShowBigClock->isChecked());
configuration_->oldGUI(ui_->checkBoxOldGUI->isChecked());
configuration_->setAlphaTrans(static_cast<size_t>(ui_->horizontalSliderAlphaTrans->value()));
configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() ? aasdk::proto::enums::VideoFPS::_30 : aasdk::proto::enums::VideoFPS::_60);
if(ui_->radioButton480p->isChecked())
@ -233,6 +239,10 @@ void SettingsWindow::load()
ui_->radioButtonLeftHandDrive->setChecked(configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::LEFT_HAND_DRIVE);
ui_->radioButtonRightHandDrive->setChecked(configuration_->getHandednessOfTrafficType() == configuration::HandednessOfTrafficType::RIGHT_HAND_DRIVE);
ui_->checkBoxShowClock->setChecked(configuration_->showClock());
ui_->horizontalSliderAlphaTrans->setValue(static_cast<int>(configuration_->getAlphaTrans()));
ui_->checkBoxShowBigClock->setChecked(configuration_->showBigClock());
ui_->checkBoxOldGUI->setChecked(configuration_->oldGUI());
ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_30);
ui_->radioButton60FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_60);
@ -342,6 +352,12 @@ void SettingsWindow::onUpdateScreenDPI(int value)
ui_->labelScreenDPIValue->setText(QString::number(value));
}
void SettingsWindow::onUpdateAlphaTrans(int value)
{
double alpha = value/100.0;
ui_->labelAlphaTransValue->setText(QString::number(alpha));
}
void SettingsWindow::onUpdateSystemVolume(int value)
{
ui_->labelSystemVolumeValue->setText(QString::number(value));

File diff suppressed because it is too large Load Diff

View File

@ -123,18 +123,109 @@ color: rgb(238, 238, 236);
</property>
</widget>
</widget>
<widget class="QCheckBox" name="checkBoxShowClock">
<widget class="QGroupBox" name="groupBoxGUI">
<property name="geometry">
<rect>
<x>10</x>
<x>0</x>
<y>110</y>
<width>111</width>
<height>23</height>
<width>646</width>
<height>131</height>
</rect>
</property>
<property name="text">
<string>Show clock</string>
<property name="title">
<string>GUI</string>
</property>
<widget class="QCheckBox" name="checkBoxShowClock">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>111</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Show clock</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxOldGUI">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>221</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Use classic gui on startup</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxShowBigClock">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>381</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Use big clock in classic gui (only if show clock enabled)</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBoxScreenDPI_2">
<property name="geometry">
<rect>
<x>0</x>
<y>250</y>
<width>646</width>
<height>81</height>
</rect>
</property>
<property name="title">
<string>Transparency Tile GUI on Startup</string>
</property>
<widget class="QLabel" name="labelAlphaTransValue">
<property name="geometry">
<rect>
<x>570</x>
<y>40</y>
<width>41</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>0.5</string>
</property>
</widget>
<widget class="QSlider" name="horizontalSliderAlphaTrans">
<property name="geometry">
<rect>
<x>20</x>
<y>40</y>
<width>531</width>
<height>34</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QSlider::handle:horizontal { background: white; height: 32px; width: 52px; margin: 0 0;}
QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>50</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</widget>
</widget>
<widget class="QWidget" name="tabVideo">

View File

@ -18,6 +18,7 @@
#include <thread>
#include <QApplication>
#include <QDesktopWidget>
#include <f1x/aasdk/USB/USBHub.hpp>
#include <f1x/aasdk/USB/ConnectedAccessoriesEnumerator.hpp>
#include <f1x/aasdk/USB/AccessoryModeQueryChain.hpp>
@ -84,6 +85,10 @@ int main(int argc, char* argv[])
startIOServiceWorkers(ioService, threadPool);
QApplication qApplication(argc, argv);
const int width = QApplication::desktop()->width();
OPENAUTO_LOG(info) << "[OpenAuto] Display width: " << width;
const int height = QApplication::desktop()->height();
OPENAUTO_LOG(info) << "[OpenAuto] Display height: " << height;
auto configuration = std::make_shared<autoapp::configuration::Configuration>();
@ -100,7 +105,7 @@ int main(int argc, char* argv[])
autoapp::ui::ConnectDialog connectDialog(ioService, tcpWrapper, recentAddressesList);
connectDialog.setWindowFlags(Qt::WindowStaysOnTopHint);
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::exit, []() { std::exit(0); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::exit, []() { system("touch /tmp/shutdown"); std::exit(0); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::reboot, []() { system("touch /tmp/reboot"); std::exit(0); });
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::showFullScreen);
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::loadSystemValues);
@ -178,7 +183,7 @@ int main(int argc, char* argv[])
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptNight, [&qApplication]() {
#ifdef RASPBERRYPI3
system("/opt/crankshaft/service_daynight.sh app night &");
system("/opt/crankshaft/service_daynight.sh app night");
OPENAUTO_LOG(info) << "[CS] Run night script.";
#else
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Day/Night script.";
@ -187,23 +192,16 @@ int main(int argc, char* argv[])
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::TriggerScriptDay, [&qApplication]() {
#ifdef RASPBERRYPI3
system("/opt/crankshaft/service_daynight.sh app day &");
system("/opt/crankshaft/service_daynight.sh app day");
OPENAUTO_LOG(info) << "[CS] Run day script.";
#else
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping Day/Night script.";
#endif
});
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::startKodi, [&qApplication]() {
#ifdef RASPBERRYPI3
system("/usr/bin/kodi &");
OPENAUTO_LOG(info) << "[CS] Run kodi binary.";
#else
OPENAUTO_LOG(info) << "[CS] You are not running this on a Raspberry Pi, skipping kodi.";
#endif
});
mainWindow.showFullScreen();
mainWindow.setFixedSize(width, height);
//mainWindow.adjustSize();
aasdk::usb::USBWrapper usbWrapper(usbContext);
aasdk::usb::AccessoryModeQueryFactory queryFactory(usbWrapper, ioService);