From 5f3b212b63418851907b788b6a2bfea69ba570b6 Mon Sep 17 00:00:00 2001 From: Jonas Suhr Christensen Date: Wed, 2 Apr 2014 21:12:53 +0200 Subject: Added file dialog to select export path. --- dgedit/mainwindow.cc | 18 +++++++++++++----- dgedit/mainwindow.h | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/dgedit/mainwindow.cc b/dgedit/mainwindow.cc index 3436c25..15b0171 100644 --- a/dgedit/mainwindow.cc +++ b/dgedit/mainwindow.cc @@ -38,6 +38,7 @@ #include #include #include +#include #include "canvastool.h" #include "canvastoolthreshold.h" @@ -193,11 +194,16 @@ MainWindow::MainWindow() configs->addWidget(prefix); configs->addWidget(new QLabel("Export path:")); - QLineEdit *exportp = new QLineEdit(); + QHBoxLayout *lo_exportp = new QHBoxLayout(); + exportp = new QLineEdit(); connect(exportp, SIGNAL(textChanged(const QString &)), extractor, SLOT(setExportPath(const QString &))); exportp->setText("/home/deva/tmp/drumgizmoexport"); - configs->addWidget(exportp); + lo_exportp->addWidget(exportp); + QPushButton *btn_browse = new QPushButton("..."); + connect(btn_browse, SIGNAL(clicked()), this, SLOT(browse())); + lo_exportp->addWidget(btn_browse); + configs->addLayout(lo_exportp); QPushButton *loadbtn = new QPushButton(); loadbtn->setText("Add files..."); @@ -330,7 +336,9 @@ void MainWindow::setPreset(int index) slider_falloff->setValue(p.falloff); slider_fadelength->setValue(p.fadelength); prefix->setText(p.prefix); -// sorter->setAttackLength(p.attacklength); -// selections->noiseFloorChanged(p.falloff); -// selections->fadeoutChanged(p.fadeout); +} + +void MainWindow::browse() { + QString path = QFileDialog::getExistingDirectory(this, "Select export path", exportp->text()); + exportp->setText(path); } diff --git a/dgedit/mainwindow.h b/dgedit/mainwindow.h index fd4af57..cc9bdb8 100644 --- a/dgedit/mainwindow.h +++ b/dgedit/mainwindow.h @@ -61,6 +61,7 @@ public slots: void doExport(); void loadFile(QString filename); void setPreset(int); + void browse(); protected: void closeEvent(QCloseEvent*); @@ -83,6 +84,7 @@ private: QSlider *slider_falloff; QSlider *slider_fadelength; QLineEdit *prefix; + QLineEdit *exportp; }; #endif/*__DRUMGIZMO_MAINWINDOW_H__*/ -- cgit v1.2.3