diff --git a/CMakeLists.txt b/CMakeLists.txt index 84039e1..b178fd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,7 @@ find_package(Protobuf REQUIRED) find_package(OpenSSL REQUIRED) find_package(rtaudio REQUIRED) find_package(taglib REQUIRED) +find_package(blkid REQUIRED) if(WIN32) set(WINSOCK2_LIBRARIES "ws2_32") @@ -58,6 +59,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${OPENSSL_INCLUDE_DIR} ${RTAUDIO_INCLUDE_DIRS} ${TAGLIB_INCLUDE_DIRS} + ${BLKID_INCLUDE_DIRS} ${AASDK_PROTO_INCLUDE_DIRS} ${AASDK_INCLUDE_DIRS} ${BCM_HOST_INCLUDE_DIRS} @@ -86,6 +88,7 @@ target_link_libraries(autoapp ${WINSOCK2_LIBRARIES} ${RTAUDIO_LIBRARIES} ${TAGLIB_LIBRARIES} + ${BLKID_LIBRARIES} ${AASDK_PROTO_LIBRARIES} ${AASDK_LIBRARIES}) diff --git a/cmake_modules/Findblkid.cmake b/cmake_modules/Findblkid.cmake new file mode 100644 index 0000000..bed1b17 --- /dev/null +++ b/cmake_modules/Findblkid.cmake @@ -0,0 +1,70 @@ +# +# This file is part of openauto project. +# Copyright (C) 2018 f1x.studio (Michal Szwaj) +# +# openauto is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# openauto is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with openauto. If not, see . +# + +if (BLKID_LIBRARIES AND BLKID_INCLUDE_DIRS) + # in cache already + set(BLKID_FOUND TRUE) +else (BLKID_LIBRARIES AND BLKID_INCLUDE_DIRS) + find_path(BLKID_INCLUDE_DIR + NAMES + blkid.h + PATHS + /usr/include + /usr/local/include + /opt/local/include + /sw/include + PATH_SUFFIXES + blkid + ) + + find_library(BLKID_LIBRARY + NAMES + blkid + PATHS + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib + ) + + set(BLKID_INCLUDE_DIRS + ${BLKID_INCLUDE_DIR} + ) + set(BLKID_LIBRARIES + ${BLKID_LIBRARY} +) + + if (BLKID_INCLUDE_DIRS AND BLKID_LIBRARIES) + set(BLKID_FOUND TRUE) + endif (BLKID_INCLUDE_DIRS AND BLKID_LIBRARIES) + + if (BLKID_FOUND) + if (NOT blkid_FIND_QUIETLY) + message(STATUS "Found blkid:") + message(STATUS " - Includes: ${BLKID_INCLUDE_DIRS}") + message(STATUS " - Libraries: ${BLKID_LIBRARIES}") + endif (NOT blkid_FIND_QUIETLY) + else (BLKID_FOUND) + if (blkid_FIND_REQUIRED) + message(FATAL_ERROR "Could not find blkid") + endif (blkid_FIND_REQUIRED) + endif (BLKID_FOUND) + + mark_as_advanced(BLKID_INCLUDE_DIRS BLKID_LIBRARIES) + +endif (BLKID_LIBRARIES AND BLKID_INCLUDE_DIRS) diff --git a/include/f1x/openauto/autoapp/UI/MainWindow.hpp b/include/f1x/openauto/autoapp/UI/MainWindow.hpp index a37baeb..5c14cd9 100644 --- a/include/f1x/openauto/autoapp/UI/MainWindow.hpp +++ b/include/f1x/openauto/autoapp/UI/MainWindow.hpp @@ -77,6 +77,7 @@ signals: void cameraSave(); void cameraRecord(); void openConnectDialog(); + void openUSBDialog(); void showBrightnessSlider(); void showVolumeSlider(); void showAlphaSlider(); diff --git a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp index 2b89a93..b529d57 100644 --- a/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp +++ b/include/f1x/openauto/autoapp/UI/SettingsWindow.hpp @@ -60,6 +60,7 @@ private slots: void onStartHotspot(); void onStopHotspot(); void syncNTPTime(); + void on_pushButtonRescan_clicked(); private slots: void show_tab1(); @@ -71,9 +72,6 @@ private slots: void show_tab7(); void show_tab8(); - void on_pushButton_clicked(); - void scanSubFolders(); - private: void showEvent(QShowEvent* event); void load(); diff --git a/include/f1x/openauto/autoapp/UI/USBDialog.hpp b/include/f1x/openauto/autoapp/UI/USBDialog.hpp new file mode 100644 index 0000000..0688dbb --- /dev/null +++ b/include/f1x/openauto/autoapp/UI/USBDialog.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include + +namespace Ui { +class USBDialog; +} + +namespace f1x +{ +namespace openauto +{ +namespace autoapp +{ +namespace ui +{ + +class USBDialog : public QDialog +{ + Q_OBJECT + +public: + explicit USBDialog(QWidget *parent = nullptr); + ~USBDialog() override; + + Ui::USBDialog *ui_; + +private slots: + void scanDrives(); + void on_pushButtonMount_clicked(); + void on_pushButtonRemove_clicked(); +}; + +} +} +} +} diff --git a/src/autoapp/Configuration/Configuration.cpp b/src/autoapp/Configuration/Configuration.cpp index bc1275d..42b83a4 100644 --- a/src/autoapp/Configuration/Configuration.cpp +++ b/src/autoapp/Configuration/Configuration.cpp @@ -97,7 +97,7 @@ void Configuration::load() alphaTrans_ = iniConfig.get(cGeneralAlphaTransKey, 50); hideMenuToggle_ = iniConfig.get(cGeneralHideMenuToggleKey, false); hideAlpha_ = iniConfig.get(cGeneralHideAlphaKey, false); - mp3MasterPath_ = iniConfig.get(cGeneralMp3MasterPathKey, "/media/CSSTORAGE/Music"); + mp3MasterPath_ = iniConfig.get(cGeneralMp3MasterPathKey, "/media/MYMEDIA"); mp3SubFolder_ = iniConfig.get(cGeneralMp3SubFolderKey, "/"); videoFPS_ = static_cast(iniConfig.get(cVideoFPSKey, @@ -139,7 +139,7 @@ void Configuration::reset() alphaTrans_ = 50; hideMenuToggle_ = false; hideAlpha_ = false; - mp3MasterPath_ = "/media/CSSTORAGE/Music"; + mp3MasterPath_ = "/media/MYMEDIA"; mp3SubFolder_ = "/"; videoFPS_ = aasdk::proto::enums::VideoFPS::_30; videoResolution_ = aasdk::proto::enums::VideoResolution::_480p; diff --git a/src/autoapp/UI/MainWindow.cpp b/src/autoapp/UI/MainWindow.cpp index d7c62b2..92d5f9a 100644 --- a/src/autoapp/UI/MainWindow.cpp +++ b/src/autoapp/UI/MainWindow.cpp @@ -164,6 +164,8 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi connect(ui_->pushButtonMusic2, &QPushButton::clicked, this, &MainWindow::playerShow); connect(ui_->pushButtonBack, &QPushButton::clicked, this, &MainWindow::playerHide); connect(ui_->pushButtonPlayerBack, &QPushButton::clicked, this, &MainWindow::playerHide); + connect(ui_->pushButtonUSB, &QPushButton::clicked, this, &MainWindow::openUSBDialog); + connect(ui_->pushButtonRescan, &QPushButton::clicked, this, &MainWindow::scanFolders); // by default hide bluetooth button on init ui_->pushButtonBluetooth->hide(); @@ -552,13 +554,19 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi ui_->PlayerPlayingWidget->hide(); ui_->pushButtonPlayerStop->hide(); ui_->pushButtonPlayerPause->hide(); - //this->musicfolder = QString::fromStdString(configuration->getMp3MasterPath()); - //this->albumfolder = QString::fromStdString(configuration->getMp3SubFolder()); - //ui_->labelFolderpath->setText(this->musicfolder); - //ui_->labelAlbumpath->setText(this->albumfolder); + + this->musicfolder = QString::fromStdString(configuration->getMp3MasterPath()); + this->albumfolder = QString::fromStdString(configuration->getMp3SubFolder()); + ui_->labelFolderpath->setText(this->musicfolder); + ui_->labelAlbumpath->setText(this->albumfolder); + ui_->labelFolderpath->hide(); ui_->labelAlbumpath->hide(); + // link possible existing media + system(qPrintable("ln -s /media/CSSTORAGE/Music/* /media/MYMEDIA")); + system(qPrintable("/usr/local/bin/autoapp_helper cleansymlinks")); + MainWindow::scanFolders(); ui_->comboBoxAlbum->setCurrentText(QString::fromStdString(configuration->getMp3SubFolder())); MainWindow::scanFiles(); @@ -1210,6 +1218,7 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonList_clicked() ui_->pushButtonList->hide(); ui_->pushButtonPlayerPlayList->show(); ui_->pushButtonBackToPlayer->show(); + ui_->pushButtonUSB->show(); } void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerStop_clicked() @@ -1228,6 +1237,7 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerStop_clicked() ui_->playerPositionTime->setText("00:00 / 00:00"); ui_->labelCurrentPlaying->setText(""); ui_->labelTrack->setText(""); + ui_->pushButtonUSB->show(); } void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerPause_clicked() @@ -1353,6 +1363,7 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerPlayList_clicked ui_->pushButtonPlayerPause->show(); int currentalbum = ui_->comboBoxAlbum->currentIndex(); ui_->labelCurrentAlbumIndex->setText(QString::number(currentalbum+1)); + ui_->pushButtonUSB->hide(); } void f1x::openauto::autoapp::ui::MainWindow::on_comboBoxAlbum_currentIndexChanged(const QString &arg1) @@ -1476,4 +1487,5 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonBackToPlayer_clicked() ui_->pushButtonBackToPlayer->hide(); ui_->pushButtonPlayerPlayList->hide(); ui_->pushButtonList->show(); + ui_->pushButtonUSB->hide(); } diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index 24994ff..56c216b 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -95,7 +95,7 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat QString time_text_minute=time.toString("mm"); ui_->spinBoxHour->setValue((time_text_hour).toInt()); ui_->spinBoxMinute->setValue((time_text_minute).toInt()); - SettingsWindow::scanSubFolders(); + SettingsWindow::on_pushButtonRescan_clicked(); } SettingsWindow::~SettingsWindow() @@ -113,7 +113,6 @@ void SettingsWindow::onSave() configuration_->setAlphaTrans(static_cast(ui_->horizontalSliderAlphaTrans->value())); configuration_->hideMenuToggle(ui_->checkBoxHideMenuToggle->isChecked()); configuration_->hideAlpha(ui_->checkBoxHideAlpha->isChecked()); - configuration_->setMp3MasterPath(ui_->pathMusicFolder->text().toStdString()); configuration_->setMp3SubFolder(ui_->comboBoxSubFolder->currentText().toStdString()); configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() ? aasdk::proto::enums::VideoFPS::_30 : aasdk::proto::enums::VideoFPS::_60); @@ -291,7 +290,6 @@ void SettingsWindow::load() ui_->checkBoxOldGUI->setChecked(configuration_->oldGUI()); ui_->checkBoxHideMenuToggle->setChecked(configuration_->hideMenuToggle()); ui_->checkBoxHideAlpha->setChecked(configuration_->hideAlpha()); - ui_->pathMusicFolder->setText(QString::fromStdString(configuration_->getMp3MasterPath())); ui_->comboBoxSubFolder->setCurrentText(QString::fromStdString(configuration_->getMp3SubFolder())); ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_30); @@ -836,29 +834,7 @@ void SettingsWindow::show_tab8() } } -void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButton_clicked() -{ - QString folder = QFileDialog::getExistingDirectory(this, tr("Select Music Path"), "/media/CSSTORAGE/Music", QFileDialog::ShowDirsOnly); - if (folder != "") { - ui_->pathMusicFolder->setText(folder); - int cleaner = ui_->comboBoxSubFolder->count(); - // clean and rebuild subfolder box - while (cleaner > -1) { - ui_->comboBoxSubFolder->removeItem(cleaner); - cleaner--; - } - ui_->comboBoxSubFolder->addItem("/"); - QDir directory(ui_->pathMusicFolder->text()); - QStringList folders = directory.entryList(QStringList() << "*", QDir::AllDirs, QDir::Name); - foreach (QString foldername, folders) { - if (foldername != ".." && foldername != ".") { - ui_->comboBoxSubFolder->addItem(foldername); - } - } - } -} - -void f1x::openauto::autoapp::ui::SettingsWindow::scanSubFolders() +void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonRescan_clicked() { int cleaner = ui_->comboBoxSubFolder->count(); // clean and rebuild subfolder box @@ -867,7 +843,7 @@ void f1x::openauto::autoapp::ui::SettingsWindow::scanSubFolders() cleaner--; } ui_->comboBoxSubFolder->addItem("/"); - QDir directory(ui_->pathMusicFolder->text()); + QDir directory("/media/MYMEDIA"); QStringList folders = directory.entryList(QStringList() << "*", QDir::AllDirs, QDir::Name); foreach (QString foldername, folders) { if (foldername != ".." && foldername != ".") { diff --git a/src/autoapp/UI/USBDialog.cpp b/src/autoapp/UI/USBDialog.cpp new file mode 100644 index 0000000..735c254 --- /dev/null +++ b/src/autoapp/UI/USBDialog.cpp @@ -0,0 +1,123 @@ +#include +#include +#include +#include +#include +#include +#include + +namespace f1x +{ +namespace openauto +{ +namespace autoapp +{ +namespace ui +{ + +USBDialog::USBDialog(QWidget *parent) + : QDialog(parent) + , ui_(new Ui::USBDialog) +{ + ui_->setupUi(this); + connect(ui_->pushButtonClose, &QPushButton::clicked, this, &USBDialog::close); + connect(ui_->pushButtonUpdate, &QPushButton::clicked, this, &USBDialog::scanDrives); + scanDrives(); +} + +USBDialog::~USBDialog() +{ + delete ui_; +} + +} +} +} +} + +void f1x::openauto::autoapp::ui::USBDialog::scanDrives() +{ + int currentdevice = 0; + int cleaner = ui_->listWidgetUSB->count(); + while (cleaner > -1) { + ui_->listWidgetUSB->takeItem(cleaner); + cleaner--; + } + ui_->listWidgetUSB->clear(); + + QFile partitionsFile(QString("/proc/partitions")); + partitionsFile.open(QIODevice::ReadOnly); + QTextStream data_return(&partitionsFile); + QStringList localpartitions; + localpartitions = data_return.readAll().split("\n"); + partitionsFile.close(); + + while (currentdevice < localpartitions.count()-1) { + QString line = localpartitions[currentdevice].simplified(); + QString device = line.split(" ")[3]; + + // filter partition list for drives - not nice but working + if (!device.startsWith("ram") && !device.startsWith("name") && !device.startsWith("mmc") && device != "") { + if (!device.endsWith("0") && !device.endsWith("1") && !device.endsWith("2") && !device.endsWith("3") && !device.endsWith("4") && !device.endsWith("5") && !device.endsWith("6") && !device.endsWith("7") && !device.endsWith("8") && !device.endsWith("9")) { + device = "/dev/" + device; + const char *dev_base_name = QString(device).toStdString().c_str(); + blkid_probe pr = blkid_new_probe_from_filename(dev_base_name); + blkid_partlist ls; + int nparts, i=1; + ls = blkid_probe_get_partitions(pr); + nparts = blkid_partlist_numof_partitions(ls); + + const char *label; + const char *type; + const char *mounted; + + while (i <= nparts) { + QString partitionpath = QString(device) + QString::number(i); + const char *dev_name = QString(partitionpath).toStdString().c_str(); + pr = blkid_new_probe_from_filename(dev_name); + blkid_do_probe(pr); + blkid_probe_lookup_value(pr, "LABEL", &label, nullptr); + blkid_probe_lookup_value(pr, "TYPE", &type, nullptr); + // exclude CSSTORAGE cause mounted another way by system service + if (QString::fromStdString(label) != "CSSTORAGE") { + // check mount state + if (system(qPrintable("mount | grep " + partitionpath + " >/dev/null")) != 0) { + mounted = "unmounted"; + } else { + mounted = "mounted"; + } + ui_->listWidgetUSB->addItem(QString::fromStdString(dev_name) + " (" + QString::fromStdString(label) + " / " + QString::fromStdString(type) + " | " + QString::fromStdString(mounted) + ")"); + ui_->listWidgetUSB->update(); + } + i++; + } + blkid_free_probe(pr); + } + } + currentdevice++; + } + system("/usr/local/bin/autoapp_helper cleansymlinks &"); +} + +void f1x::openauto::autoapp::ui::USBDialog::on_pushButtonMount_clicked() +{ + QString selected = ui_->listWidgetUSB->item(ui_->listWidgetUSB->currentRow())->text(); + QString mountfulldevicepath = selected.split(" ")[0]; + QString mountdevice = mountfulldevicepath.split("/")[2]; + system(qPrintable("sudo umount " + mountfulldevicepath)); + system(qPrintable("sudo mkdir -p /media/MYMEDIA")); + system(qPrintable("sudo chmod 777 /media/MYMEDIA")); + system(qPrintable("sudo mkdir -p /media/" + mountdevice)); + system(qPrintable("sudo chmod 777 /media/" + mountdevice)); + system(qPrintable("sudo mount " + mountfulldevicepath + " /media/" + mountdevice)); + system(qPrintable("ln -s /media/" + mountdevice + "/Music/* /media/MYMEDIA")); + scanDrives(); +} + +void f1x::openauto::autoapp::ui::USBDialog::on_pushButtonRemove_clicked() +{ + QString selected = ui_->listWidgetUSB->item(ui_->listWidgetUSB->currentRow())->text(); + QString mountfulldevicepath = selected.split(" ")[0]; + system(qPrintable("sudo umount " + mountfulldevicepath)); + scanDrives(); +} diff --git a/src/autoapp/UI/mainwindow.ui b/src/autoapp/UI/mainwindow.ui index ad3c08c..db64329 100644 --- a/src/autoapp/UI/mainwindow.ui +++ b/src/autoapp/UI/mainwindow.ui @@ -6,7 +6,7 @@ 0 0 - 907 + 1011 1295 @@ -2190,6 +2190,149 @@ heigth: 45px; 0 + + + + 2 + + + + + + 0 + 0 + + + + + 0 + 45 + + + + + 16777215 + 45 + + + + + 0 + 45 + + + + + 14 + 75 + true + + + + Qt::DefaultContextMenu + + + QComboBox { + background-color: rgba(117, 80, 123, 0.9); + color: rgb(255, 255, 255); + border: 2px solid rgba(255,255,255,0.5); + outline: none; + height: 40px; +} + +QComboBox::drop-down { + width: 40px; + color: rgb(255, 255, 255); +} + +QScrollBar { + width: 40px; + background-color: rgba(117, 80, 123, 0.9); +} + + + + QComboBox::AdjustToContents + + + true + + + + Neues Element + + + + + Neues Element + + + + + Neues Element + + + + + Neues Element + + + + + Neues Element + + + + + Neues Element + + + + + Neues Element + + + + + + + + + 100 + 45 + + + + + 100 + 45 + + + + background-color: rgba(117, 80, 123, 0.9); +color: rgb(0, 0, 0); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +outline: none; + + + + + + + :/reboot-hot.png + + + + + 32 + 32 + + + + + + @@ -2260,105 +2403,6 @@ border: 2px solid rgba(255,255,255,0.5); - - - - - 0 - 0 - - - - - 0 - 45 - - - - - 16777215 - 45 - - - - - 0 - 45 - - - - - 14 - 75 - true - - - - Qt::DefaultContextMenu - - - QComboBox { - background-color: rgba(117, 80, 123, 0.9); - color: rgb(255, 255, 255); - border: 2px solid rgba(255,255,255,0.5); - outline: none; - height: 40px; -} - -QComboBox::drop-down { - width: 40px; - color: rgb(255, 255, 255); -} - -QScrollBar { - width: 40px; - background-color: rgba(117, 80, 123, 0.9); -} - - - - QComboBox::AdjustToContents - - - true - - - - Neues Element - - - - - Neues Element - - - - - Neues Element - - - - - Neues Element - - - - - Neues Element - - - - - Neues Element - - - - - Neues Element - - - - @@ -3401,6 +3445,45 @@ outline: none; + + + + + 0 + 0 + + + + + 0 + 40 + + + + + 16777215 + 40 + + + + + 12 + 75 + true + + + + background-color: rgba(186, 189, 182, 0.7); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); +outline: none; + + + USB + + + diff --git a/src/autoapp/UI/settingswindow.ui b/src/autoapp/UI/settingswindow.ui index 7f59bc4..6b67333 100644 --- a/src/autoapp/UI/settingswindow.ui +++ b/src/autoapp/UI/settingswindow.ui @@ -7,7 +7,7 @@ 0 0 800 - 3106 + 3076 @@ -430,13 +430,7 @@ outline: none; 2 - - - - 0 - 0 - - + 140 @@ -454,67 +448,11 @@ outline: none; outline: none; - Master music path + Rescan Folders - - - - 0 - 0 - - - - - 0 - 24 - - - - - 16777215 - 24 - - - - background-color: rgb(85, 87, 83); - - - QFrame::NoFrame - - - /media/CSSTORAGE/Music - - - - - - - - 0 - 0 - - - - - 140 - 24 - - - - - 140 - 24 - - - - Subfolder (Album) - - - - @@ -542,62 +480,65 @@ outline: none; + + + + 9 + + + 2 + + + 9 + + + 2 + + + + + + 0 + 0 + + + + + 30 + 30 + + + + <html><head/><body><p><img src=":/ico_warning.png"/></p></body></html> + + + + + + + + 0 + 0 + + + + + true + + + + If you select a subfolder the player will start with listing the files inside this folder (on system start). By default folders inside CSSTORAGE/Music are listed. You can mount removable devices inside player dialog! + + + true + + + + + - - - - 9 - - - 2 - - - 9 - - - 2 - - - - - - 0 - 0 - - - - - 30 - 30 - - - - <html><head/><body><p><img src=":/ico_warning.png"/></p></body></html> - - - - - - - - 0 - 0 - - - - - true - - - - If you select a subfolder the player will start with listing the files inside this folder (on system start) - - - - - diff --git a/src/autoapp/UI/usbdialog.ui b/src/autoapp/UI/usbdialog.ui new file mode 100644 index 0000000..fe60527 --- /dev/null +++ b/src/autoapp/UI/usbdialog.ui @@ -0,0 +1,285 @@ + + + USBDialog + + + + 0 + 0 + 500 + 306 + + + + + 0 + 0 + + + + + 500 + 300 + + + + Connect to device + + + background-color: rgb(46, 52, 54); +color: rgb(255, 255, 255); + + + + + + + 0 + 0 + + + + + 0 + 100 + + + + USB Device List + + + + 9 + + + + + + 0 + 0 + + + + + 0 + 100 + + + + + 14 + 75 + true + + + + QScrollBar { + width: 40px; + background-color: rgba(85, 87, 83, 0.7); +} + +QWidget { +background-color: rgba(85, 87, 83, 0.7); +color: rgb(255, 255, 255); +border: 2px solid rgba(255,255,255,0.5); +outline: none; +} + +QListView { + height: 40px; +} + + + 16 + + + QAbstractItemView::NoEditTriggers + + + + 0 + 40 + + + + 100 + + + true + + + + + + + + + + + 0 + 0 + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + 75 + true + + + + background-color: rgba(186, 189, 182, 0.5); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + Refresh + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + 75 + true + + + + background-color: rgba(138, 226, 52, 0.5); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + Mount + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + 0 + 0 + + + + + 75 + true + + + + background-color: rgba(164, 0, 0, 0.5); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + Unmount + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 30 + + + + + 75 + true + + + + background-color: rgba(186, 189, 182, 0.5); +border-radius: 4px; +border: 2px solid rgba(255,255,255,0.5); +color: rgb(255, 255, 255); + + + Close + + + + + + + + + + + diff --git a/src/autoapp/autoapp.cpp b/src/autoapp/autoapp.cpp index ca6f173..0135bf0 100644 --- a/src/autoapp/autoapp.cpp +++ b/src/autoapp/autoapp.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include namespace aasdk = f1x::aasdk; @@ -103,6 +104,11 @@ int main(int argc, char* argv[]) autoapp::configuration::RecentAddressesList recentAddressesList(7); recentAddressesList.read(); + autoapp::ui::USBDialog usbDialog; + usbDialog.setWindowFlags(Qt::WindowStaysOnTopHint); + // center dialog + usbDialog.move((width - 500)/2,(height-306)/2); + aasdk::tcp::TCPWrapper tcpWrapper; autoapp::ui::ConnectDialog connectDialog(ioService, tcpWrapper, recentAddressesList); connectDialog.setWindowFlags(Qt::WindowStaysOnTopHint); @@ -114,6 +120,7 @@ int main(int argc, char* argv[]) QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::showFullScreen); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::loadSystemValues); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openConnectDialog, &connectDialog, &autoapp::ui::ConnectDialog::exec); + QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openUSBDialog, &usbDialog, &autoapp::ui::USBDialog::exec); qApplication.setOverrideCursor(Qt::BlankCursor); QObject::connect(&mainWindow, &autoapp::ui::MainWindow::toggleCursor, [&qApplication]() {