SilentEye 0.4.1

modules/seformatjpegold/seformatjpeg/optionwidget.cpp

Go to the documentation of this file.
00001 //  This file is part of SilentEye.
00002 //
00003 //  SilentEye is free software: you can redistribute it and/or modify
00004 //  it under the terms of the GNU General Public License as published by
00005 //  the Free Software Foundation, either version 3 of the License, or
00006 //  (at your option) any later version.
00007 //
00008 //  SilentEye is distributed in the hope that it will be useful,
00009 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 //  GNU General Public License for more details.
00012 //
00013 //  You should have received a copy of the GNU General Public License
00014 //  along with SilentEye.  If not, see <http://www.gnu.org/licenses/>.
00015 
00016 #include "optionwidget.h"
00017 
00018 namespace SEFormatJPEG {
00019 
00020     OptionWidget::OptionWidget(QWidget* parent)
00021         : QWidget(parent)
00022     {
00023         setupUi(this);
00024 
00025         connect(pwdCheckBox, SIGNAL(stateChanged(int)), this, SLOT(pwdStateChange(int)));
00026     }
00027 
00028     OptionWidget::~OptionWidget()
00029     {
00030 
00031     }
00032 
00033     int OptionWidget::k() const
00034     {
00035         return kSlider->value();
00036     }
00037 
00038     QString OptionWidget::passphrase() const
00039     {
00040         return pwdLineEdit->text();
00041     }
00042 
00043     int OptionWidget::quality() const
00044     {
00045         return compressSpinBox->value();
00046     }
00047 
00048     ImageJPEG::HeaderPosition OptionWidget::headerPosition() const
00049     {
00050         ImageJPEG::HeaderPosition pos = ImageJPEG::SIGNATURE;
00051         switch(headerComboBox->currentIndex())
00052         {
00053             case 0:
00054                 pos = ImageJPEG::TOP;
00055                 break;
00056             case 1:
00057                 pos = ImageJPEG::BOTTOM;
00058                 break;
00059             case 2:
00060                 pos = ImageJPEG::SIGNATURE;
00061                 break;
00062             default:
00063                 m_logger->warning("Unhandle header switch value: " + headerComboBox->currentIndex());
00064                 break;
00065         }
00066         return pos;
00067     }
00068 
00069     void OptionWidget::pwdStateChange(int state)
00070     {
00071         if (state == Qt::Unchecked)
00072         {
00073             pwdLineEdit->setEchoMode(QLineEdit::Password);
00074         }
00075         else
00076         {
00077             pwdLineEdit->setEchoMode(QLineEdit::Normal);
00078         }
00079     }
00080 }