~ubuntu-branches/ubuntu/vivid/digikam/vivid

« back to all changes in this revision

Viewing changes to core/utilities/advancedrename/advancedrenamewidget.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-11-26 18:24:20 UTC
  • mfrom: (1.9.1) (3.1.23 experimental)
  • Revision ID: package-import@ubuntu.com-20121126182420-qoy6z0nx4ai0wzcl
Tags: 4:3.0.0~beta3-0ubuntu1
* New upstream release
  - Add build-deps :  libhupnp-dev, libqtgstreamer-dev, libmagickcore-dev
* Merge from debian, remaining changes:
  - Make sure libqt4-opengl-dev, libgl1-mesa-dev and libglu1-mesa-dev only
    install on i386,amd64 and powerpc
  - Depend on libtiff-dev instead of libtiff4-dev
  - Drop digikam breaks/replaces kipi-plugins-common since we're past the
    LTS release now
  - digikam to recommend mplayerthumbs | ffmpegthumbs. We currently only
    have latter in the archives, even though former is also supposed to
    be part of kdemultimedia. (LP: #890059)
  - kipi-plugins to recommend www-browser rather than konqueror directly
    since 2.8 no direct usage of konqueror is present in the flickr
    plugin anymore (LP: #1011211)
  - Keep kubuntu_mysqld_executable_name.diff
  - Don't install libkipi translations
  - Keep deps on libcv-dev, libcvaux-dev
  - Keep split packaging of libraries
  - Replace icons from KDE 3 time in debian/xpm.d/*.xpm with the new
    versions (LP: #658047)
* Update debian/not-installed

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * Date        : 2009-05-22
7
7
 * Description : a control widget for the AdvancedRename utility
8
8
 *
9
 
 * Copyright (C) 2009-2012 by Andi Clemens <andi dot clemens at googlemail dot com>
 
9
 * Copyright (C) 2009-2012 by Andi Clemens <andi dot clemens at gmail dot com>
10
10
 *
11
11
 * This program is free software; you can redistribute it
12
12
 * and/or modify it under the terms of the GNU General
57
57
namespace Digikam
58
58
{
59
59
 
60
 
class AdvancedRenameWidget::AdvancedRenameWidgetPriv
 
60
class AdvancedRenameWidget::Private
61
61
{
62
62
    typedef AdvancedRenameWidget::ControlWidgets CWMask;
63
63
    typedef AdvancedRenameWidget::LayoutStyle    LStyle;
64
64
 
65
65
public:
66
66
 
67
 
    AdvancedRenameWidgetPriv() :
 
67
    Private() :
68
68
        configExpandedStateDefault(true),
69
69
        tooltipToggleButton(0),
70
70
        modifiersToolButton(0),
100
100
    CWMask               controlWidgetsMask;
101
101
    LStyle               layoutStyle;
102
102
};
103
 
const QString AdvancedRenameWidget::AdvancedRenameWidgetPriv::configGroupName("AdvancedRename Widget");
104
 
const QString AdvancedRenameWidget::AdvancedRenameWidgetPriv::configExpandedStateEntry("Options are expanded");
 
103
const QString AdvancedRenameWidget::Private::configGroupName("AdvancedRename Widget");
 
104
const QString AdvancedRenameWidget::Private::configExpandedStateEntry("Options are expanded");
105
105
 
106
106
// --------------------------------------------------------
107
107
 
108
108
AdvancedRenameWidget::AdvancedRenameWidget(QWidget* parent)
109
 
    : QWidget(parent), d(new AdvancedRenameWidgetPriv)
 
109
    : QWidget(parent), d(new Private)
110
110
{
111
111
    setupWidgets();
112
112
}
187
187
 
188
188
void AdvancedRenameWidget::setControlWidgets(ControlWidgets mask)
189
189
{
 
190
    d->controlWidgetsMask = mask;
 
191
 
190
192
    // we need a parser and at least one renaming option to successfully use
191
193
    // this widget.
192
194
    bool enable = d->parser && !(d->parser->options().isEmpty());
200
202
    // layout specific
201
203
    if (d->layoutStyle == LayoutNormal)
202
204
    {
203
 
        d->optionsLabel->setVisible(enable && (mask & TokenButtons) && (d->layoutStyle == LayoutNormal));
204
 
        d->modifiersToolButton->setVisible(enableModBtn && (mask & ModifierToolButton) && (d->layoutStyle == LayoutNormal));
 
205
        d->optionsLabel->setVisible(enable && (mask & TokenButtons));
 
206
        d->modifiersToolButton->setVisible(enableModBtn && (mask & ModifierToolButton));
205
207
    }
206
208
    else
207
209
    {
208
 
        d->optionsButton->setVisible(enableModBtn && (mask & TokenButtons) && (d->layoutStyle == LayoutCompact));
209
 
        d->modifiersButton->setVisible(enableModBtn && (mask & ModifierToolButton) && (d->layoutStyle == LayoutCompact));
 
210
        d->optionsButton->setVisible(enableModBtn && (mask & TokenButtons));
 
211
        d->modifiersButton->setVisible(enableModBtn && (mask & ModifierToolButton));
210
212
    }
211
 
 
212
 
    d->controlWidgetsMask = mask;
213
213
}
214
214
 
215
 
template<class T>
216
 
QMenu* AdvancedRenameWidget::createControlsMenu(QWidget* parent, QList<T*>& list)
 
215
QMenu* AdvancedRenameWidget::createControlsMenu(QWidget* parent, const RulesList& rules)
217
216
{
218
217
    QMenu* menu     = new QMenu(parent);
219
218
    QAction* action = 0;
220
219
 
221
 
    foreach(T* ctrl, list)
 
220
    foreach(Rule* rule, rules)
222
221
    {
223
 
        action = ctrl->registerMenu(menu);
 
222
        action = rule->registerMenu(menu);
224
223
 
225
224
        if (!action)
226
225
        {
227
226
            continue;
228
227
        }
229
228
 
230
 
        connect(ctrl, SIGNAL(signalTokenTriggered(QString)),
 
229
        connect(rule, SIGNAL(signalTokenTriggered(QString)),
231
230
                d->renameInput, SLOT(slotAddToken(QString)));
232
231
    }
233
232
 
240
239
    {
241
240
        setupWidgets();
242
241
 
243
 
        QList<Option*> optionsList     = d->parser->options();
244
 
        QList<Modifier*> modifiersList = d->parser->modifiers();
 
242
        RulesList optionsList   = d->parser->options();
 
243
        RulesList modifiersList = d->parser->modifiers();
245
244
 
246
245
        if (d->layoutStyle == LayoutNormal)
247
246
        {
337
336
 
338
337
    d->renameInput = new AdvancedRenameInput;
339
338
    d->renameInput->setToolTip(i18n("<p>Enter your renaming pattern here. Use the access buttons to quickly add renaming "
340
 
                                    "options and modifiers. For further explanations, use the information toolbutton.</p>"));
 
339
                                    "options and modifiers. For further explanation, use the information button.</p>"));
341
340
 
342
341
    // --------------------------------------------------------
343
342