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

« back to all changes in this revision

Viewing changes to utilities/setup/setupmime.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-21 23:19:11 UTC
  • mfrom: (1.2.33 upstream) (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20101221231911-z9jip7s5aht1jqn9
Tags: 2:1.7.0-1ubuntu1
* Merge from Debian Experimental. Remaining Ubuntu changes:
  - Export .pot name and copy to plugins in debian/rules
  - Version build-depends on kipi-plugins-dev to ensure build is against the
    same version on all archs
* Drop debian/patches/kubuntu_01_linker.diff, incoporated upstream
* Remove patches directory and unused patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
{
55
55
public:
56
56
 
57
 
    SetupMimePriv()
 
57
    SetupMimePriv() :
 
58
        imageFileFilterLabel(0),
 
59
        movieFileFilterLabel(0),
 
60
        audioFileFilterLabel(0),
 
61
        revertImageFileFilterBtn(0),
 
62
        revertMovieFileFilterBtn(0),
 
63
        revertAudioFileFilterBtn(0),
 
64
        imageFileFilterEdit(0),
 
65
        movieFileFilterEdit(0),
 
66
        audioFileFilterEdit(0)
58
67
    {
59
 
        imageFileFilterLabel     = 0;
60
 
        movieFileFilterLabel     = 0;
61
 
        audioFileFilterLabel     = 0;
62
 
        imageFileFilterEdit      = 0;
63
 
        movieFileFilterEdit      = 0;
64
 
        audioFileFilterEdit      = 0;
65
 
        revertImageFileFilterBtn = 0;
66
 
        revertMovieFileFilterBtn = 0;
67
 
        revertAudioFileFilterBtn = 0;
68
68
    }
69
69
 
70
70
    QLabel*      imageFileFilterLabel;
81
81
};
82
82
 
83
83
SetupMime::SetupMime(QWidget* parent)
84
 
         : QScrollArea(parent), d(new SetupMimePriv)
 
84
    : QScrollArea(parent), d(new SetupMimePriv)
85
85
{
86
 
    QWidget *panel = new QWidget(viewport());
 
86
    QWidget* panel = new QWidget(viewport());
87
87
    setWidget(panel);
88
88
    setWidgetResizable(true);
89
89
 
90
 
    QVBoxLayout *layout = new QVBoxLayout(panel);
 
90
    QVBoxLayout* layout = new QVBoxLayout(panel);
91
91
 
92
92
    // --------------------------------------------------------
93
93
 
94
 
    QLabel *explanationLabel = new QLabel;
 
94
    QLabel* explanationLabel = new QLabel;
95
95
    explanationLabel->setText(i18n("<p>digiKam attempts to support all of the image formats that digital cameras produce, "
96
96
                                   "while being able to handle a few other important video and audio formats.</p> "
97
97
                                   "<p>You can add to the already-appreciable list of formats that digiKam handles by "
100
100
 
101
101
    // --------------------------------------------------------
102
102
 
103
 
    QGroupBox *imageFileFilterBox = new QGroupBox(i18n("Image Files"), panel);
 
103
    QGroupBox* imageFileFilterBox = new QGroupBox(i18n("Image Files"), panel);
104
104
    QGridLayout* grid1            = new QGridLayout(imageFileFilterBox);
105
105
 
106
 
    QLabel *logoLabel1 = new QLabel(imageFileFilterBox);
 
106
    QLabel* logoLabel1 = new QLabel(imageFileFilterBox);
107
107
    logoLabel1->setPixmap(DesktopIcon("image-jp2"));
108
108
 
109
109
    d->imageFileFilterLabel = new QLabel(imageFileFilterBox);
110
110
    d->imageFileFilterLabel->setText(i18n("Additional &image file extensions (<a href='image'>Currently-supported types</a>):"));
111
111
 
112
 
    KHBox *hbox1 = new KHBox(imageFileFilterBox);
 
112
    KHBox* hbox1 = new KHBox(imageFileFilterBox);
113
113
    d->imageFileFilterEdit = new KLineEdit(hbox1);
114
114
    d->imageFileFilterEdit->setWhatsThis( i18n("<p>Here you can add the extensions of image files (including RAW files) "
115
 
                                               "to be displayed in the Album view. Just put \"xyz abc\" "
116
 
                                               "to display files with the xyz and abc extensions in your Album view.</p>"
117
 
                                               "<p>You can also remove file formats that are shown by default "
118
 
                                               "by putting a minus sign in front of the extension: e.g. \"-gif\" would remove all GIF files "
119
 
                                               "from your Album view and any trace of them in your database. "
120
 
                                               "They would not be deleted, just not shown in digiKam.</p>"
121
 
                                               "<p><b>Warning:</b> Removing files from the database means losing "
122
 
                                               "all of their tags and ratings.</p>"));
 
115
                                          "to be displayed in the Album view. Just put \"xyz abc\" "
 
116
                                          "to display files with the xyz and abc extensions in your Album view.</p>"
 
117
                                          "<p>You can also remove file formats that are shown by default "
 
118
                                          "by putting a minus sign in front of the extension: e.g. \"-gif\" would remove all GIF files "
 
119
                                          "from your Album view and any trace of them in your database. "
 
120
                                          "They would not be deleted, just not shown in digiKam.</p>"
 
121
                                          "<p><b>Warning:</b> Removing files from the database means losing "
 
122
                                          "all of their tags and ratings.</p>"));
123
123
    d->imageFileFilterLabel->setBuddy(d->imageFileFilterEdit);
124
124
    hbox1->setStretchFactor(d->imageFileFilterEdit, 10);
125
125
 
136
136
 
137
137
    // --------------------------------------------------------
138
138
 
139
 
    QGroupBox *movieFileFilterBox = new QGroupBox(i18n("Movie Files"), panel);
 
139
    QGroupBox* movieFileFilterBox = new QGroupBox(i18n("Movie Files"), panel);
140
140
    QGridLayout* grid2            = new QGridLayout(movieFileFilterBox);
141
141
 
142
 
    QLabel *logoLabel2 = new QLabel(movieFileFilterBox);
 
142
    QLabel* logoLabel2 = new QLabel(movieFileFilterBox);
143
143
    logoLabel2->setPixmap(DesktopIcon("video-mpeg"));
144
144
 
145
145
    d->movieFileFilterLabel = new QLabel(movieFileFilterBox);
146
146
    d->movieFileFilterLabel->setText(i18n("Additional &movie file extensions (<a href='video'>Currently-supported types</a>):"));
147
147
 
148
 
    KHBox *hbox2 = new KHBox(movieFileFilterBox);
 
148
    KHBox* hbox2 = new KHBox(movieFileFilterBox);
149
149
    d->movieFileFilterEdit = new KLineEdit(hbox2);
150
150
    d->movieFileFilterEdit->setWhatsThis( i18n("<p>Here you can add extra extensions of video files "
151
 
                                               "to be displayed in your Album view. Just write \"xyz abc\" "
152
 
                                               "to support files with the *.xyz and *.abc extensions. "
153
 
                                               "Clicking on these files will "
154
 
                                               "play them in an embedded KDE movie player.</p>"
155
 
                                               "<p>You can also remove file formats that are supported by default "
156
 
                                               "by putting a minus sign in front of the extension: e.g. \"-avi\" would remove "
157
 
                                               "all AVI files from your Album view and any trace of them in your database. "
158
 
                                               "They would not be deleted, just not shown in digiKam.</p>"
159
 
                                               "<p><b>Warning:</b> Removing files from the database means losing "
160
 
                                               "all of their tags and ratings.</p>"));
 
151
                                          "to be displayed in your Album view. Just write \"xyz abc\" "
 
152
                                          "to support files with the *.xyz and *.abc extensions. "
 
153
                                          "Clicking on these files will "
 
154
                                          "play them in an embedded KDE movie player.</p>"
 
155
                                          "<p>You can also remove file formats that are supported by default "
 
156
                                          "by putting a minus sign in front of the extension: e.g. \"-avi\" would remove "
 
157
                                          "all AVI files from your Album view and any trace of them in your database. "
 
158
                                          "They would not be deleted, just not shown in digiKam.</p>"
 
159
                                          "<p><b>Warning:</b> Removing files from the database means losing "
 
160
                                          "all of their tags and ratings.</p>"));
