~ubuntu-branches/ubuntu/quantal/kx11grab/quantal

« back to all changes in this revision

Viewing changes to src/settings/mainfcuntions.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Thomas
  • Date: 2012-05-28 00:05:08 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120528000508-fhxswnrq2zoo983r
Tags: 0.4.4~rc3-0ubuntu1
* New upstream release candidate:
  - Refresh kubuntu_01_fix_linker.diff
  - Add new build-depends: pkg-config, libasound2-dev, libavformat-dev,
    libavcodec-dev, libavutil-dev, libavfilter-dev, libfreetype6-dev,
    libfontconfig1-dev, libpulse-dev, libxrandr-dev, libv4l-dev
  - Build with -DENABLE_KDE_SUPPORT to retain KDE integration.
* Bump debhelper version to 9
* Bump Standards-Version to 3.9.3, no changes necessary

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* This file is part of the qx11grab project
 
3
*
 
4
* Copyright (C) Juergen Heinemann (Undefined) http://qx11grab.hjcms.de, (C) 2007-2012
 
5
*
 
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.
 
10
*
 
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.
 
15
*
 
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.
 
20
*/
 
21
 
 
22
#include "mainfcuntions.h"
 
23
 
 
24
/* QX11Grab */
 
25
#include "threadsspinbox.h"
 
26
#include "loglevelcombobox.h"
 
27
#include "iconthemeselector.h"
 
28
#include "graphicsengineselecter.h"
 
29
 
 
30
/* QtCore */
 
31
#include <QtCore/QDebug>
 
32
 
 
33
/* QtGui */
 
34
#include <QtGui/QFormLayout>
 
35
#include <QtGui/QLabel>
 
36
 
 
37
MainFunctions::MainFunctions ( QWidget * parent )
 
38
    : AbstractConfigWidget ( parent )
 
39
{
 
40
  setObjectName ( QLatin1String ( "MainFunctions" ) );
 
41
  /*: GroupBoxTitle */
 
42
  setTitle ( trUtf8 ( "Features" ) );
 
43
  setFlat ( true );
 
44
 
 
45
  QFormLayout* layout = new QFormLayout ( this );
 
46
  layout->setLabelAlignment ( Qt::AlignRight );
 
47
 
 
48
  showRubberband = new QCheckBox ( trUtf8 ( "Display Rubberband" ), this );
 
49
  /*: ToolTip */
 
50
  showRubberband->setToolTip ( trUtf8 ( "enable rubberband at application start" ) );
 
51
  /*: WhatsThis */
 
52
  showRubberband->setWhatsThis ( trUtf8 ( "always show the rubberband on application start" ) );
 
53
  showRubberband->setChecked ( true );
 
54
  layout->addRow ( showRubberband );
 
55
 
 
56
  startMinimized = new QCheckBox ( trUtf8 ( "Start Minimized" ), this );
 
57
  /*: ToolTip */
 
58
  startMinimized->setToolTip ( trUtf8 ( "start qx11grab minimized" ) );
 
59
  /*: WhatsThis */
 
60
  startMinimized->setWhatsThis ( trUtf8 ( "only show qx11grab on start in systray" ) );
 
61
  startMinimized->setChecked ( true );
 
62
  layout->addRow ( startMinimized );
 
63
 
 
64
  expertMode = new QCheckBox ( trUtf8 ( "Expert Mode" ), this );
 
65
  /*: ToolTip */
 
66
  expertMode->setToolTip ( trUtf8 ( "Enable/Disable expert editor mode" ) );
 
67
  /*: WhatsThis */
 
68
  expertMode->setWhatsThis ( trUtf8 ( "Enable auto insert my expert settings" ) );
 
69
  expertMode->setChecked ( false );
 
70
  layout->addRow ( expertMode );
 
71
 
 
72
  unsavedChanges = new QCheckBox ( trUtf8 ( "record with unsaved changes" ), this );
 
73
  /*: ToolTip */
 
74
  unsavedChanges->setToolTip ( trUtf8 ( "force start record with unsaved changes" ) );
 
75
  /*: WhatsThis */
 
76
  unsavedChanges->setWhatsThis ( trUtf8 ( "start recording if qx11grab have unsaved changes" ) );
 
77
  unsavedChanges->setChecked ( false );
 
78
  layout->addRow ( unsavedChanges );
 
79
 
 
80
  m_threadsSpinBox = new ThreadsSpinBox ( this );
 
81
  layout->addRow ( trUtf8 ( "Threads" ), m_threadsSpinBox );
 
82
 
 
83
  m_logLevelComboBox = new LogLevelComboBox ( this );
 
84
  layout->addRow ( trUtf8 ( "Report Level" ), m_logLevelComboBox );
 
85
 
 
86
  m_iconThemeSelector = new IconThemeSelector ( this );
 
87
  layout->addRow ( trUtf8 ( "Icon Theme" ), m_iconThemeSelector );
 
88
 
 
89
  m_graphicsEngine = new GraphicsEngineSelecter ( this );
 
90
  layout->addRow ( trUtf8 ( "Graphics System" ), m_graphicsEngine );
 
91
 
 
92
  layout->setVerticalSpacing ( 1 );
 
93
  setLayout ( layout );
 
94
 
 
95
  connect ( showRubberband, SIGNAL ( clicked ( bool ) ),
 
96
            this, SIGNAL ( postUpdate ( bool ) ) );
 
97
 
 
98
  connect ( startMinimized, SIGNAL ( clicked ( bool ) ),
 
99
            this, SIGNAL ( postUpdate ( bool ) ) );
 
100
 
 
101
  connect ( m_iconThemeSelector, SIGNAL ( modified ( bool ) ),
 
102
            this, SIGNAL ( postUpdate ( bool ) ) );
 
103
}
 
104
 
 
105
void MainFunctions::load ( Settings * cfg )
 
106
{
 
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() );
 
115
}
 
116
 
 
117
void MainFunctions::save ( Settings * cfg )
 
118
{
 
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() );
 
127
}
 
128
 
 
129
MainFunctions::~MainFunctions()
 
130
{}