filters

kis_dlg_options_tiff.cpp

00001 /*
00002  *  Copyright (c) 2005 Cyrille Berger <cberger@cberger.net>
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program 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
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 
00020 #include "kis_dlg_options_tiff.h"
00021 
00022 #include <qcheckbox.h>
00023 #include <qgroupbox.h>
00024 #include <qslider.h>
00025 #include <qwidgetstack.h>
00026 
00027 #include <kapplication.h>
00028 #include <kcombobox.h>
00029 #include <klocale.h>
00030 
00031 #include "kis_wdg_options_tiff.h"
00032 
00033 KisDlgOptionsTIFF::KisDlgOptionsTIFF(QWidget *parent, const char *name)
00034     : KDialogBase(parent, name, false, i18n("TIFF Export Options"), KDialogBase::Ok | KDialogBase::Cancel)
00035 {
00036     optionswdg = new KisWdgOptionsTIFF(this);
00037     activated(0);
00038     connect(optionswdg->kComboBoxCompressionType, SIGNAL(activated ( int )), this, SLOT(activated ( int ) ));
00039     connect(optionswdg->flatten, SIGNAL(toggled(bool)), this, SLOT(flattenToggled( bool) ) );
00040     setMainWidget(optionswdg);
00041     kapp->restoreOverrideCursor();
00042     setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum) );
00043 }
00044 
00045 KisDlgOptionsTIFF::~KisDlgOptionsTIFF()
00046 {
00047 }
00048 
00049 void KisDlgOptionsTIFF::activated ( int index )
00050 {
00051 /*    optionswdg->groupBoxJPEG->hide();
00052     optionswdg->groupBoxDeflate->hide();
00053     optionswdg->groupBoxCCITGroupCCITG3->hide();
00054     optionswdg->groupBoxPixarLog->hide();*/
00055     switch(index)
00056     {
00057         case 1:
00058             optionswdg->codecsOptionsStack->raiseWidget(1);
00059 //             optionswdg->groupBoxJPEG->show();
00060             break;
00061         case 2:
00062             optionswdg->codecsOptionsStack->raiseWidget(2);
00063 //             optionswdg->groupBoxDeflate->show();
00064             break;
00065         case 6:
00066             optionswdg->codecsOptionsStack->raiseWidget(3);
00067 //             optionswdg->groupBoxCCITGroupCCITG3->show();
00068             break;
00069         case 8:
00070             optionswdg->codecsOptionsStack->raiseWidget(4);
00071 //             optionswdg->groupBoxPixarLog->show();
00072             break;
00073         default:
00074             optionswdg->codecsOptionsStack->raiseWidget(0);
00075     }
00076 }
00077 
00078 void KisDlgOptionsTIFF::flattenToggled(bool t)
00079 {
00080     optionswdg->alpha->setEnabled(t);
00081     if(!t)
00082     {
00083         optionswdg->alpha->setChecked(true);
00084     }
00085 }
00086 
00087 
00088 KisTIFFOptions KisDlgOptionsTIFF::options()
00089 {
00090     KisTIFFOptions options;
00091     switch(optionswdg->kComboBoxCompressionType->currentItem ())
00092     {
00093         case 0:
00094             options.compressionType = COMPRESSION_NONE;
00095             break;
00096         case 1:
00097             options.compressionType = COMPRESSION_JPEG;
00098             break;
00099         case 2:
00100             options.compressionType = COMPRESSION_DEFLATE;
00101             break;
00102         case 3:
00103             options.compressionType = COMPRESSION_LZW;
00104             break;
00105 #ifdef COMPRESSION_JP2000
00106         case 4:
00107             options.compressionType = COMPRESSION_JP2000;
00108             break;
00109 #endif
00110         case 5:
00111             options.compressionType = COMPRESSION_CCITTRLE;
00112             break;
00113         case 6:
00114             options.compressionType = COMPRESSION_CCITTFAX3;
00115             break;
00116         case 7:
00117             options.compressionType = COMPRESSION_CCITTFAX4;
00118             break;
00119         case 8:
00120             options.compressionType = COMPRESSION_PIXARLOG;
00121             break;
00122     }
00123     options.predictor = optionswdg->kComboBoxPredictor->currentItem() + 1;
00124     options.alpha = optionswdg->alpha->isChecked();
00125     options.flatten = optionswdg->flatten->isChecked();
00126     options.jpegQuality = optionswdg->qualityLevel->value();
00127     options.deflateCompress = optionswdg->compressionLevelDeflate->value();
00128     options.faxMode = optionswdg->kComboBoxFaxMode->currentItem() + 1;
00129     options.pixarLogCompress = optionswdg->compressionLevelPixarLog->value();
00130     
00131     return options;
00132 }
00133 
00134 #include "kis_dlg_options_tiff.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys