summaryrefslogtreecommitdiffstats
path: root/configurationdialog.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2017-11-30 13:27:22 +0100
committerArno <arno@disconnect.de>2017-11-30 13:27:22 +0100
commit3b245ac50acb24421ad582b7539c7e6a474957d6 (patch)
tree0373a6e336d5504f278cf4dddc73513062e4361d /configurationdialog.cpp
parentf193d63e4d5ac4e3dd62f4e8447bb311668849d8 (diff)
downloadBeetPlayer-3b245ac50acb24421ad582b7539c7e6a474957d6.tar.gz
BeetPlayer-3b245ac50acb24421ad582b7539c7e6a474957d6.tar.bz2
BeetPlayer-3b245ac50acb24421ad582b7539c7e6a474957d6.zip
Add new config option: Scan directory
Does nothing yet. Intended to scan a subdirectory for audio files instead of using beet ls.
Diffstat (limited to 'configurationdialog.cpp')
-rw-r--r--configurationdialog.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/configurationdialog.cpp b/configurationdialog.cpp
index 58e33e8..35faf85 100644
--- a/configurationdialog.cpp
+++ b/configurationdialog.cpp
@@ -7,6 +7,8 @@
#include <QSettings>
#include <QColorDialog>
#include <QSignalMapper>
+#include <QGroupBox>
+#include <QRadioButton>
#include "configurationdialog.h"
#include "helper.h"
@@ -75,11 +77,32 @@ ConfigurationDialog::ConfigurationDialog(QWidget *parent, Qt::WindowFlags f) : Q
connect(altColorB, &QPushButton::clicked, colorMapper, static_cast<void(QSignalMapper::*)()>(&QSignalMapper::map));
connect(colorMapper, static_cast<void(QSignalMapper::*)(QWidget*)>(&QSignalMapper::mapped), this, &ConfigurationDialog::chooseColor);
+ //scan mode
+ QWidget *scanModeWidget = new QWidget;
+ QGroupBox *scanGB = new QGroupBox(tr("Scan Mode"));
+ mUseBeetRB = new QRadioButton(tr("Use beet ls"));
+ QRadioButton *scanDirRB = new QRadioButton(tr("Scan directory"));
+ scanDirRB->setChecked(true);
+ QHBoxLayout *scanGBL = new QHBoxLayout;
+ scanGBL->addWidget(mUseBeetRB);
+ scanGBL->addWidget(scanDirRB);
+ scanGB->setLayout(scanGBL);
+ QGridLayout *scanDirL = new QGridLayout;
+ mScanDir = new QLineEdit;
+ scanDirL->addWidget(new QLabel(tr("Dir to scan")), 0, 0);
+ scanDirL->addWidget(mScanDir, 1, 0);
+ QVBoxLayout *scanModeL = new QVBoxLayout;
+ scanModeL->addWidget(scanGB);
+ scanModeL->addLayout(scanDirL);
+ scanModeWidget->setLayout(scanModeL);
+ connect(mUseBeetRB, &QRadioButton::toggled, this, &ConfigurationDialog::selectBeet);
+
//dialog layout
QVBoxLayout *mainLayout = new QVBoxLayout;
QTabWidget *tab = new QTabWidget;
tab->addTab(dbWidget, tr("Database"));
tab->addTab(colorWidget, tr("Colors"));
+ tab->addTab(scanModeWidget, tr("Scan Mode"));
mainLayout->addWidget(tab);
mainLayout->addLayout(bLayout);
readSettings();
@@ -98,6 +121,8 @@ void ConfigurationDialog::accept(){
QColor altColor = Helper::colorFromLabel(mAltColorL);
s.setValue("altcolor", altColor);
s.setValue("usealtcolors", mUseAltColors->isChecked());
+ s.setValue("usebeet", mUseBeetRB->isChecked());
+ s.setValue("scandir", mScanDir->text());
QDialog::accept();
}
@@ -115,6 +140,14 @@ void ConfigurationDialog::chooseColor(QWidget *label){
}
}
+void ConfigurationDialog::selectBeet(bool checked){
+ if(checked){
+ mScanDir->setEnabled(false);
+ }else{
+ mScanDir->setEnabled(true);
+ }
+}
+
void ConfigurationDialog::readSettings(){
QSettings s;
mDbHost->setText(s.value("dbhost").toString());
@@ -129,4 +162,8 @@ void ConfigurationDialog::readSettings(){
Helper::fillLabel(mAltColorL, altColor);
bool useAltColors = s.value("usealtcolors", false).toBool();
mUseAltColors->setChecked(useAltColors);
+ bool useBeet = s.value("usebeet", true).toBool();
+ mUseBeetRB->setChecked(useBeet);
+ QString scanDir = s.value("scandir", tr("<empty>")).toString();
+ mScanDir->setText(scanDir);
}