Rework for usb drive handling
This commit is contained in:
parent
5234599c90
commit
2f387c6096
@ -34,6 +34,7 @@ find_package(Protobuf REQUIRED)
|
|||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
find_package(rtaudio REQUIRED)
|
find_package(rtaudio REQUIRED)
|
||||||
find_package(taglib REQUIRED)
|
find_package(taglib REQUIRED)
|
||||||
|
find_package(blkid REQUIRED)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(WINSOCK2_LIBRARIES "ws2_32")
|
set(WINSOCK2_LIBRARIES "ws2_32")
|
||||||
@ -58,6 +59,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
|
|||||||
${OPENSSL_INCLUDE_DIR}
|
${OPENSSL_INCLUDE_DIR}
|
||||||
${RTAUDIO_INCLUDE_DIRS}
|
${RTAUDIO_INCLUDE_DIRS}
|
||||||
${TAGLIB_INCLUDE_DIRS}
|
${TAGLIB_INCLUDE_DIRS}
|
||||||
|
${BLKID_INCLUDE_DIRS}
|
||||||
${AASDK_PROTO_INCLUDE_DIRS}
|
${AASDK_PROTO_INCLUDE_DIRS}
|
||||||
${AASDK_INCLUDE_DIRS}
|
${AASDK_INCLUDE_DIRS}
|
||||||
${BCM_HOST_INCLUDE_DIRS}
|
${BCM_HOST_INCLUDE_DIRS}
|
||||||
@ -86,6 +88,7 @@ target_link_libraries(autoapp
|
|||||||
${WINSOCK2_LIBRARIES}
|
${WINSOCK2_LIBRARIES}
|
||||||
${RTAUDIO_LIBRARIES}
|
${RTAUDIO_LIBRARIES}
|
||||||
${TAGLIB_LIBRARIES}
|
${TAGLIB_LIBRARIES}
|
||||||
|
${BLKID_LIBRARIES}
|
||||||
${AASDK_PROTO_LIBRARIES}
|
${AASDK_PROTO_LIBRARIES}
|
||||||
${AASDK_LIBRARIES})
|
${AASDK_LIBRARIES})
|
||||||
|
|
||||||
|
70
cmake_modules/Findblkid.cmake
Normal file
70
cmake_modules/Findblkid.cmake
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
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)
|
@ -77,6 +77,7 @@ signals:
|
|||||||
void cameraSave();
|
void cameraSave();
|
||||||
void cameraRecord();
|
void cameraRecord();
|
||||||
void openConnectDialog();
|
void openConnectDialog();
|
||||||
|
void openUSBDialog();
|
||||||
void showBrightnessSlider();
|
void showBrightnessSlider();
|
||||||
void showVolumeSlider();
|
void showVolumeSlider();
|
||||||
void showAlphaSlider();
|
void showAlphaSlider();
|
||||||
|
@ -60,6 +60,7 @@ private slots:
|
|||||||
void onStartHotspot();
|
void onStartHotspot();
|
||||||
void onStopHotspot();
|
void onStopHotspot();
|
||||||
void syncNTPTime();
|
void syncNTPTime();
|
||||||
|
void on_pushButtonRescan_clicked();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void show_tab1();
|
void show_tab1();
|
||||||
@ -71,9 +72,6 @@ private slots:
|
|||||||
void show_tab7();
|
void show_tab7();
|
||||||
void show_tab8();
|
void show_tab8();
|
||||||
|
|
||||||
void on_pushButton_clicked();
|
|
||||||
void scanSubFolders();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void showEvent(QShowEvent* event);
|
void showEvent(QShowEvent* event);
|
||||||
void load();
|
void load();
|
||||||
|
37
include/f1x/openauto/autoapp/UI/USBDialog.hpp
Normal file
37
include/f1x/openauto/autoapp/UI/USBDialog.hpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
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();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -97,7 +97,7 @@ void Configuration::load()
|
|||||||
alphaTrans_ = iniConfig.get<size_t>(cGeneralAlphaTransKey, 50);
|
alphaTrans_ = iniConfig.get<size_t>(cGeneralAlphaTransKey, 50);
|
||||||
hideMenuToggle_ = iniConfig.get<bool>(cGeneralHideMenuToggleKey, false);
|
hideMenuToggle_ = iniConfig.get<bool>(cGeneralHideMenuToggleKey, false);
|
||||||
hideAlpha_ = iniConfig.get<bool>(cGeneralHideAlphaKey, false);
|
hideAlpha_ = iniConfig.get<bool>(cGeneralHideAlphaKey, false);
|
||||||
mp3MasterPath_ = iniConfig.get<std::string>(cGeneralMp3MasterPathKey, "/media/CSSTORAGE/Music");
|
mp3MasterPath_ = iniConfig.get<std::string>(cGeneralMp3MasterPathKey, "/media/MYMEDIA");
|
||||||
mp3SubFolder_ = iniConfig.get<std::string>(cGeneralMp3SubFolderKey, "/");
|
mp3SubFolder_ = iniConfig.get<std::string>(cGeneralMp3SubFolderKey, "/");
|
||||||
|
|
||||||
videoFPS_ = static_cast<aasdk::proto::enums::VideoFPS::Enum>(iniConfig.get<uint32_t>(cVideoFPSKey,
|
videoFPS_ = static_cast<aasdk::proto::enums::VideoFPS::Enum>(iniConfig.get<uint32_t>(cVideoFPSKey,
|
||||||
@ -139,7 +139,7 @@ void Configuration::reset()
|
|||||||
alphaTrans_ = 50;
|
alphaTrans_ = 50;
|
||||||
hideMenuToggle_ = false;
|
hideMenuToggle_ = false;
|
||||||
hideAlpha_ = false;
|
hideAlpha_ = false;
|
||||||
mp3MasterPath_ = "/media/CSSTORAGE/Music";
|
mp3MasterPath_ = "/media/MYMEDIA";
|
||||||
mp3SubFolder_ = "/";
|
mp3SubFolder_ = "/";
|
||||||
videoFPS_ = aasdk::proto::enums::VideoFPS::_30;
|
videoFPS_ = aasdk::proto::enums::VideoFPS::_30;
|
||||||
videoResolution_ = aasdk::proto::enums::VideoResolution::_480p;
|
videoResolution_ = aasdk::proto::enums::VideoResolution::_480p;
|
||||||
|
@ -164,6 +164,8 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
|||||||
connect(ui_->pushButtonMusic2, &QPushButton::clicked, this, &MainWindow::playerShow);
|
connect(ui_->pushButtonMusic2, &QPushButton::clicked, this, &MainWindow::playerShow);
|
||||||
connect(ui_->pushButtonBack, &QPushButton::clicked, this, &MainWindow::playerHide);
|
connect(ui_->pushButtonBack, &QPushButton::clicked, this, &MainWindow::playerHide);
|
||||||
connect(ui_->pushButtonPlayerBack, &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
|
// by default hide bluetooth button on init
|
||||||
ui_->pushButtonBluetooth->hide();
|
ui_->pushButtonBluetooth->hide();
|
||||||
@ -552,13 +554,19 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
|||||||
ui_->PlayerPlayingWidget->hide();
|
ui_->PlayerPlayingWidget->hide();
|
||||||
ui_->pushButtonPlayerStop->hide();
|
ui_->pushButtonPlayerStop->hide();
|
||||||
ui_->pushButtonPlayerPause->hide();
|
ui_->pushButtonPlayerPause->hide();
|
||||||
//this->musicfolder = QString::fromStdString(configuration->getMp3MasterPath());
|
|
||||||
//this->albumfolder = QString::fromStdString(configuration->getMp3SubFolder());
|
this->musicfolder = QString::fromStdString(configuration->getMp3MasterPath());
|
||||||
//ui_->labelFolderpath->setText(this->musicfolder);
|
this->albumfolder = QString::fromStdString(configuration->getMp3SubFolder());
|
||||||
//ui_->labelAlbumpath->setText(this->albumfolder);
|
ui_->labelFolderpath->setText(this->musicfolder);
|
||||||
|
ui_->labelAlbumpath->setText(this->albumfolder);
|
||||||
|
|
||||||
ui_->labelFolderpath->hide();
|
ui_->labelFolderpath->hide();
|
||||||
ui_->labelAlbumpath->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();
|
MainWindow::scanFolders();
|
||||||
ui_->comboBoxAlbum->setCurrentText(QString::fromStdString(configuration->getMp3SubFolder()));
|
ui_->comboBoxAlbum->setCurrentText(QString::fromStdString(configuration->getMp3SubFolder()));
|
||||||
MainWindow::scanFiles();
|
MainWindow::scanFiles();
|
||||||
@ -1210,6 +1218,7 @@ void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonList_clicked()
|
|||||||
ui_->pushButtonList->hide();
|
ui_->pushButtonList->hide();
|
||||||
ui_->pushButtonPlayerPlayList->show();
|
ui_->pushButtonPlayerPlayList->show();
|
||||||
ui_->pushButtonBackToPlayer->show();
|
ui_->pushButtonBackToPlayer->show();
|
||||||
|
ui_->pushButtonUSB->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerStop_clicked()
|
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_->playerPositionTime->setText("00:00 / 00:00");
|
||||||
ui_->labelCurrentPlaying->setText("");
|
ui_->labelCurrentPlaying->setText("");
|
||||||
ui_->labelTrack->setText("");
|
ui_->labelTrack->setText("");
|
||||||
|
ui_->pushButtonUSB->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void f1x::openauto::autoapp::ui::MainWindow::on_pushButtonPlayerPause_clicked()
|
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();
|
ui_->pushButtonPlayerPause->show();
|
||||||
int currentalbum = ui_->comboBoxAlbum->currentIndex();
|
int currentalbum = ui_->comboBoxAlbum->currentIndex();
|
||||||
ui_->labelCurrentAlbumIndex->setText(QString::number(currentalbum+1));
|
ui_->labelCurrentAlbumIndex->setText(QString::number(currentalbum+1));
|
||||||
|
ui_->pushButtonUSB->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void f1x::openauto::autoapp::ui::MainWindow::on_comboBoxAlbum_currentIndexChanged(const QString &arg1)
|
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_->pushButtonBackToPlayer->hide();
|
||||||
ui_->pushButtonPlayerPlayList->hide();
|
ui_->pushButtonPlayerPlayList->hide();
|
||||||
ui_->pushButtonList->show();
|
ui_->pushButtonList->show();
|
||||||
|
ui_->pushButtonUSB->hide();
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ SettingsWindow::SettingsWindow(configuration::IConfiguration::Pointer configurat
|
|||||||
QString time_text_minute=time.toString("mm");
|
QString time_text_minute=time.toString("mm");
|
||||||
ui_->spinBoxHour->setValue((time_text_hour).toInt());
|
ui_->spinBoxHour->setValue((time_text_hour).toInt());
|
||||||
ui_->spinBoxMinute->setValue((time_text_minute).toInt());
|
ui_->spinBoxMinute->setValue((time_text_minute).toInt());
|
||||||
SettingsWindow::scanSubFolders();
|
SettingsWindow::on_pushButtonRescan_clicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsWindow::~SettingsWindow()
|
SettingsWindow::~SettingsWindow()
|
||||||
@ -113,7 +113,6 @@ void SettingsWindow::onSave()
|
|||||||
configuration_->setAlphaTrans(static_cast<size_t>(ui_->horizontalSliderAlphaTrans->value()));
|
configuration_->setAlphaTrans(static_cast<size_t>(ui_->horizontalSliderAlphaTrans->value()));
|
||||||
configuration_->hideMenuToggle(ui_->checkBoxHideMenuToggle->isChecked());
|
configuration_->hideMenuToggle(ui_->checkBoxHideMenuToggle->isChecked());
|
||||||
configuration_->hideAlpha(ui_->checkBoxHideAlpha->isChecked());
|
configuration_->hideAlpha(ui_->checkBoxHideAlpha->isChecked());
|
||||||
configuration_->setMp3MasterPath(ui_->pathMusicFolder->text().toStdString());
|
|
||||||
configuration_->setMp3SubFolder(ui_->comboBoxSubFolder->currentText().toStdString());
|
configuration_->setMp3SubFolder(ui_->comboBoxSubFolder->currentText().toStdString());
|
||||||
|
|
||||||
configuration_->setVideoFPS(ui_->radioButton30FPS->isChecked() ? aasdk::proto::enums::VideoFPS::_30 : aasdk::proto::enums::VideoFPS::_60);
|
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_->checkBoxOldGUI->setChecked(configuration_->oldGUI());
|
||||||
ui_->checkBoxHideMenuToggle->setChecked(configuration_->hideMenuToggle());
|
ui_->checkBoxHideMenuToggle->setChecked(configuration_->hideMenuToggle());
|
||||||
ui_->checkBoxHideAlpha->setChecked(configuration_->hideAlpha());
|
ui_->checkBoxHideAlpha->setChecked(configuration_->hideAlpha());
|
||||||
ui_->pathMusicFolder->setText(QString::fromStdString(configuration_->getMp3MasterPath()));
|
|
||||||
ui_->comboBoxSubFolder->setCurrentText(QString::fromStdString(configuration_->getMp3SubFolder()));
|
ui_->comboBoxSubFolder->setCurrentText(QString::fromStdString(configuration_->getMp3SubFolder()));
|
||||||
|
|
||||||
ui_->radioButton30FPS->setChecked(configuration_->getVideoFPS() == aasdk::proto::enums::VideoFPS::_30);
|
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()
|
void f1x::openauto::autoapp::ui::SettingsWindow::on_pushButtonRescan_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()
|
|
||||||
{
|
{
|
||||||
int cleaner = ui_->comboBoxSubFolder->count();
|
int cleaner = ui_->comboBoxSubFolder->count();
|
||||||
// clean and rebuild subfolder box
|
// clean and rebuild subfolder box
|
||||||
@ -867,7 +843,7 @@ void f1x::openauto::autoapp::ui::SettingsWindow::scanSubFolders()
|
|||||||
cleaner--;
|
cleaner--;
|
||||||
}
|
}
|
||||||
ui_->comboBoxSubFolder->addItem("/");
|
ui_->comboBoxSubFolder->addItem("/");
|
||||||
QDir directory(ui_->pathMusicFolder->text());
|
QDir directory("/media/MYMEDIA");
|
||||||
QStringList folders = directory.entryList(QStringList() << "*", QDir::AllDirs, QDir::Name);
|
QStringList folders = directory.entryList(QStringList() << "*", QDir::AllDirs, QDir::Name);
|
||||||
foreach (QString foldername, folders) {
|
foreach (QString foldername, folders) {
|
||||||
if (foldername != ".." && foldername != ".") {
|
if (foldername != ".." && foldername != ".") {
|
||||||
|
123
src/autoapp/UI/USBDialog.cpp
Normal file
123
src/autoapp/UI/USBDialog.cpp
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
#include <QMessageBox>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <f1x/openauto/autoapp/UI/USBDialog.hpp>
|
||||||
|
#include <ui_usbdialog.h>
|
||||||
|
#include <libusb.h>
|
||||||
|
#include <blkid/blkid.h>
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>907</width>
|
<width>1011</width>
|
||||||
<height>1295</height>
|
<height>1295</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -2191,75 +2191,10 @@ heigth: 45px;</string>
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="labelFolderpath">
|
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||||
<property name="sizePolicy">
|
<property name="spacing">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<number>2</number>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>8</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: rgba(85, 87, 83, 0.7);
|
|
||||||
color: rgb(255, 255, 255);
|
|
||||||
border: 2px solid rgba(255,255,255,0.5);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="labelAlbumpath">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>8</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: rgba(85, 87, 83, 0.7);
|
|
||||||
color: rgb(255, 255, 255);
|
|
||||||
border: 2px solid rgba(255,255,255,0.5);</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBoxAlbum">
|
<widget class="QComboBox" name="comboBoxAlbum">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -2359,6 +2294,115 @@ QScrollBar {
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonRescan">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>45</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>45</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">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;</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normalon>:/reboot-hot.png</normalon>
|
||||||
|
</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelFolderpath">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>8</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgba(85, 87, 83, 0.7);
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
border: 2px solid rgba(255,255,255,0.5);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelAlbumpath">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>8</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgba(85, 87, 83, 0.7);
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
border: 2px solid rgba(255,255,255,0.5);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="mp3List">
|
<widget class="QListWidget" name="mp3List">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@ -3401,6 +3445,45 @@ outline: none;
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonUSB">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="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;</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>USB</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButtonPlayerBack">
|
<widget class="QPushButton" name="pushButtonPlayerBack">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>800</width>
|
||||||
<height>3106</height>
|
<height>3076</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -430,13 +430,7 @@ outline: none;
|
|||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QPushButton" name="pushButtonRescan">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
@ -454,67 +448,11 @@ outline: none;
|
|||||||
outline: none;</string>
|
outline: none;</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Master music path</string>
|
<string>Rescan Folders</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QLabel" name="pathMusicFolder">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true">background-color: rgb(85, 87, 83);</string>
|
|
||||||
</property>
|
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::NoFrame</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>/media/CSSTORAGE/Music</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="labelSubfolder">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>140</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>140</width>
|
|
||||||
<height>24</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string> Subfolder (Album)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="comboBoxSubFolder">
|
<widget class="QComboBox" name="comboBoxSubFolder">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
@ -542,10 +480,7 @@ outline: none;</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="1" column="0" colspan="2">
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QFormLayout" name="formLayout_8">
|
<layout class="QFormLayout" name="formLayout_8">
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
@ -592,12 +527,18 @@ outline: none;</string>
|
|||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>If you select a subfolder the player will start with listing the files inside this folder (on system start)</string>
|
<string>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!</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBoxAlpha">
|
<widget class="QGroupBox" name="groupBoxAlpha">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
285
src/autoapp/UI/usbdialog.ui
Normal file
285
src/autoapp/UI/usbdialog.ui
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>USBDialog</class>
|
||||||
|
<widget class="QDialog" name="USBDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>500</width>
|
||||||
|
<height>306</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>500</width>
|
||||||
|
<height>300</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Connect to device</string>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">background-color: rgb(46, 52, 54);
|
||||||
|
color: rgb(255, 255, 255);</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBoxUSB">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>100</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>USB Device List</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QListWidget" name="listWidgetUSB">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>100</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="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;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoScrollMargin">
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
<property name="editTriggers">
|
||||||
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
|
</property>
|
||||||
|
<property name="gridSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="batchSize">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="sortingEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="horizontalWidget" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonUpdate">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="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);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Refresh</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonMount">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="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);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Mount</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonRemove">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="baseSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="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);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Unmount</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButtonClose">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>30</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="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);</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Close</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -34,6 +34,7 @@
|
|||||||
#include <f1x/openauto/autoapp/UI/MainWindow.hpp>
|
#include <f1x/openauto/autoapp/UI/MainWindow.hpp>
|
||||||
#include <f1x/openauto/autoapp/UI/SettingsWindow.hpp>
|
#include <f1x/openauto/autoapp/UI/SettingsWindow.hpp>
|
||||||
#include <f1x/openauto/autoapp/UI/ConnectDialog.hpp>
|
#include <f1x/openauto/autoapp/UI/ConnectDialog.hpp>
|
||||||
|
#include <f1x/openauto/autoapp/UI/USBDialog.hpp>
|
||||||
#include <f1x/openauto/Common/Log.hpp>
|
#include <f1x/openauto/Common/Log.hpp>
|
||||||
|
|
||||||
namespace aasdk = f1x::aasdk;
|
namespace aasdk = f1x::aasdk;
|
||||||
@ -103,6 +104,11 @@ int main(int argc, char* argv[])
|
|||||||
autoapp::configuration::RecentAddressesList recentAddressesList(7);
|
autoapp::configuration::RecentAddressesList recentAddressesList(7);
|
||||||
recentAddressesList.read();
|
recentAddressesList.read();
|
||||||
|
|
||||||
|
autoapp::ui::USBDialog usbDialog;
|
||||||
|
usbDialog.setWindowFlags(Qt::WindowStaysOnTopHint);
|
||||||
|
// center dialog
|
||||||
|
usbDialog.move((width - 500)/2,(height-306)/2);
|
||||||
|
|
||||||
aasdk::tcp::TCPWrapper tcpWrapper;
|
aasdk::tcp::TCPWrapper tcpWrapper;
|
||||||
autoapp::ui::ConnectDialog connectDialog(ioService, tcpWrapper, recentAddressesList);
|
autoapp::ui::ConnectDialog connectDialog(ioService, tcpWrapper, recentAddressesList);
|
||||||
connectDialog.setWindowFlags(Qt::WindowStaysOnTopHint);
|
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::showFullScreen);
|
||||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::loadSystemValues);
|
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::openConnectDialog, &connectDialog, &autoapp::ui::ConnectDialog::exec);
|
||||||
|
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openUSBDialog, &usbDialog, &autoapp::ui::USBDialog::exec);
|
||||||
|
|
||||||
qApplication.setOverrideCursor(Qt::BlankCursor);
|
qApplication.setOverrideCursor(Qt::BlankCursor);
|
||||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::toggleCursor, [&qApplication]() {
|
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::toggleCursor, [&qApplication]() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user