X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdialogs%2Fstoreprogress.cpp;h=4ef3404594ecc1a26100e90add78cd5653fef543;hp=ecda1d0ec7c680ae1ec72f08011fa830deafa65c;hb=6f925ba9d6faf1077b73c5a5808259576081716a;hpb=b101c41ea084b6dbf5db173759d79f6ca0cb2454 diff --git a/pv/dialogs/storeprogress.cpp b/pv/dialogs/storeprogress.cpp index ecda1d0..4ef3404 100644 --- a/pv/dialogs/storeprogress.cpp +++ b/pv/dialogs/storeprogress.cpp @@ -14,36 +14,50 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ #include #include -#include "storeprogress.h" +#include "pv/session.hpp" + +#include "storeprogress.hpp" + +using std::map; +using std::pair; +using std::shared_ptr; +using std::string; + +using Glib::VariantBase; namespace pv { namespace dialogs { StoreProgress::StoreProgress(const QString &file_name, - const SigSession &session, QWidget *parent) : + const shared_ptr output_format, + const map &options, + const pair sample_range, + const Session &session, QWidget *parent) : QProgressDialog(tr("Saving..."), tr("Cancel"), 0, 0, parent), - _session(file_name.toStdString(), session) + session_(file_name.toStdString(), output_format, options, sample_range, + session) { - connect(&_session, SIGNAL(progress_updated()), + connect(&session_, SIGNAL(progress_updated()), this, SLOT(on_progress_updated())); + connect(&session_, SIGNAL(store_successful()), + &session, SLOT(on_data_saved())); } StoreProgress::~StoreProgress() { - _session.wait(); + session_.wait(); } void StoreProgress::run() { - if (_session.start()) + if (session_.start()) show(); else show_error(); @@ -53,7 +67,7 @@ void StoreProgress::show_error() { QMessageBox msg(parentWidget()); msg.setText(tr("Failed to save session.")); - msg.setInformativeText(_session.error()); + msg.setInformativeText(session_.error()); msg.setStandardButtons(QMessageBox::Ok); msg.setIcon(QMessageBox::Warning); msg.exec(); @@ -61,19 +75,19 @@ void StoreProgress::show_error() void StoreProgress::closeEvent(QCloseEvent*) { - _session.cancel(); + session_.cancel(); } void StoreProgress::on_progress_updated() { - const std::pair p = _session.progress(); + const pair p = session_.progress(); assert(p.first <= p.second); if (p.second) { setValue(p.first); setMaximum(p.second); } else { - const QString err = _session.error(); + const QString err = session_.error(); if (!err.isEmpty()) show_error(); close();