summaryrefslogtreecommitdiff
path: root/dgedit
diff options
context:
space:
mode:
authordeva <deva>2009-11-30 14:33:32 +0000
committerdeva <deva>2009-11-30 14:33:32 +0000
commit9cd3c49d7b86b443726b724013f08efce13b8022 (patch)
tree26fb10e74ac17ac7d31fbe947f5fffc9b0816808 /dgedit
parent68f1b54aace152707f2bb51e07f76ebd879becb1 (diff)
Adding files from gui now works.
Diffstat (limited to 'dgedit')
-rw-r--r--dgedit/mainwindow.cc40
-rw-r--r--dgedit/mainwindow.h3
2 files changed, 25 insertions, 18 deletions
diff --git a/dgedit/mainwindow.cc b/dgedit/mainwindow.cc
index 7af947a..b46904a 100644
--- a/dgedit/mainwindow.cc
+++ b/dgedit/mainwindow.cc
@@ -37,7 +37,7 @@
#include <QApplication>
#include <QDockWidget>
#include <QSettings>
-
+#include <QFileInfo>
#define MAXVAL 10000000L
#define SINGLESTEP MAXVAL/100000
@@ -109,7 +109,7 @@ MainWindow::MainWindow()
QPushButton *loadbtn = new QPushButton();
loadbtn->setText("Load");
- connect(loadbtn, SIGNAL(clicked()), this, SLOT(loadFile()));
+ connect(loadbtn, SIGNAL(clicked()), this, SLOT(addFile()));
btns->addWidget(autosel);
btns->addWidget(clearsel);
@@ -136,10 +136,7 @@ MainWindow::MainWindow()
configs->addWidget(new QLabel("Files:"));
filelist = new QListWidget();
- addFile("/home/deva/aasimonster/tmp/china/Amb L-20.wav", "amb-l");
- addFile("/home/deva/aasimonster/tmp/china/Amb R-20.wav", "amb-r");
- addFile("/home/deva/aasimonster/tmp/china/OH L-20.wav", "oh-l");
- addFile("/home/deva/aasimonster/tmp/china/OH R-20.wav", "oh-r");
+ connect(filelist, SIGNAL(itemSelectionChanged()), this, SLOT(loadFile()));
configs->addWidget(filelist);
QDockWidget *dockWidget = new QDockWidget(tr("Dock Widget"), this);
@@ -221,23 +218,34 @@ void MainWindow::doExport()
void MainWindow::loadFile()
{
- QString filename =
- QFileDialog::getOpenFileName(this, tr("Open file"),
- "", tr("Audio Files (*.wav)"));
+ QString filename = filelist->currentItem()->text();
+
+ setCursor(Qt::WaitCursor);
statusBar()->showMessage("Loading...");
qApp->processEvents();
sorter->setWavData(NULL, 0);
canvas->load(filename);
sorter->setWavData(canvas->data, canvas->size);
statusBar()->showMessage("Ready");
+ setCursor(Qt::ArrowCursor);
}
-void MainWindow::addFile(QString file, QString name)
+void MainWindow::addFile()
{
- QListWidgetItem *item = new QListWidgetItem();
- item->setText(file);
- item->setData(Qt::UserRole, name);
- filelist->addItem(item);
-
- extractor->addFile(file, name);
+ QStringList files = QFileDialog::getOpenFileNames(this, tr("Open file"),
+ "", tr("Audio Files (*.wav)"));
+ QStringList::Iterator i = files.begin();
+ while(i != files.end()) {
+ QString file = *i;
+ QFileInfo fi(file);
+ QString name = fi.baseName();
+
+ QListWidgetItem *item = new QListWidgetItem();
+ item->setText(file);
+ item->setData(Qt::UserRole, name);
+ filelist->addItem(item);
+
+ extractor->addFile(file, name);
+ i++;
+ }
}
diff --git a/dgedit/mainwindow.h b/dgedit/mainwindow.h
index 42a9f18..df40e3a 100644
--- a/dgedit/mainwindow.h
+++ b/dgedit/mainwindow.h
@@ -40,8 +40,6 @@ Q_OBJECT
public:
MainWindow();
- void addFile(QString file, QString name);
-
public slots:
void setXScale(int);
void setYScale(int);
@@ -49,6 +47,7 @@ public slots:
void setYOffset(int);
void doExport();
void loadFile();
+ void addFile();
protected:
void closeEvent(QCloseEvent*);