websocket client boilerplate

This commit is contained in:
marios8543 2025-04-20 20:06:35 +03:00
parent 25c3c5171c
commit b27dcec0b9
2 changed files with 1578 additions and 1091 deletions

View File

@ -45,230 +45,231 @@
#include <QKeyEvent> #include <QKeyEvent>
#include <QBluetoothLocalDevice> #include <QBluetoothLocalDevice>
//#include <QtBluetooth> // #include <QtBluetooth>
namespace Ui namespace Ui
{ {
class MainWindow; class MainWindow;
} }
namespace f1x namespace f1x
{ {
namespace openauto namespace openauto
{ {
namespace autoapp namespace autoapp
{ {
namespace ui namespace ui
{ {
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit MainWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent = nullptr); explicit MainWindow(configuration::IConfiguration::Pointer configuration, QWidget *parent = nullptr);
~MainWindow() override; ~MainWindow() override;
QMediaPlayer* player; QMediaPlayer *player;
QFileSystemWatcher* watcher; QFileSystemWatcher *watcher;
QFileSystemWatcher* watcher_tmp; QFileSystemWatcher *watcher_tmp;
signals: signals:
void exit(); void exit();
void reboot(); void reboot();
void openSettings(); void openSettings();
void toggleCursor(); void toggleCursor();
void TriggerScriptDay(); void TriggerScriptDay();
void TriggerScriptNight(); void TriggerScriptNight();
void cameraShow(); void cameraShow();
void cameraHide(); void cameraHide();
void cameraStop(); void cameraStop();
void cameraSave(); void cameraSave();
void cameraRecord(); void cameraRecord();
void cameraPosYUp(); void cameraPosYUp();
void cameraPosYDown(); void cameraPosYDown();
void cameraZoomPlus(); void cameraZoomPlus();
void cameraZoomMinus(); void cameraZoomMinus();
void cameraFlipX(); void cameraFlipX();
void cameraFlipY(); void cameraFlipY();
void openConnectDialog(); void openConnectDialog();
void openWifiDialog(); void openWifiDialog();
void openUpdateDialog(); void openUpdateDialog();
void showBrightnessSlider(); void showBrightnessSlider();
void showAlphaSlider(); void showAlphaSlider();
void showRearCam(); void showRearCam();
void hideRearCam(); void hideRearCam();
void TriggerAppStart(); void TriggerAppStart();
void TriggerAppStop(); void TriggerAppStop();
void CloseAllDialogs(); void CloseAllDialogs();
private slots: private slots:
void on_horizontalSliderBrightness_valueChanged(int value); void on_horizontalSliderBrightness_valueChanged(int value);
void updateAlpha(); void updateAlpha();
private slots: private slots:
void on_pushButtonBrightness_clicked(); void on_pushButtonBrightness_clicked();
void on_pushButtonBrightness2_clicked(); void on_pushButtonBrightness2_clicked();
void switchGuiToDay(); void switchGuiToDay();
void switchGuiToNight(); void switchGuiToNight();
void showTime(); void showTime();
void cameraControlShow(); void cameraControlShow();
void cameraControlHide(); void cameraControlHide();
void toggleExit(); void toggleExit();
void createDebuglog(); void createDebuglog();
void setPairable(); void setPairable();
void toggleGUI(); void toggleGUI();
void customButtonPressed1(); void customButtonPressed1();
void customButtonPressed2(); void customButtonPressed2();
void customButtonPressed3(); void customButtonPressed3();
void customButtonPressed4(); void customButtonPressed4();
void customButtonPressed5(); void customButtonPressed5();
void customButtonPressed6(); void customButtonPressed6();
void playerShow(); void playerShow();
void playerHide(); void playerHide();
void updateBG(); void updateBG();
void on_horizontalSliderProgressPlayer_sliderMoved(int position); void on_horizontalSliderProgressPlayer_sliderMoved(int position);
void on_pushButtonList_clicked(); void on_pushButtonList_clicked();
void on_pushButtonPlayerStop_clicked(); void on_pushButtonPlayerStop_clicked();
void on_pushButtonPlayerPause_clicked(); void on_pushButtonPlayerPause_clicked();
void on_positionChanged(qint64 position); void on_positionChanged(qint64 position);
void on_durationChanged(qint64 position); void on_durationChanged(qint64 position);
void on_mp3List_itemClicked(QListWidgetItem *item); void on_mp3List_itemClicked(QListWidgetItem *item);
void metaDataChanged(); void metaDataChanged();
void on_pushButtonPlayerPlayList_clicked(); void on_pushButtonPlayerPlayList_clicked();
void on_pushButtonPlayerNextBig_clicked(); void on_pushButtonPlayerNextBig_clicked();
void on_pushButtonPlayerPrevBig_clicked(); void on_pushButtonPlayerPrevBig_clicked();
void on_pushButtonPlayerPrevAlbum_clicked(); void on_pushButtonPlayerPrevAlbum_clicked();
void on_pushButtonPlayerNextAlbum_clicked(); void on_pushButtonPlayerNextAlbum_clicked();
void on_pushButtonBackToPlayer_clicked(); void on_pushButtonBackToPlayer_clicked();
void on_comboBoxAlbum_currentIndexChanged(const QString &arg1); void on_comboBoxAlbum_currentIndexChanged(const QString &arg1);
void on_mp3List_currentRowChanged(int currentRow); void on_mp3List_currentRowChanged(int currentRow);
void on_StateChanged(QMediaPlayer::State state); void on_StateChanged(QMediaPlayer::State state);
void scanFolders(); void scanFolders();
void scanFiles(); void scanFiles();
void tmpChanged(); void tmpChanged();
void setTrigger(); void setTrigger();
void setRetryUSBConnect(); void setRetryUSBConnect();
void resetRetryUSBMessage(); void resetRetryUSBMessage();
void updateNetworkInfo(); void updateNetworkInfo();
bool check_file_exist(const char *filename); bool check_file_exist(const char *filename);
void hostModeStateChanged(QBluetoothLocalDevice::HostMode); void hostModeStateChanged(QBluetoothLocalDevice::HostMode);
void connectWebSocket();
void handleIncomingMessage(const QString &message);
//void on_AlbumCoverListView_clicked(const QModelIndex &index); // void on_AlbumCoverListView_clicked(const QModelIndex &index);
void on_AlbumCoverListView_clicked(const QModelIndex &index); void on_AlbumCoverListView_clicked(const QModelIndex &index);
void on_pushButtonAlbum_clicked(); void on_pushButtonAlbum_clicked();
private: private:
Ui::MainWindow* ui_; Ui::MainWindow *ui_;
configuration::IConfiguration::Pointer configuration_; configuration::IConfiguration::Pointer configuration_;
QString brightnessFilename = "/sys/class/backlight/rpi_backlight/brightness"; QString brightnessFilename = "/sys/class/backlight/rpi_backlight/brightness";
QString brightnessFilenameAlt = "/tmp/custombrightness"; QString brightnessFilenameAlt = "/tmp/custombrightness";
QFile *brightnessFile; QFile *brightnessFile;
QFile *brightnessFileAlt; QFile *brightnessFileAlt;
char brightness_str[6]; char brightness_str[6];
int alpha_current_str; int alpha_current_str;
QString bversion; QString bversion;
QString bdate; QString bdate;
char nightModeFile[32] = "/tmp/night_mode_enabled"; char nightModeFile[32] = "/tmp/night_mode_enabled";
char devModeFile[32] = "/tmp/dev_mode_enabled"; char devModeFile[32] = "/tmp/dev_mode_enabled";
char wifiButtonFile[32] = "/etc/button_wifi_visible"; char wifiButtonFile[32] = "/etc/button_wifi_visible";
char cameraButtonFile[32] = "/etc/button_camera_visible"; char cameraButtonFile[32] = "/etc/button_camera_visible";
char brightnessButtonFile[32] = "/etc/button_brightness_visible"; char brightnessButtonFile[32] = "/etc/button_brightness_visible";
char debugModeFile[32] = "/tmp/usb_debug_mode"; char debugModeFile[32] = "/tmp/usb_debug_mode";
char lsFile[32] = "/etc/cs_lightsensor"; char lsFile[32] = "/etc/cs_lightsensor";
char custom_button_file_c1[26] = "/boot/crankshaft/button_1"; char custom_button_file_c1[26] = "/boot/crankshaft/button_1";
char custom_button_file_c2[26] = "/boot/crankshaft/button_2"; char custom_button_file_c2[26] = "/boot/crankshaft/button_2";
char custom_button_file_c3[26] = "/boot/crankshaft/button_3"; char custom_button_file_c3[26] = "/boot/crankshaft/button_3";
char custom_button_file_c4[26] = "/boot/crankshaft/button_4"; char custom_button_file_c4[26] = "/boot/crankshaft/button_4";
char custom_button_file_c5[26] = "/boot/crankshaft/button_5"; char custom_button_file_c5[26] = "/boot/crankshaft/button_5";
char custom_button_file_c6[26] = "/boot/crankshaft/button_6"; char custom_button_file_c6[26] = "/boot/crankshaft/button_6";
QString custom_button_command_c1; QString custom_button_command_c1;
QString custom_button_command_c2; QString custom_button_command_c2;
QString custom_button_command_c3; QString custom_button_command_c3;
QString custom_button_command_c4; QString custom_button_command_c4;
QString custom_button_command_c5; QString custom_button_command_c5;
QString custom_button_command_c6; QString custom_button_command_c6;
QString custom_button_color_c1 = "186,189,192"; QString custom_button_color_c1 = "186,189,192";
QString custom_button_color_c2 = "186,189,192"; QString custom_button_color_c2 = "186,189,192";
QString custom_button_color_c3 = "186,189,192"; QString custom_button_color_c3 = "186,189,192";
QString custom_button_color_c4 = "186,189,192"; QString custom_button_color_c4 = "186,189,192";
QString custom_button_color_c5 = "186,189,192"; QString custom_button_color_c5 = "186,189,192";
QString custom_button_color_c6 = "186,189,192"; QString custom_button_color_c6 = "186,189,192";
QString selectedMp3file; QString selectedMp3file;
QString musicfolder = "/media/CSSTORAGE/Music"; QString musicfolder = "/media/CSSTORAGE/Music";
QString albumfolder = "/"; QString albumfolder = "/";
QString date_text; QString date_text;
QMediaPlaylist *playlist; QMediaPlaylist *playlist;
bool customBrightnessControl = false; bool customBrightnessControl = false;
bool wifiButtonForce = false; bool wifiButtonForce = false;
bool cameraButtonForce = false; bool cameraButtonForce = false;
bool brightnessButtonForce = false; bool brightnessButtonForce = false;
bool nightModeEnabled = false; bool nightModeEnabled = false;
bool DayNightModeState = false; bool DayNightModeState = false;
bool devModeEnabled = false; bool devModeEnabled = false;
bool wallpaperDayFileExists = false; bool wallpaperDayFileExists = false;
bool wallpaperNightFileExists = false; bool wallpaperNightFileExists = false;
bool wallpaperClassicDayFileExists = false; bool wallpaperClassicDayFileExists = false;
bool wallpaperClassicNightFileExists = false; bool wallpaperClassicNightFileExists = false;
bool wallpaperEQFileExists = false; bool wallpaperEQFileExists = false;
bool exitMenuVisible = false; bool exitMenuVisible = false;
bool rearCamEnabled = false; bool rearCamEnabled = false;
bool rearCamVisible = false; bool rearCamVisible = false;
bool dashCamRecording = false; bool dashCamRecording = false;
bool systemDebugmode = false; bool systemDebugmode = false;
bool bluetoothEnabled = false; bool bluetoothEnabled = false;
bool oldGUIStyle = false; bool oldGUIStyle = false;
bool UseBigClock = false; bool UseBigClock = false;
bool NoClock = false; bool NoClock = false;
bool c1ButtonForce = false; bool c1ButtonForce = false;
bool c2ButtonForce = false; bool c2ButtonForce = false;
bool c3ButtonForce = false; bool c3ButtonForce = false;
bool c4ButtonForce = false; bool c4ButtonForce = false;
bool c5ButtonForce = false; bool c5ButtonForce = false;
bool c6ButtonForce = false; bool c6ButtonForce = false;
bool hotspotActive = false; bool hotspotActive = false;
int currentPlaylistIndex = 0; int currentPlaylistIndex = 0;
bool background_set = false; bool background_set = false;
bool mediacontentchanged = true; bool mediacontentchanged = true;
bool lightsensor = false; bool lightsensor = false;
bool holidaybg = false; bool holidaybg = false;
bool csmtupdate = false; bool csmtupdate = false;
bool udevupdate = false; bool udevupdate = false;
bool openautoupdate = false; bool openautoupdate = false;
bool systemupdate = false; bool systemupdate = false;
int camera_ycorection; int camera_ycorection;
int camera_zoom; int camera_zoom;
QBluetoothLocalDevice *localDevice; QBluetoothLocalDevice *localDevice;
protected: protected:
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);
};
};
} }
} }
} }
} }

File diff suppressed because it is too large Load Diff