2
* This file is part of the qx11grab project
4
* Copyright (C) Juergen Heinemann (Undefined) http://qx11grab.hjcms.de, (C) 2007-2012
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Library General Public
8
* License as published by the Free Software Foundation; either
9
* version 2 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Library General Public License for more details.
16
* You should have received a copy of the GNU Library General Public License
17
* along with this library; see the file COPYING.LIB. If not, write to
18
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
* Boston, MA 02110-1301, USA.
22
#include "loglevelcombobox.h"
25
#include <QtCore/QDebug>
26
#include <QtCore/QVariant>
29
#include <QtGui/QIcon>
31
LogLevelComboBox::LogLevelComboBox ( QWidget * parent )
32
: QComboBox ( parent )
34
setObjectName ( QLatin1String ( "LogLevelComboBox" ) );
36
setToolTip ( trUtf8 ( "FFmpeg logging level" ) );
38
setWhatsThis ( trUtf8 ( "Set the logging level used by the FFmpeg application" ) );
41
QIcon icon = QIcon::fromTheme ( "menu-debugger" );
42
insertItem ( index++, icon, trUtf8 ( "Warnings" ), QString::fromUtf8 ( "warning" ) );
43
insertItem ( index++, icon, trUtf8 ( "Information" ), QString::fromUtf8 ( "info" ) );
44
insertItem ( index++, icon, trUtf8 ( "Verbose" ), QString::fromUtf8 ( "verbose" ) );
45
insertItem ( index++, icon, trUtf8 ( "Errors" ), QString::fromUtf8 ( "error" ) );
46
insertItem ( index++, icon, trUtf8 ( "Panic" ), QString::fromUtf8 ( "panic" ) );
47
insertItem ( index++, icon, trUtf8 ( "Fatal" ), QString::fromUtf8 ( "fatal" ) );
48
insertItem ( index++, icon, trUtf8 ( "Manual" ), QString::fromUtf8 ( "NONE" ) );
49
setCurrentIndex ( 0 );
52
void LogLevelComboBox::setValue ( const QString &value )
54
for ( int i = 0; i < count(); ++i )
56
if ( itemData ( i, Qt::UserRole ).toString().compare ( value ) == 0 )
57
setCurrentIndex ( i );
61
const QString LogLevelComboBox::value()
63
QString item = itemData ( currentIndex(), Qt::UserRole ).toString();
64
return ( item.compare ( "NONE" ) == 0 ) ? QString() : item;
67
LogLevelComboBox::~LogLevelComboBox()