SilentEye 0.4.1

modules/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     void OptionWidget::hideQuality(bool hide)
00034     {
00035         compressLabel->setVisible(!hide);
00036         compressSpinBox->setVisible(!hide);
00037     }
00038 
00039     int OptionWidget::k() const
00040     {
00041         return kSlider->value();
00042     }
00043 
00044     QString OptionWidget::passphrase() const
00045     {
00046         return pwdLineEdit->text();
00047     }
00048 
00049     int OptionWidget::quality() const
00050     {
00051         return compressSpinBox->value();
00052     }
00053 
00054     ImageJPEG::HeaderPosition OptionWidget::headerPosition() const
00055     {
00056         ImageJPEG::HeaderPosition pos = ImageJPEG::SIGNATURE;
00057         switch(headerComboBox->currentIndex())
00058         {
00059             case 0:
00060                 pos = ImageJPEG::TOP;
00061                 break;
00062             case 1:
00063                 pos = ImageJPEG::BOTTOM;
00064                 break;
00065             case 2:
00066                 pos = ImageJPEG::SIGNATURE;
00067                 break;
00068             default:
00069                 m_logger->warning("Unhandle header switch value: " + headerComboBox->currentIndex());
00070                 break;
00071         }
00072         return pos;
00073     }
00074 
00075     void OptionWidget::pwdStateChange(int state)
00076     {
00077         if (state == Qt::Unchecked)
00078         {
00079             pwdLineEdit->setEchoMode(QLineEdit::Password);
00080         }
00081         else
00082         {
00083             pwdLineEdit->setEchoMode(QLineEdit::Normal);
00084         }
00085     }
00086 }