diff options
| author | Arno <arno@disconnect.de> | 2018-10-13 05:10:14 +0200 | 
|---|---|---|
| committer | Arno <arno@disconnect.de> | 2018-10-13 05:10:14 +0200 | 
| commit | b65ab2398dcbc2f5c9b1ec33ac0bbf863e3df0ca (patch) | |
| tree | db0efa4a3882d8e633259ef3bbbb5b63515dce72 | |
| parent | 6f87db1897e4be7bccd2684da571ed251c5b695e (diff) | |
| download | BeetPlayer-b65ab2398dcbc2f5c9b1ec33ac0bbf863e3df0ca.tar.gz BeetPlayer-b65ab2398dcbc2f5c9b1ec33ac0bbf863e3df0ca.tar.bz2 BeetPlayer-b65ab2398dcbc2f5c9b1ec33ac0bbf863e3df0ca.zip | |
Print destination file when adding sources
Use a function to generate the path, so we can reuse it when actually
copying files :)
| -rw-r--r-- | copydialog.cpp | 20 | ||||
| -rw-r--r-- | copydialog.h | 3 | 
2 files changed, 23 insertions, 0 deletions
| diff --git a/copydialog.cpp b/copydialog.cpp index 38a5b9f..f16fda0 100644 --- a/copydialog.cpp +++ b/copydialog.cpp @@ -81,6 +81,26 @@ void CopyDialog::setDestFolder(const QString &dst){  void CopyDialog::setSources(const QStringList &sources){      mSources = sources; +    refresh(); +} + +void CopyDialog::refresh(){ +    QString res; +    for(const QString &p : mSources){ +        res.append(QString("%1 %2\n").arg(QChar(0x2b9a)).arg(p)); +        res.append(QString("%1 %2\n").arg(QChar(0x2b98)).arg(getDestinationFile(p))); +    } +    mResultL->setText(res); +} + +QString CopyDialog::getDestinationFile(const QString &srcFn){ +    QFileInfo fi(srcFn); +    if(fi.exists()){ +        QString fn = fi.fileName(); +        QString destPath = QString("%1/%2/%3").arg(mDstE->text()).arg(mFolderE->text()).arg(fn); +        return destPath; +    } +    return QString();  }  void CopyDialog::closeEvent(QCloseEvent *e){ diff --git a/copydialog.h b/copydialog.h index 8a32372..0eed637 100644 --- a/copydialog.h +++ b/copydialog.h @@ -16,8 +16,11 @@ class CopyDialog : public QDialog {          void setSource(const QString &src);          void setDestFolder(const QString &dst);          void setSources(const QStringList &sources); +        void refresh(); +      protected: +        QString getDestinationFile(const QString &srcFn);          virtual void closeEvent(QCloseEvent *e);      private: | 
