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

« back to all changes in this revision

Viewing changes to src/filters/drawtext/drawtext.h

  • 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
#ifndef QX11GRAB_DRAWTEXT_H
 
23
#define QX11GRAB_DRAWTEXT_H
 
24
 
 
25
/* QtCore */
 
26
#include <QtCore/QObject>
 
27
#include <QtCore/QSettings>
 
28
#include <QtCore/QString>
 
29
#include <QtCore/QVariant>
 
30
 
 
31
/* QtGui */
 
32
#include <QtGui/QColor>
 
33
#include <QtGui/QComboBox>
 
34
#include <QtGui/QDialog>
 
35
#include <QtGui/QFont>
 
36
#include <QtGui/QIcon>
 
37
#include <QtGui/QLineEdit>
 
38
#include <QtGui/QSpinBox>
 
39
#include <QtGui/QSlider>
 
40
#include <QtGui/QWidget>
 
41
 
 
42
class FontPreview;
 
43
class DropShadowBox;
 
44
class ColorPreview;
 
45
class TextPosition;
 
46
 
 
47
class Q_DECL_EXPORT drawtext : public QDialog
 
48
{
 
49
    Q_OBJECT
 
50
    Q_CLASSINFO ( "Author", "Jürgen Heinemann (Undefined)" )
 
51
    Q_CLASSINFO ( "URL", "http://qx11grab.hjcms.de" )
 
52
 
 
53
  private:
 
54
    QSettings* cfg;
 
55
    void setSettings ( const QString &key, const QVariant &value );
 
56
    const QVariant settingsValue ( const QString &key, const QVariant &defaultValue = QVariant() );
 
57
    void loadDefaults();
 
58
 
 
59
    /** types for color dialog */
 
60
    enum ColorType { BACKGROUND, FOREGROUND, TEXTSHADOW };
 
61
 
 
62
    /** drawed Text previewer */
 
63
    FontPreview* m_fontPreview;
 
64
 
 
65
    /** groubox for shadow configuration */
 
66
    DropShadowBox* m_dropShadowBox;
 
67
 
 
68
    /** color preview label for drawed text */
 
69
    ColorPreview* m_foregroundPreview;
 
70
 
 
71
    /** color preview label for background */
 
72
    ColorPreview* m_backgroundPreview;
 
73
 
 
74
    /** set drawed text Position */
 
75
    TextPosition* m_textPosition;
 
76
 
 
77
    /** icon for combobox items */
 
78
    QIcon fontIcon;
 
79
 
 
80
    /** current selected font */
 
81
    QFont currentFont;
 
82
 
 
83
    /** absolute fontfile path */
 
84
    QString fontFilePath;
 
85
 
 
86
    /** font selector */
 
87
    QComboBox* m_fontComboBox;
 
88
 
 
89
    /** text to draw */
 
90
    QLineEdit* m_textInputEdit;
 
91
 
 
92
    /** slider for font size */
 
93
    QSlider* m_sliderSize;
 
94
 
 
95
    /** filter commandline */
 
96
    QLineEdit* m_lineEditOutput;
 
97
 
 
98
    /** freetype fontfile path */
 
99
    QString fileFilePath;
 
100
 
 
101
    /** text color */
 
102
    QColor fontcolor;
 
103
 
 
104
    /** preview background color */
 
105
    QColor boxcolor;
 
106
 
 
107
    /** text shadow color */
 
108
    QColor shadowcolor;
 
109
 
 
110
    /** get all .ttf files in fontconfig database */
 
111
    void initFontConfigDatabase();
 
112
 
 
113
    /** open qcolordialog and set type */
 
114
    void openColorChooser ( ColorType type );
 
115
 
 
116
  private Q_SLOTS:
 
117
    /** combobox items changed */
 
118
    void fontIndexChanged ( int );
 
119
 
 
120
    /** Slider Size Changed */
 
121
    void fontSizeChanged ( int );
 
122
 
 
123
    /** set previewer background color */
 
124
    void setBackgroundColor();
 
125
 
 
126
    /** set text color */
 
127
    void setForegroundColor();
 
128
 
 
129
    /** set shadow color */
 
130
    void setShadowColor();
 
131
 
 
132
    /** set shadow x, y offset */
 
133
    void setShadowOffset ( int );
 
134
 
 
135
    /** set shadow alpha */
 
136
    void setShadowAlpha ( int );
 
137
 
 
138
    /** update the commandline and all previewers */
 
139
    void updateFont();
 
140
 
 
141
    /** copy dataset into clipboard */
 
142
    void clipper();
 
143
 
 
144
  public:
 
145
    explicit drawtext ( QWidget * parent = 0 );
 
146
 
 
147
    /** initial fontconfig and start dialog */
 
148
    int start();
 
149
 
 
150
    /** filter commandline */
 
151
    Q_SCRIPTABLE const QString data();
 
152
 
 
153
    virtual ~drawtext();
 
154
};
 
155
 
 
156
#endif
 
157