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 "mainfcuntions.h"
25
#include "threadsspinbox.h"
26
#include "loglevelcombobox.h"
27
#include "iconthemeselector.h"
28
#include "graphicsengineselecter.h"
31
#include <QtCore/QDebug>
34
#include <QtGui/QFormLayout>
35
#include <QtGui/QLabel>
37
MainFunctions::MainFunctions ( QWidget * parent )
38
: AbstractConfigWidget ( parent )
40
setObjectName ( QLatin1String ( "MainFunctions" ) );
42
setTitle ( trUtf8 ( "Features" ) );
45
QFormLayout* layout = new QFormLayout ( this );
46
layout->setLabelAlignment ( Qt::AlignRight );
48
showRubberband = new QCheckBox ( trUtf8 ( "Display Rubberband" ), this );
50
showRubberband->setToolTip ( trUtf8 ( "enable rubberband at application start" ) );
52
showRubberband->setWhatsThis ( trUtf8 ( "always show the rubberband on application start" ) );
53
showRubberband->setChecked ( true );
54
layout->addRow ( showRubberband );
56
startMinimized = new QCheckBox ( trUtf8 ( "Start Minimized" ), this );
58
startMinimized->setToolTip ( trUtf8 ( "start qx11grab minimized" ) );
60
startMinimized->setWhatsThis ( trUtf8 ( "only show qx11grab on start in systray" ) );
61
startMinimized->setChecked ( true );
62
layout->addRow ( startMinimized );
64
expertMode = new QCheckBox ( trUtf8 ( "Expert Mode" ), this );
66
expertMode->setToolTip ( trUtf8 ( "Enable/Disable expert editor mode" ) );
68
expertMode->setWhatsThis ( trUtf8 ( "Enable auto insert my expert settings" ) );
69
expertMode->setChecked ( false );
70
layout->addRow ( expertMode );
72
unsavedChanges = new QCheckBox ( trUtf8 ( "record with unsaved changes" ), this );
74
unsavedChanges->setToolTip ( trUtf8 ( "force start record with unsaved changes" ) );
76
unsavedChanges->setWhatsThis ( trUtf8 ( "start recording if qx11grab have unsaved changes" ) );
77
unsavedChanges->setChecked ( false );
78
layout->addRow ( unsavedChanges );
80
m_threadsSpinBox = new ThreadsSpinBox ( this );
81
layout->addRow ( trUtf8 ( "Threads" ), m_threadsSpinBox );
83
m_logLevelComboBox = new LogLevelComboBox ( this );
84
layout->addRow ( trUtf8 ( "Report Level" ), m_logLevelComboBox );
86
m_iconThemeSelector = new IconThemeSelector ( this );
87
layout->addRow ( trUtf8 ( "Icon Theme" ), m_iconThemeSelector );
89
m_graphicsEngine = new GraphicsEngineSelecter ( this );
90
layout->addRow ( trUtf8 ( "Graphics System" ), m_graphicsEngine );
92
layout->setVerticalSpacing ( 1 );
95
connect ( showRubberband, SIGNAL ( clicked ( bool ) ),
96
this, SIGNAL ( postUpdate ( bool ) ) );
98
connect ( startMinimized, SIGNAL ( clicked ( bool ) ),
99
this, SIGNAL ( postUpdate ( bool ) ) );
101
connect ( m_iconThemeSelector, SIGNAL ( modified ( bool ) ),
102
this, SIGNAL ( postUpdate ( bool ) ) );
105
void MainFunctions::load ( Settings * cfg )
107
showRubberband->setChecked ( cfg->showRubberOnStart() );
108
unsavedChanges->setChecked ( cfg->value ( QLatin1String ( "unsavedChanges" ), false ).toBool() );
109
startMinimized->setChecked ( cfg->value ( QLatin1String ( "startMinimized" ), false ).toBool() );
110
expertMode->setChecked ( cfg->expertMode() );
111
m_threadsSpinBox->setValue ( cfg->value ( QLatin1String ( "Threads" ), 0 ).toUInt() );
112
m_logLevelComboBox->setValue ( cfg->logLevel() );
113
m_iconThemeSelector->setValue ( cfg->value ( QLatin1String ( "IconTheme" ), "oxygen" ).toString() );
114
m_graphicsEngine->setValue ( cfg->value ( QLatin1String ( "GraphicsSystem" ), "native" ).toString() );
117
void MainFunctions::save ( Settings * cfg )
119
cfg->setValue ( QLatin1String ( "showRubberband" ), showRubberband->isChecked() );
120
cfg->setValue ( QLatin1String ( "unsavedChanges" ), unsavedChanges->isChecked() );
121
cfg->setValue ( QLatin1String ( "startMinimized" ), startMinimized->isChecked() );
122
cfg->setValue ( QLatin1String ( "ExpertMode" ), expertMode->isChecked() );
123
cfg->setValue ( QLatin1String ( "Threads" ), m_threadsSpinBox->value() );
124
cfg->setLogLevel ( m_logLevelComboBox->value() );
125
cfg->setValue ( QLatin1String ( "IconTheme" ), m_iconThemeSelector->value() );
126
cfg->setValue ( QLatin1String ( "GraphicsSystem" ), m_graphicsEngine->value() );
129
MainFunctions::~MainFunctions()