161
161
    d->movieFileFilterLabel->setBuddy(d->movieFileFilterEdit);
162
162
    hbox2->setStretchFactor(d->movieFileFilterEdit, 10);
163
163
 
174
174
 
175
175
    // --------------------------------------------------------
176
176
 
177
 
    QGroupBox *audioFileFilterBox = new QGroupBox(i18n("Audio Files"), panel);
 
177
    QGroupBox* audioFileFilterBox = new QGroupBox(i18n("Audio Files"), panel);
178
178
    QGridLayout* grid3            = new QGridLayout(audioFileFilterBox);
179
179
 
180
 
    QLabel *logoLabel3 = new QLabel(audioFileFilterBox);
 
180
    QLabel* logoLabel3 = new QLabel(audioFileFilterBox);
181
181
    logoLabel3->setPixmap(DesktopIcon("audio-basic"));
182
182
 
183
183
    d->audioFileFilterLabel = new QLabel(audioFileFilterBox);
184
184
    d->audioFileFilterLabel->setText(i18n("Additional &audio file extensions (<a href='audio'>Currently-supported types</a>):"));
185
185
 
186
 
    KHBox *hbox3 = new KHBox(audioFileFilterBox);
 
186
    KHBox* hbox3 = new KHBox(audioFileFilterBox);
187
187
    d->audioFileFilterEdit = new KLineEdit(hbox3);
