Mercurial > hg > svgui
changeset 410:33b7f5e54d60
* Merge revisions 1041 to 1130 from sv-rdf-import branch
author | Chris Cannam |
---|---|
date | Thu, 18 Sep 2008 12:09:32 +0000 |
parents | feeb48f7478a |
children | 96e4d7b9e165 |
files | widgets/FileFinder.cpp widgets/ProgressDialog.cpp widgets/ProgressDialog.h |
diffstat | 3 files changed, 46 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/widgets/FileFinder.cpp Thu Jul 31 15:54:24 2008 +0000 +++ b/widgets/FileFinder.cpp Thu Sep 18 12:09:32 2008 +0000 @@ -17,6 +17,7 @@ #include "data/fileio/FileSource.h" #include "data/fileio/AudioFileReaderFactory.h" #include "data/fileio/DataFileReaderFactory.h" +#include "rdf/RDFImporter.h" #include <QFileInfo> #include <QMessageBox> @@ -74,12 +75,12 @@ case LayerFile: settingsKey = "layerpath"; - filter = tr("All supported files (%1)\nSonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nMIDI files (*.mid)\nText files (*.txt)\nAll files (*.*)").arg(DataFileReaderFactory::getKnownExtensions()); + filter = tr("All supported files (%1 %2)\nSonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nRDF files (%3)\nMIDI files (*.mid)\nText files (*.txt)\nAll files (*.*)").arg(DataFileReaderFactory::getKnownExtensions()).arg(RDFImporter::getKnownExtensions()).arg(RDFImporter::getKnownExtensions()); break; case LayerFileNoMidi: settingsKey = "layerpath"; - filter = tr("All supported files (%1)\nSonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nText files (*.txt)\nAll files (*.*)").arg(DataFileReaderFactory::getKnownExtensions()); + filter = tr("All supported files (%1 %2)\nSonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nRDF files (%3)\nText files (*.txt)\nAll files (*.*)").arg(DataFileReaderFactory::getKnownExtensions()).arg(RDFImporter::getKnownExtensions()).arg(RDFImporter::getKnownExtensions()); break; case SessionOrAudioFile: @@ -104,9 +105,10 @@ case AnyFile: settingsKey = "lastpath"; - filter = tr("All supported files (*.sv %1 %2)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nLayer files (%2)\nAll files (*.*)") + filter = tr("All supported files (*.sv %1 %2 %3)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nLayer files (%2)\nAll files (*.*)") .arg(AudioFileReaderFactory::getKnownExtensions()) - .arg(DataFileReaderFactory::getKnownExtensions()); + .arg(DataFileReaderFactory::getKnownExtensions()) + .arg(RDFImporter::getKnownExtensions()); break; };
--- a/widgets/ProgressDialog.cpp Thu Jul 31 15:54:24 2008 +0000 +++ b/widgets/ProgressDialog.cpp Thu Sep 18 12:09:32 2008 +0000 @@ -22,7 +22,8 @@ ProgressDialog::ProgressDialog(QString message, bool cancellable, int timeBeforeShow, QWidget *parent) : m_showTimer(0), - m_timerElapsed(false) + m_timerElapsed(false), + m_cancelled(false) { m_dialog = new QProgressDialog(message, cancellable ? tr("Cancel") : 0, 0, 100, parent); @@ -39,7 +40,7 @@ } if (cancellable) { - connect(m_dialog, SIGNAL(canceled()), this, SIGNAL(cancelled())); + connect(m_dialog, SIGNAL(canceled()), this, SLOT(canceled())); } } @@ -49,6 +50,19 @@ delete m_dialog; } +bool +ProgressDialog::isDefinite() const +{ + return (m_dialog->maximum() > 0); +} + +void +ProgressDialog::setDefinite(bool definite) +{ + if (definite) m_dialog->setMaximum(100); + else m_dialog->setMaximum(0); +} + void ProgressDialog::setMessage(QString text) { @@ -56,10 +70,24 @@ } void +ProgressDialog::canceled() +{ + m_cancelled = true; + emit cancelled(); +} + +bool +ProgressDialog::wasCancelled() const +{ + return m_cancelled; +} + +void ProgressDialog::showTimerElapsed() { m_timerElapsed = true; if (m_dialog->value() > 0) { + emit showing(); m_dialog->show(); } qApp->processEvents(); @@ -72,9 +100,10 @@ m_dialog->setValue(percentage); - if (percentage >= 100) { + if (percentage >= 100 && isDefinite()) { m_dialog->hide(); } else if (m_timerElapsed && !m_dialog->isVisible()) { + emit showing(); m_dialog->show(); m_dialog->raise(); }
--- a/widgets/ProgressDialog.h Thu Jul 31 15:54:24 2008 +0000 +++ b/widgets/ProgressDialog.h Thu Sep 18 12:09:32 2008 +0000 @@ -29,7 +29,13 @@ int timeBeforeShow = 0, QWidget *parent = 0); virtual ~ProgressDialog(); + virtual bool isDefinite() const; + virtual void setDefinite(bool definite); + + virtual bool wasCancelled() const; + signals: + void showing(); void cancelled(); public slots: @@ -38,11 +44,13 @@ protected slots: virtual void showTimerElapsed(); + void canceled(); protected: QProgressDialog *m_dialog; QTimer *m_showTimer; bool m_timerElapsed; + bool m_cancelled; }; #endif