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::setInitialDPI(const int dpi)
00049 {
00050     if (dpi <= 72) m_mainWidget->m_DPIcomboBox->setCurrentItem(0);
00051     else if (dpi <= 96) m_mainWidget->m_DPIcomboBox->setCurrentItem(1);
00052     else if (dpi <= 150) m_mainWidget->m_DPIcomboBox->setCurrentItem(2);
00053     else if (dpi <= 300) m_mainWidget->m_DPIcomboBox->setCurrentItem(3);
00054     else if (dpi <= 600) m_mainWidget->m_DPIcomboBox->setCurrentItem(4);
00055     else if (dpi <= 720) m_mainWidget->m_DPIcomboBox->setCurrentItem(5);
00056     else if (dpi <= 1200) m_mainWidget->m_DPIcomboBox->setCurrentItem(6);
00057 }
00058 
00059 void ImageExportDialog::setInitialmargin(const int margin)
00060 {
00061     m_mainWidget->m_marginSpinBox->setValue(margin);
00062 }
00063 
00064 QString ImageExportDialog::selectedPage() const
00065 {
00066   return m_mainWidget->m_pageCombo->currentText();
00067 }
00068 
00069 int ImageExportDialog::imageDPI() const
00070 {
00071     switch (m_mainWidget->m_DPIcomboBox->currentItem())
00072     {
00073         case 0:
00074             return 72;
00075         case 1:
00076             return 96;
00077         case 2:
00078             return 150;
00079         case 3:
00080             return 300;
00081         case 4:
00082             return 600;
00083         case 5:
00084             return 720;
00085         case 6:
00086             return 1200;
00087         default:
00088             return 300;
00089     }
00090 }
00091 
00092 bool ImageExportDialog::usePageBorders() const
00093 {
00094   return (m_mainWidget->m_exportAreaCombo->currentItem() == 1);
00095 }
00096 
00097 
00098 int ImageExportDialog::margin() const
00099 {
00100   return m_mainWidget->m_marginSpinBox->value();
00101 }
00102 
00103 }
00104 
00105 #include "kivio_imageexportdialog.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys