From 3f835ddb210a95570b0769b4e45f2dcbe68edaea Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Mon, 15 Oct 2012 21:28:08 +0200 Subject: [PATCH 3/5] Activating download button, if appropiate. * If a file with the file extension '.mp3' was selected and a HiMD Device is connected, activate the download button. * Added a dummy on_clicked function for the download button. --- qhimdtransfer/qhimdmainwindow.cpp | 15 +++++++++++++++ qhimdtransfer/qhimdmainwindow.h | 1 + 2 files changed, 16 insertions(+) diff --git a/qhimdtransfer/qhimdmainwindow.cpp b/qhimdtransfer/qhimdmainwindow.cpp index 3708a52..6363170 100644 --- a/qhimdtransfer/qhimdmainwindow.cpp +++ b/qhimdtransfer/qhimdmainwindow.cpp @@ -496,12 +496,22 @@ void QHiMDMainWindow::handle_himd_selection_change(const QItemSelection&, const void QHiMDMainWindow::handle_local_selection_change(const QItemSelection&, const QItemSelection&) { QModelIndex index = ui->localScan->currentIndex(); + bool download_possible = false; if(localmodel.fileInfo(index).isDir()) { ui->updir->setText(localmodel.filePath(index)); settings.setValue("lastUploadDirectory", localmodel.filePath(index)); } + + if(localmodel.fileInfo(index).isFile()) + { + if(localmodel.filePath(index).endsWith(".mp3", Qt::CaseInsensitive)) + download_possible = (ui->himd_devices->count() > 0); + } + + ui->action_Download->setEnabled(download_possible); + ui->download_button->setEnabled(download_possible); } void QHiMDMainWindow::himd_found(QString HiMDPath) @@ -560,3 +570,8 @@ void QHiMDMainWindow::on_himd_devices_activated(QString device) { open_himd_at(device); } + +void QHiMDMainWindow::on_download_button_clicked() +{ + /*download_of(localmodel.filePath(ui->localScan->currentIndex()));*/ +} diff --git a/qhimdtransfer/qhimdmainwindow.h b/qhimdtransfer/qhimdmainwindow.h index 5e24e95..01d4242 100644 --- a/qhimdtransfer/qhimdmainwindow.h +++ b/qhimdtransfer/qhimdmainwindow.h @@ -68,6 +68,7 @@ private slots: void himd_found(QString path); void himd_removed(QString path); void on_himd_devices_activated(QString device); + void on_download_button_clicked(); signals: void himd_busy(QString path); -- 1.7.12.3