~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to core/utilities/searchwindow/searchutilities.h

  • Committer: Package Import Robot
  • Author(s): Felix Geyer, Rohan Garg, Philip Muškovac, Felix Geyer
  • Date: 2011-09-23 18:18:55 UTC
  • mfrom: (1.2.36 upstream)
  • Revision ID: package-import@ubuntu.com-20110923181855-ifs67wxkugshev9k
Tags: 2:2.1.1-0ubuntu1
[ Rohan Garg ]
* New upstream release (LP: #834190)
  - debian/control
    + Build with libqtwebkit-dev
 - debian/kipi-plugins-common
    + Install libkvkontakte required by kipi-plugins
 - debian/digikam
    + Install panoramagui

[ Philip Muškovac ]
* New upstream release
  - debian/control:
    + Add libcv-dev, libcvaux-dev, libhighgui-dev, libboost-graph1.46-dev,
      libksane-dev, libxml2-dev, libxslt-dev, libqt4-opengl-dev, libqjson-dev,
      libgpod-dev and libqca2-dev to build-deps
    + Add packages for kipi-plugins, libmediawiki, libkface, libkgeomap and
      libkvkontakte
  - debian/rules:
    + Don't build with gphoto2 since it doesn't build with it.
  - Add kubuntu_fix_test_linking.diff to fix linking of the dngconverter test
  - update install files
  - update kubuntu_01_mysqld_executable_name.diff for new cmake layout
    and rename to kubuntu_mysqld_executable_name.diff
* Fix typo in digikam-data description (LP: #804894)
* Fix Vcs links

[ Felix Geyer ]
* Move library data files to the new packages libkface-data, libkgeomap-data
  and libkvkontakte-data.
* Override version of the embedded library packages to 1.0~digikam<version>.
* Exclude the library packages from digikam-dbg to prevent file conflicts in
  the future.
* Call dh_install with --list-missing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of digiKam project
 
4
 * http://www.digikam.org
 
5
 *
 
6
 * Date        : 2008-03-14
 
7
 * Description : User interface for searches
 
8
 *
 
9
 * Copyright (C) 2008-2009 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
 
10
 *
 
11
 * This program is free software; you can redistribute it
 
12
 * and/or modify it under the terms of the GNU General
 
13
 * Public License as published by the Free Software Foundation;
 
14
 * either version 2, or (at your option)
 
15
 * any later version.
 
16
 *
 
17
 * This program is distributed in the hope that it will be useful,
 
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
 * GNU General Public License for more details.
 
21
 *
 
22
 * ============================================================ */
 
23
 
 
24
#ifndef SEARCHUTILITIES_H
 
25
#define SEARCHUTILITIES_H
 
26
 
 
27
// Qt includes
 
28
 
 
29
#include <QObject>
 
30
#include <QWidget>
 
31
#include <QLabel>
 
32
#include <QLineEdit>
 
33
#include <QString>
 
34
#include <QComboBox>
 
35
#include <QDoubleSpinBox>
 
36
#include <QSpinBox>
 
37
 
 
38
// KDE includes
 
39
 
 
40
#include <ksqueezedtextlabel.h>
 
41
 
 
42
// Local includes
 
43
 
 
44
#include "comboboxutilities.h"
 
45
 
 
46
class QVBoxLayout;
 
47
class KTextEdit;
 
48
class QTimeLine;
 
49
class KPushButton;
 
50
 
 
51
namespace Digikam
 
52
{
 
53
 
 
54
class AnimatedClearButton : public QWidget
 
55
{
 
56
    Q_OBJECT
 
57
 
 
58
public:
 
59
 
 
60
    AnimatedClearButton(QWidget* parent = 0);
 
61
 
 
62
    QSize sizeHint () const;
 
63
 
 
64
    void setPixmap(const QPixmap& p);
 
65
    QPixmap pixmap();
 
66
 
 
67
    /**
 
68
     * Sets a primary condition for the button to be shown.
 
69
     * If false, animateVisible() will have no effect.
 
70
     */
 
71
    void setShallBeShown(bool show);
 
72
 
 
73
    /** This parameter determines the behavior when the animation
 
74
     *  to hide the widget has finished:
 
75
     *  If stayVisible is true, the widget remains visible,
 
76
     *  but paints nothing.
 
77
     *  If stayVisible is false, setVisible(false) is called,
 
78
     *  which removes the widget for layouting etc.
 
79
     *  Default: false */
 
80
    void stayVisibleWhenAnimatedOut(bool stayVisible);
 
81
 
 
82
public Q_SLOTS:
 
83
 
 
84
    /// Set visible, possibly with animation
 
85
    void animateVisible(bool visible);
 
86
    /// Set visible without animation
 
87
    void setDirectlyVisible(bool visible);
 
88
 
 
89
Q_SIGNALS:
 
90
 
 
91
    void clicked();
 
92
 
 
93
protected:
 
94
 
 
95
    virtual void paintEvent(QPaintEvent* event);
 
96
    virtual void mouseReleaseEvent(QMouseEvent* event);
 
97
 
 
98
protected Q_SLOTS:
 
99
 
 
100
    void visibleChanged();
 
101
    void updateAnimationSettings();
 
102
 
 
103
private:
 
104
 
 
105
    class AnimatedClearButtonPriv;
 
106
    AnimatedClearButtonPriv* const d;
 
107
};
 
108
 
 
109
// -------------------------------------------------------------------------
 
110
 
 
111
class CustomStepsDoubleSpinBox : public QDoubleSpinBox
 
112
{
 
113
    Q_OBJECT
 
114
 
 
115
public:
 
116
 
 
117
    /** This is a normal QDoubleSpinBox which allows to
 
118
     *  customize the stepping behavior, for cases where
 
119
     *  linear steps are not applicable
 
120
     */
 
121
 
 
122
    CustomStepsDoubleSpinBox(QWidget* parent = 0);
 
123
 
 
124
    virtual void stepBy(int steps);
 
125
 
 
126
    /** Set a list of values that are usually applicable for the
 
127
     *  type of data of the combo box. The user can still type in
 
128
     *  any other value. Boundaries are not touched.
 
129
     *  Up or below the min and max values of the list given,
 
130
     *  default stepping is used.
 
131
     */
 
132
    void setSuggestedValues(const QList<double>& values);
 
133
 
 
134
    /** Sets the value that should be set as first value
 
135
     *  when first moving away from the minimum value. */
 
136
    void setSuggestedInitialValue(double initialValue);
 
137
 
 
138
    /** Allows to set to different default single steps,
 
139
     *  for the range below m_values, the other for above */
 
140
    void setSingleSteps(double smaller, double larger);
 
141
 
 
142
    void setInvertStepping(bool invert);
 
143
 
 
144
    /** Resets to minimum value */
 
145
    void reset();
 
146
 
 
147
private Q_SLOTS:
 
148
 
 
149
    void slotValueChanged(double d);
 
150
 
 
151
private:
 
152
 
 
153
    bool          m_beforeInitialValue;
 
154
    QList<double> m_values;
 
155
    double        m_initialValue;
 
156
    double        m_smallerStep;
 
157
    double        m_largerStep;
 
158
    bool          m_invertStepping;
 
159
};
 
160
 
 
161
// -------------------------------------------------------------------------
 
162
 
 
163
class CustomStepsIntSpinBox : public QSpinBox
 
164
{
 
165
    Q_OBJECT
 
166
 
 
167
public:
 
168
 
 
169
    /** This is a normal QIntSpinBox which allows to
 
170
     *  customize the stepping behavior, for cases where
 
171
     *  linear steps are not applicable
 
172
     */
 
173
 
 
174
    CustomStepsIntSpinBox(QWidget* parent = 0);
 
175
 
 
176
    virtual void stepBy(int steps);
 
177
 
 
178
    /** Set a list of values that are usually applicable for the
 
179
     *  type of data of the combo box. The user can still type in
 
180
     *  any other value. Boundaries are not touched.
 
181
     *  Up or below the min and max values of the list given,
 
182
     *  default stepping is used.
 
183
     */
 
184
    void setSuggestedValues(const QList<int>& values);
 
185
 
 
186
    /** Sets the value that should be set as first value
 
187
     *  when first moving away from the minimum value. */
 
188
    void setSuggestedInitialValue(int initialValue);
 
189
 
 
190
    /** Allows to set to different default single steps,
 
191
     *  for the range below m_values, the other for above */
 
192
    void setSingleSteps(int smaller, int larger);
 
193
 
 
194
    void setInvertStepping(bool invert);
 
195
 
 
196
    /** Call this with a fraction prefix (like "1/") to enable
 
197
     *  magic handling of the value as fraction denominator. */
 
198
    void enableFractionMagic(const QString& prefix);
 
199
 
 
200
    /** Resets to minimum value */
 
201
    void reset();
 
202
 
 
203
    /** value() and setValue() for fraction magic value. */
 
204
    double fractionMagicValue() const;
 
205
    void setFractionMagicValue(double value);
 
206
 
 
207
protected:
 
208
 
 
209
    virtual QString textFromValue(int value) const;
 
210
    virtual int valueFromText(const QString& text) const;
 
211
    virtual StepEnabled stepEnabled() const;
 
212
 
 
213
private Q_SLOTS:
 
214
 
 
215
    void slotValueChanged(int d);
 
216
 
 
217
private:
 
218
 
 
219
    bool          m_beforeInitialValue;
 
220
    QList<int>    m_values;
 
221
    int           m_initialValue;
 
222
    int           m_smallerStep;
 
223
    int           m_largerStep;
 
224
    bool          m_invertStepping;
 
225
    QString       m_fractionPrefix;
 
226
    QString       m_fractionSpecialValueText;
 
227
};
 
228
 
 
229
// -------------------------------------------------------------------------
 
230
 
 
231
class StyleSheetDebugger : public QWidget
 
232
{
 
233
    Q_OBJECT
 
234
 
 
235
public:
 
236
 
 
237
    /** This widget is for development purpose only:
 
238
     *  It allows the developer to change the style sheet
 
239
     *  on a widget dynamically.
 
240
     *  If you want to develop or debug the stylesheet on your widget,
 
241
     *  add temporary code:
 
242
     *  new StyleSheetDebugger(myWidget);
 
243
     *  That's all. Change the style sheet by editing it and pressing Ok. */
 
244
 
 
245
    StyleSheetDebugger(QWidget* object);
 
246
 
 
247
protected Q_SLOTS:
 
248
 
 
249
    void buttonClicked();
 
250
 
 
251
protected:
 
252
 
 
253
    KTextEdit*      m_edit;
 
254
    KPushButton*    m_okButton;
 
255
    QWidget*        m_widget;
 
256
};
 
257
 
 
258
} // namespace Digikam
 
259
 
 
260
#endif // SEARCHUTILITIES_H