filters

kivio_imageexportdialog.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Peter Simonsson <psn@linux.se>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #include "kivio_imageexportdialog.h"
00021 
00022 #include <qspinbox.h>
00023 #include <qcheckbox.h>
00024 
00025 #include <kcombobox.h>
00026 #include <klocale.h>
00027 #include <kapplication.h>
00028 
00029 #include "kivio_imageexportwidget.h"
00030 
00031 namespace Kivio
00032 {
00033 
00034 ImageExportDialog::ImageExportDialog(QWidget* parent, const char* name)
00035   : KDialogBase(parent, name, false, i18n("Export to Image"), Ok|Cancel)
00036 {
00037   kapp->restoreOverrideCursor();
00038   m_mainWidget = new ImageExportWidget(this);
00039   setMainWidget(m_mainWidget);
00040 }
00041 
00042 void ImageExportDialog::setPageList(const QStringList& pages)
00043 {
00044   m_mainWidget->m_pageCombo->clear();
00045   m_mainWidget->m_pageCombo->insertStringList(pages);
00046 }
00047 
00048 void ImageExportDialog::setInitialCustomSize(const QSize& size)
00049 {
00050   m_mainWidget->m_widthSpinBox->setValue(size.width());
00051   m_mainWidget->m_heightSpinBox->setValue(size.height());
00052 }
00053 
00054 QString ImageExportDialog::selectedPage() const
00055 {
00056   return m_mainWidget->m_pageCombo->currentText();
00057 }
00058 
00059 bool ImageExportDialog::usePageBorders() const
00060 {
00061   return (m_mainWidget->m_exportAreaCombo->currentItem() == 0);
00062 }
00063 
00064 bool ImageExportDialog::useCustomSize() const
00065 {
00066   return m_mainWidget->m_customSizeCheckBox->isChecked();
00067 }
00068 
00069 QSize ImageExportDialog::customSize() const
00070 {
00071   QSize size;
00072   size.setWidth(m_mainWidget->m_widthSpinBox->value());
00073   size.setHeight(m_mainWidget->m_heightSpinBox->value());
00074 
00075   return size;
00076 }
00077 
00078 int ImageExportDialog::margin() const
00079 {
00080   return m_mainWidget->m_marginSpinBox->value();
00081 }
00082 
00083 }
00084 
00085 #include "kivio_imageexportdialog.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys