~ubuntu-branches/ubuntu/trusty/digikam/trusty

« back to all changes in this revision

Viewing changes to core/showfoto/main/showfoto.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        : 2004-11-22
7
7
 * Description : stand alone digiKam image editor GUI
8
8
 *
9
 
 * Copyright (C) 2004-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
10
 
 * Copyright (C) 2006-2011 by Marcel Wiesweg <marcel.wiesweg@gmx.de>
11
 
 * Copyright (C) 2009-2011 by Andi Clemens <andi dot clemens at googlemail dot com>
12
 
 * Copyright (C) 2004-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu>
13
 
 * Copyright (C) 2005-2006 by Tom Albers <tomalbers@kde.nl>
14
 
 * Copyright (C) 2008 by Arnd Baecker <arnd dot baecker at web dot de>
 
9
 * Copyright (C) 2004-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
10
 * Copyright (C) 2006-2012 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
 
11
 * Copyright (C) 2009-2011 by Andi Clemens <andi dot clemens at gmail dot com>
 
12
 * Copyright (C) 2004-2005 by Renchi Raju <renchi dot raju at gmail dot com>
 
13
 * Copyright (C) 2005-2006 by Tom Albers <tomalbers at kde dot nl>
 
14
 * Copyright (C) 2008      by Arnd Baecker <arnd dot baecker at web dot de>
15
15
 *
16
16
 * This program is free software; you can redistribute it
17
17
 * and/or modify it under the terms of the GNU General
96
96
// Local includes
97
97
 
98
98
#include "canvas.h"
99
 
#include "dimginterface.h"
 
99
#include "editorcore.h"
100
100
#include "dmetadata.h"
101
101
#include "editorstackview.h"
102
102
#include "iccsettingscontainer.h"
104
104
#include "imageplugin.h"
105
105
#include "imagepluginloader.h"
106
106
#include "imagepropertiessidebar.h"
107
 
#include "iofilesettingscontainer.h"
 
107
#include "iofilesettings.h"
108
108
#include "loadingcache.h"
109
109
#include "loadingcacheinterface.h"
110
 
#include "savingcontextcontainer.h"
 
110
#include "savingcontext.h"
111
111
#include "setup.h"
112
112
#include "setupmisc.h"
113
113
#include "setupicc.h"
124
124
namespace ShowFoto
125
125
{
126
126
 
127
 
class ShowFoto::ShowFotoPriv
 
127
class ShowFoto::Private
128
128
{
129
129
public:
130
130
 
131
 
    ShowFotoPriv() :
 
131
    Private() :
132
132
        deleteItem2Trash(true),
133
133
        validIccPath(true),
134
134
        itemsNb(0),
166
166
};
167
167
 
168
168
ShowFoto::ShowFoto(const KUrl::List& urlList)
169
 
    : Digikam::EditorWindow("Showfoto"), d(new ShowFotoPriv)
 
169
    : Digikam::EditorWindow("Showfoto"), d(new Private)
170
170
{
171
171
    setXMLFile("showfotoui.rc");
172
172
 
189
189
    KIconLoader::global()->addAppDir("digikam");
190
190
 
191
191
    KSharedConfig::Ptr config = KGlobal::config();
192
 
    KConfigGroup group = config->group(EditorWindow::CONFIG_GROUP_NAME);
 
192
    KConfigGroup group        = config->group(EditorWindow::CONFIG_GROUP_NAME);
193
193
 
194
194
    if (group.readEntry("ShowSplash", true) && !kapp->isSessionRestored())
195
195
    {
211
211
    {
212
212
        d->splash->message(i18n("Checking ICC repository..."));
213
213
    }
 
214
 
214
215
    d->validIccPath = Digikam::SetupICC::iccRepositoryIsValid();
215
216
 
216
217
    // Populate Themes
219
220
    {
220
221
        d->splash->message(i18n("Loading themes..."));
221
222
    }
 
223
 
222
224
    Digikam::ThemeManager::instance();
223
225
 
224
226
    // -- Build the GUI -----------------------------------
378
380
{
379
381
    setupStandardConnections();
380
382
 
 
383
    connect(d->thumbBarDock, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
 
384
            d->thumbBar, SLOT(slotDockLocationChanged(Qt::DockWidgetArea)));
 
385
 
381
386
    connect(d->thumbBar, SIGNAL(signalUrlSelected(KUrl)),
382
387
            this, SLOT(slotOpenUrl(KUrl)));
383
388
 
393
398
 
394
399
void ShowFoto::setupUserArea()
395
400
{
396
 
    KSharedConfig::Ptr config = KGlobal::config();
397
 
    KConfigGroup group        = config->group(EditorWindow::CONFIG_GROUP_NAME);
 
401
    KSharedConfig::Ptr config  = KGlobal::config();
 
402
    KConfigGroup group         = config->group(EditorWindow::CONFIG_GROUP_NAME);
398
403
 
399
 
    QWidget* widget   = new QWidget(this);
400
 
    QHBoxLayout* hlay = new QHBoxLayout(widget);
401
 
    m_splitter        = new Digikam::SidebarSplitter(widget);
 
404
    QWidget* widget            = new QWidget(this);
 
405
    QHBoxLayout* hlay          = new QHBoxLayout(widget);
 
406
    m_splitter                 = new Digikam::SidebarSplitter(widget);
402
407
 
403
408
    KMainWindow* viewContainer = new KMainWindow(widget, Qt::Widget);
404
409
    m_splitter->addWidget(viewContainer);
408
413
 
409
414
    m_splitter->setStretchFactor(1, 10);      // set Canvas default size to max.
410
415
 
411
 
    d->rightSideBar   = new Digikam::ImagePropertiesSideBar(widget, m_splitter, KMultiTabBar::Right);
 
416
    d->rightSideBar            = new Digikam::ImagePropertiesSideBar(widget, m_splitter, KMultiTabBar::Right);
412
417
    d->rightSideBar->setObjectName("ShowFoto Sidebar Right");
413
418
 
414
419
    hlay->addWidget(m_splitter);
449
454
    d->thumbBarDock->setAllowedAreas(Qt::LeftDockWidgetArea |
450
455
                                     Qt::TopDockWidgetArea  |
451
456
                                     Qt::BottomDockWidgetArea);
452
 
    d->thumbBar = new Digikam::ThumbBarView(d->thumbBarDock, orientation);
 
457
    d->thumbBar     = new Digikam::ThumbBarView(d->thumbBarDock, orientation);
453
458
    d->thumbBarDock->setWidget(d->thumbBar);
454
459
    viewContainer->addDockWidget(dockArea, d->thumbBarDock);
455
460
    d->thumbBarDock->setFloating(false);
479
484
 
480
485
    d->openFilesInFolderAction = new KAction(KIcon("folder-image"), i18n("Open folder"), this);
481
486
    d->openFilesInFolderAction->setShortcut(KShortcut(Qt::CTRL+Qt::SHIFT+Qt::Key_O));
482
 
    connect(d->openFilesInFolderAction, SIGNAL(triggered()), this, SLOT(slotOpenFilesInFolder()));
 
487
 
 
488
    connect(d->openFilesInFolderAction, SIGNAL(triggered()),
 
489
            this, SLOT(slotOpenFilesInFolder()));
 
490
 
483
491
    actionCollection()->addAction("showfoto_open_folder", d->openFilesInFolderAction);
484
492
 
485
493
    actionCollection()->addAction(KStandardAction::Quit, "showfoto_quit", this, SLOT(close()));
542
550
 
543
551
    QString currentStyle = kapp->style()->objectName();
544
552
    QString newStyle     = group.readEntry("Application Style", currentStyle);
 
553
 
545
554
    if (newStyle != currentStyle)
546
555
        kapp->setStyle(newStyle);
547
556
 
559
568
        m_fileDeleteAction->setText(i18n("Delete File"));
560
569
    }
561
570
 
562
 
    /*bool exifRotate = group.readEntry("EXIF Rotate", true);
563
 
    m_setExifOrientationTag   = group.readEntry("EXIF Set Orientation", true);*/
 
571
/*
 
572
    bool exifRotate = group.readEntry("EXIF Rotate", true);
 
573
    m_setExifOrientationTag   = group.readEntry("EXIF Set Orientation", true);
 
574
*/
564
575
 
565
576
    Digikam::ThumbBarToolTipSettings settings;
566
577
    settings.showToolTips   = group.readEntry("Show ToolTips", true);
681
692
 
682
693
bool ShowFoto::setup(bool iccSetupPage)
683
694
{
684
 
    QPointer<Setup> setup = new Setup(this, 0, iccSetupPage ? Setup::ICCPage : Setup::LastPageUsed);
 
695
    QPointer<Setup> setup = new Setup(this, iccSetupPage ? Setup::ICCPage : Setup::LastPageUsed);
685
696
 
686
697
    if (setup->exec() != QDialog::Accepted)
687
698
    {
816
827
    KConfigGroup group        = config->group(EditorWindow::CONFIG_GROUP_NAME);
817
828
 
818
829
    QDir::SortFlags flag;
819
 
    bool reverse = group.readEntry("ReverseSort", false);
 
830
    bool            reverse   = group.readEntry("ReverseSort", false);
820
831
 
821
832
    switch (group.readEntry("SortOrder", (int)SetupMisc::SortByDate))
822
833
    {
1031
1042
    d->thumbBar->invalidateThumb(d->currentItem);
1032
1043
 
1033
1044
    // Pop-up a message to bring user when save is done.
1034
 
    Digikam::KNotificationWrapper("editorsavefilecompleted", i18n("save file is completed..."),
 
1045
    Digikam::KNotificationWrapper("editorsavefilecompleted", i18n("Image saved successfully"),
1035
1046
                                  this, windowTitle());
1036
1047
 
1037
1048
    resetOrigin();
1059
1070
    slotUpdateItemInfo();
1060
1071
 
1061
1072
    // Pop-up a message to bring user when save is done.
1062
 
    Digikam::KNotificationWrapper("editorsavefilecompleted", i18n("save file is completed..."),
 
1073
    Digikam::KNotificationWrapper("editorsavefilecompleted", i18n("Image saved successfully"),
1063
1074
                                  this, windowTitle());
1064
1075
}
1065
1076
 
1123
1134
        }
1124
1135
        else
1125
1136
        {
1126
 
            KIO::Job* job = KIO::del(urlCurrent);
 
1137
            KIO::Job* const job = KIO::del(urlCurrent);
 
1138
 
1127
1139
            connect(job, SIGNAL(result(KJob*)),
1128
1140
                    this, SLOT(slotDeleteCurrentItemResult(KJob*)) );
1129
1141
        }
1130
1142
    }
1131
1143
    else
1132
1144
    {
1133
 
        KIO::Job* job = KIO::trash(urlCurrent);
 
1145
        KIO::Job* const job = KIO::trash(urlCurrent);
 
1146
 
1134
1147
        connect(job, SIGNAL(result(KJob*)),
1135
1148
                this, SLOT(slotDeleteCurrentItemResult(KJob*)) );
1136
1149
    }
1137
1150
}
1138
1151
 
1139
 
void ShowFoto::slotDeleteCurrentItemResult( KJob* job )
 
1152
void ShowFoto::slotDeleteCurrentItemResult(KJob* job)
1140
1153
{
1141
1154
    if (job->error() != 0)
1142
1155
    {
1199
1212
    }
1200
1213
 
1201
1214
    KSharedConfig::Ptr config = KGlobal::config();
1202
 
    KConfigGroup group = config->group(EditorWindow::CONFIG_GROUP_NAME);
 
1215
    KConfigGroup group        = config->group(EditorWindow::CONFIG_GROUP_NAME);
1203
1216
 
1204
 
    settings.exifRotate = group.readEntry("EXIF Rotate", true);
1205
 
    settings.fileList   = d->thumbBar->itemsUrls();
1206
 
    int   i             = 0;
1207
 
    float cnt           = settings.fileList.count();
1208
 
    m_cancelSlideShow   = false;
 
1217
    settings.exifRotate       = group.readEntry("EXIF Rotate", true);
 
1218
    settings.fileList         = d->thumbBar->itemsUrls();
 
1219
    int   i                   = 0;
 
1220
    float cnt                 = settings.fileList.count();
 
1221
    m_cancelSlideShow         = false;
1209
1222
    Digikam::DMetadata meta;
1210
1223
 
1211
1224
    m_nameLabel->progressBarMode(Digikam::StatusProgressBar::CancelProgressBarMode,
1228
1241
 
1229
1242
    if (!m_cancelSlideShow)
1230
1243
    {
1231
 
        Digikam::SlideShow* slide = new Digikam::SlideShow(settings);
 
1244
        Digikam::SlideShow* const slide = new Digikam::SlideShow(settings);
1232
1245
 
1233
1246
        if (settings.startWithCurrent)
1234
1247
        {