2
// C++ Implementation: PictureViewerDialog
7
// Author: Chris Browet <cbro@semperpax.com>, (C) 2008
9
// Copyright: See COPYING file that comes with this distribution
12
#include "PictureViewerDialog.h"
14
#include <QFileDialog>
17
PictureViewerDialog::PictureViewerDialog(const QString& title, const QString &filename, QWidget *parent)
18
:QDialog(parent), m_filename(filename)
22
pixWidget->loadFile(filename);
23
setWindowTitle(title);
26
PictureViewerDialog::PictureViewerDialog(const QString& title, const QPixmap& thePixmap, QWidget *parent)
31
pixWidget->setPixmap(thePixmap);
32
setWindowTitle(title);
35
void PictureViewerDialog::on_buttonBox_clicked(QAbstractButton * button)
37
if (buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole) {
38
if (m_filename.endsWith("svg", Qt::CaseInsensitive)) {
39
QString s = QFileDialog::getSaveFileName(this,tr("Output filename"),"",tr("SVG files (*.svg)"));
41
QFile(m_filename).copy(s);
44
QString s = QFileDialog::getSaveFileName(this,tr("Output filename"),"",tr("Image files (*.png *.jpg)"));
46
pixWidget->pixmap()->save(s);