188
188
    d->audioFileFilterEdit->setWhatsThis( i18n("<p>Here you can add extra extensions of audio files "
189
 
                                               "to be displayed in your Album view. Just write \"mp7\" "
190
 
                                               "to support files with the *.mp7 extension. "
191
 
                                               "Clicking on these files will "
192
 
                                               "play them in an embedded KDE audio player.</p>"
193
 
                                               "<p>You can also remove file formats that are supported by default "
194
 
                                               "by putting a minus sign in front of the extension: e.g. \"-ogg\" would "
195
 
                                               "remove all OGG files from your Album view and any trace of them in your database. "
196
 
                                               "They would not be deleted, just not shown in digiKam.</p>"
197
 
                                               "<p><b>Warning:</b> Removing files from the database means losing "
198
 
                                               "all of their tags and ratings.</p>"));
 
189
                                          "to be displayed in your Album view. Just write \"mp7\" "
 
190
                                          "to support files with the *.mp7 extension. "
 
191
                                          "Clicking on these files will "
 
192
                                          "play them in an embedded KDE audio player.</p>"
 
193
                                          "<p>You can also remove file formats that are supported by default "
 
194
                                          "by putting a minus sign in front of the extension: e.g. \"-ogg\" would "
 
195
                                          "remove all OGG files from your Album view and any trace of them in your database. "
 
196
                                          "They would not be deleted, just not shown in digiKam.</p>"
 
197
                                          "<p><b>Warning:</b> Removing files from the database means losing "
 
198
                                          "all of their tags and ratings.</p>"));
199
199
    d->audioFileFilterLabel->setBuddy(d->audioFileFilterEdit);
200
200
    hbox3->setStretchFactor(d->audioFileFilterEdit, 10);
201
201
 
231
231
    connect(d->revertAudioFileFilterBtn, SIGNAL(clicked()),
232
232
            this, SLOT(slotRevertAudioFileFilter()));
233
233
 
234
 
    connect(d->imageFileFilterLabel, SIGNAL(linkActivated(const QString &)),
 
234
    connect(d->imageFileFilterLabel, SIGNAL(linkActivated(const QString&)),
235
235
            this, SLOT(slotShowCurrentImageSettings()));
236
236
 
237
 
    connect(d->movieFileFilterLabel, SIGNAL(linkActivated(const QString &)),
 
237
    connect(d->movieFileFilterLabel, SIGNAL(linkActivated(const QString&)),
238
238
            this, SLOT(slotShowCurrentMovieSettings()));
239
239
 
240
 
    connect(d->audioFileFilterLabel, SIGNAL(linkActivated(const QString &)),
 
240
    connect(d->audioFileFilterLabel, SIGNAL(linkActivated(const QString&)),
241
241
            this, SLOT(slotShowCurrentAudioSettings()));
242
242
 
243
243
    // --------------------------------------------------------
269
269
    {
270
270
        if (imageFilter.contains('-' + format)
271
271
            || imageFilter.contains("-*." + format))
 
272
        {
272
273
            removedImageFormats << format;
 
274
        }
273
275
    }
274
276
 
275
277
    if (!removedImageFormats.isEmpty())
276
278
    {
277
279
        int result = KMessageBox::warningYesNo(this,
278
 
                                           i18n("<p>You have chosen to remove the following image formats "
279
 
                                                "from the list of supported formats: <b>%1</b>.</p>"
280
 
                                                "<p>These are very common formats. If you have images in your collection "
281
 
                                                "with these formats, they will be removed from the database and you will "
282
 
                                                "lose all information about them, including rating and tags.</p>"
283
 
                                                "<p>Are you sure you want to apply your changes and lose the support for these formats?</p>",
284
 
                                                removedImageFormats.join(" "))
 
280
                                               i18n("<p>You have chosen to remove the following image formats "
 
281
                                                       "from the list of supported formats: <b>%1</b>.</p>"
 
282
                                                       "<p>These are very common formats. If you have images in your collection "
 
283
                                                       "with these formats, they will be removed from the database and you will "
 
284
                                                       "lose all information about them, including rating and tags.</p>"
 
285
                                                       "<p>Are you sure you want to apply your changes and lose the support for these formats?</p>",
 
286
                                                       removedImageFormats.join(" "))
285
287
                                              );
 
288
 
286
289
        if (result != KMessageBox::Yes)
 
290
        {
287
291
            return;
 
292
        }
288
293
    }
289
294
 
290
295
    DatabaseAccess().db()->setUserFilterSettings(d->imageFileFilterEdit->text(),
291
 
                                                 d->movieFileFilterEdit->text(),
292
 
                                                 d->audioFileFilterEdit->text());
 
296
            d->movieFileFilterEdit->text(),
 
297
            d->audioFileFilterEdit->text());
293
298
}
294
299
 
295
300
void SetupMime::readSettings()