Audio: more design improvements

This commit is contained in:
Nicolas Mailloux 2023-07-24 22:22:18 -04:00
parent e872cedf3f
commit 96a95de9e1
7 changed files with 60 additions and 11 deletions

View file

@ -16,6 +16,7 @@ audioDialog::audioDialog(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
audioDialog::setFont(QFont("u001")); audioDialog::setFont(QFont("u001"));
ui->fileNameLabel->setFont(QFont("u001"));
progress = new QTimer(this); progress = new QTimer(this);
@ -45,16 +46,16 @@ audioDialog::audioDialog(QWidget *parent) :
int topButtonsSize = 55; int topButtonsSize = 55;
int menuButtonsSize = 80; int menuButtonsSize = 80;
int playButtonsSize = 50; int playBtnsSize = 50;
ui->minusBtn->setIconSize(QSize{topButtonsSize,topButtonsSize}); ui->minusBtn->setIconSize(QSize{topButtonsSize,topButtonsSize});
ui->plusBtn->setIconSize(QSize{topButtonsSize,topButtonsSize}); ui->plusBtn->setIconSize(QSize{topButtonsSize,topButtonsSize});
ui->exitBtn->setIconSize(QSize{topButtonsSize,topButtonsSize}); ui->exitBtn->setIconSize(QSize{topButtonsSize,topButtonsSize});
ui->refreshBtn->setIconSize(QSize{topButtonsSize,topButtonsSize}); ui->refreshBtn->setIconSize(QSize{topButtonsSize,topButtonsSize});
ui->nextBtn->setIconSize(QSize{playButtonsSize,playButtonsSize}); ui->nextBtn->setIconSize(QSize{playBtnsSize,playBtnsSize});
ui->previousBtn->setIconSize(QSize{playButtonsSize,playButtonsSize}); ui->previousBtn->setIconSize(QSize{playBtnsSize,playBtnsSize});
ui->playBtn->setIconSize(QSize{playButtonsSize,playButtonsSize}); ui->playBtn->setIconSize(QSize{playBtnsSize,playBtnsSize});
ui->libraryBtn->setIconSize(QSize{menuButtonsSize,menuButtonsSize}); ui->libraryBtn->setIconSize(QSize{menuButtonsSize,menuButtonsSize});
ui->queueBtn->setIconSize(QSize{menuButtonsSize,menuButtonsSize}); ui->queueBtn->setIconSize(QSize{menuButtonsSize,menuButtonsSize});
@ -150,14 +151,14 @@ void audioDialog::refreshFileList() {
writeFile(".config/e-2-audio/path", "/mnt/onboard/onboard/music/"); writeFile(".config/e-2-audio/path", "/mnt/onboard/onboard/music/");
log("Music config file doesn't exist, creating it", className); log("Music config file doesn't exist, creating it", className);
} }
// For example in this path: /mnt/onboard/onboard/music/ ( with / at the end ) // For example in this path: '/mnt/onboard/onboard/music/' (with '/' at the end)
QString path = readFile(".config/e-2-audio/path").replace("\n", ""); QString path = readFile(".config/e-2-audio/path").replace("\n", "");
log("Path for audio files: '" + path + "'", className); log("Path for audio files: '" + path + "'", className);
QDir dir{path}; QDir dir{path};
// Other file formats could be added, by building more libraries // Other file formats could be added, by building more libraries
// https://github.com/arnavyc/sndfile-alsa-example/blob/main/src/sndfile-alsa.c // https://github.com/arnavyc/sndfile-alsa-example/blob/main/src/sndfile-alsa.c
// https://github.com/libsndfile/libsndfile // https://github.com/libsndfile/libsndfile
// Is it easy to do? Yes. Does it take more space? Yes. Do I care? No, i have this fancy command: // Is it easy to do? Yes. Does it take more space? Yes. Do I care? No, I have this fancy command instead:
// for i in *; do ffmpeg -i "$i" "${i%.*}.wav"; done // for i in *; do ffmpeg -i "$i" "${i%.*}.wav"; done
// (Szybet) // (Szybet)
dir.setNameFilters(QStringList("*.wav")); dir.setNameFilters(QStringList("*.wav"));

View file

@ -160,13 +160,22 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>585</width> <width>585</width>
<height>301</height> <height>299</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin"> <property name="topMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"/> <layout class="QVBoxLayout" name="verticalLayout"/>
</item> </item>

View file

@ -8,6 +8,10 @@ audiofile::audiofile(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
audiofile::setFont(QFont("u001")); audiofile::setFont(QFont("u001"));
ui->nameLabel->setFont(QFont("u001"));
ui->timeLabel->setFont(QFont("u001"));
ui->addBtn->setProperty("type", "borderless");
ui->nameLabel->setWordWrap(true); ui->nameLabel->setWordWrap(true);
} }

View file

@ -76,6 +76,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="addBtn"> <widget class="QPushButton" name="addBtn">
<property name="sizePolicy"> <property name="sizePolicy">

View file

@ -7,6 +7,11 @@ audiofilequeue::audiofilequeue(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
audiofilequeue::setFont(QFont("u001")); audiofilequeue::setFont(QFont("u001"));
ui->nameLabel->setFont(QFont("u001"));
ui->timeLabel->setFont(QFont("u001"));
ui->playBtn->setProperty("type", "borderless");
ui->deleteBtn->setProperty("type", "borderless");
ui->nameLabel->setWordWrap(true); ui->nameLabel->setWordWrap(true);
} }
@ -23,7 +28,7 @@ void audiofilequeue::provideData(global::audio::musicFile fileProvided, bool gra
if(gray == true) { if(gray == true) {
log("Setting background gray", className); log("Setting background gray", className);
ui->deleteBtn->setStyleSheet("background: #aeadac;"); ui->deleteBtn->setStyleSheet("background: #aeadac;");
ui->playButton->setStyleSheet("background: #aeadac;"); ui->playBtn->setStyleSheet("background: #aeadac;");
isPlaying = true; isPlaying = true;
} }
} }
@ -69,7 +74,7 @@ void audiofilequeue::on_deleteBtn_clicked()
global::audio::audioMutex.unlock(); global::audio::audioMutex.unlock();
} }
void audiofilequeue::on_playButton_clicked() void audiofilequeue::on_playBtn_clicked()
{ {
global::audio::audioMutex.lock(); global::audio::audioMutex.lock();
for(int i = 0; i < global::audio::queue.size(); i++) { for(int i = 0; i < global::audio::queue.size(); i++) {

View file

@ -32,7 +32,7 @@ signals:
private slots: private slots:
void on_deleteBtn_clicked(); void on_deleteBtn_clicked();
void on_playButton_clicked(); void on_playBtn_clicked();
}; };
#endif // AUDIOFILEQUEUE_H #endif // AUDIOFILEQUEUE_H

View file

@ -76,6 +76,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="Line" name="line">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="deleteBtn"> <widget class="QPushButton" name="deleteBtn">
<property name="sizePolicy"> <property name="sizePolicy">
@ -94,7 +104,17 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="playButton"> <widget class="Line" name="line_3">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="playBtn">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>