~ubuntu-branches/ubuntu/intrepid/digikam/intrepid

« back to all changes in this revision

Viewing changes to digikam/digikam/digikamapp.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2008-07-17 20:25:39 UTC
  • mfrom: (1.3.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 39.
  • Revision ID: james.westby@ubuntu.com-20080717202539-ttj4and3ds1ldgn1
Tags: upstream-0.9.4
ImportĀ upstreamĀ versionĀ 0.9.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 * 
9
9
 * Copyright (C) 2002-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu> 
10
10
 * Copyright (C)      2006 by Tom Albers <tomalbers@kde.nl>
11
 
 * Copyright (C) 2002-2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
11
 * Copyright (C) 2002-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
12
12
 *
13
13
 * This program is free software; you can redistribute it
14
14
 * and/or modify it under the terms of the GNU General
53
53
#include <kfiledialog.h>
54
54
#include <kmessagebox.h>
55
55
#include <kwin.h>
 
56
#include <kimageio.h>
56
57
#include <dcopref.h>
57
58
 
58
59
// libKipi includes.
77
78
#include "setupplugins.h"
78
79
#include "setupeditor.h"
79
80
#include "setupicc.h"
 
81
#include "rawcameradlg.h"
80
82
#include "lighttablewindow.h"
81
83
#include "imagewindow.h"
82
84
#include "imageinfo.h"
107
109
    d = new DigikamAppPriv;
108
110
    m_instance = this;
109
111
    d->config  = kapp->config();
 
112
    d->config->setGroup("General Settings");
110
113
 
111
114
    if(d->config->readBoolEntry("Show Splash", true) &&
112
115
       !kapp->isRestored())
115
118
        d->splashScreen->show();
116
119
    }
117
120
 
 
121
    if(d->splashScreen)
 
122
        d->splashScreen->message(i18n("Initializing..."), AlignLeft, white);
 
123
 
 
124
    // Register image formats (especially for TIFF )
 
125
    KImageIO::registerFormats();
 
126
 
118
127
    d->albumSettings = new AlbumSettings();
119
128
    d->albumSettings->readSettings();
120
129
 
121
 
    d->albumManager = AlbumManager::instance();
 
130
    d->albumManager = new Digikam::AlbumManager();
 
131
 
122
132
    AlbumLister::instance();
123
133
 
124
134
    d->cameraMediaList = new KPopupMenu;
155
165
 
156
166
    KDcrawIface::DcrawBinary::instance()->checkSystem();
157
167
 
158
 
    // Actual file scanning is done in main() - is this necessary here?
159
 
    d->albumManager->setLibraryPath(d->albumSettings->getAlbumLibraryPath());
 
168
    if(d->splashScreen)
 
169
        d->splashScreen->message(i18n("Scan Albums"), AlignLeft, white);
 
170
 
 
171
    d->albumManager->setLibraryPath(d->albumSettings->getAlbumLibraryPath(), d->splashScreen);
160
172
 
161
173
    // Read albums from database
162
174
    if(d->splashScreen)
191
203
        ImageWindow::imagewindow()->close(true);
192
204
 
193
205
    // Close and delete light table instance.
194
 
        
 
206
 
195
207
    if (LightTableWindow::lightTableWindowCreated())
196
208
        LightTableWindow::lightTableWindow()->close(true);
197
209
 
264
276
    }
265
277
 
266
278
    // Report errors from dcraw detection.
267
 
 
268
279
    KDcrawIface::DcrawBinary::instance()->checkReport();
269
280
 
270
281
    // Init album icon view zoom factor. 
271
282
    slotThumbSizeChanged(d->albumSettings->getDefaultIconSize());
272
 
    slotZoomSliderChanged(d->albumSettings->getDefaultIconSize());
273
283
}
274
284
 
275
285
const QPtrList<KAction>& DigikamApp::menuImageActions()
347
357
 
348
358
    connect(d->view, SIGNAL(signalAlbumSelected(bool)),
349
359
            this, SLOT(slotAlbumSelected(bool)));
350
 
            
 
360
 
351
361
    connect(d->view, SIGNAL(signalTagSelected(bool)),
352
362
            this, SLOT(slotTagSelected(bool)));
353
363
 
367
377
    d->albumIconViewFilter = new AlbumIconViewFilter(statusBar());
368
378
    d->albumIconViewFilter->setMaximumHeight(fontMetrics().height()+4);
369
379
    statusBar()->addWidget(d->albumIconViewFilter, 100, true);
370
 
    
 
380
 
371
381
    //------------------------------------------------------------------------------
372
382
 
373
383
    d->statusZoomBar = new StatusZoomBar(statusBar());
396
406
 
397
407
    connect(d->view, SIGNAL(signalZoomChanged(double, int)),
398
408
            this, SLOT(slotZoomChanged(double, int)));
399
 
    
 
409
 
400
410
    connect(d->view, SIGNAL(signalTogglePreview(bool)),
401
411
            this, SLOT(slotTogglePreview(bool)));
402
412
 
 
413
    connect(d->albumIconViewFilter, SIGNAL(signalResetTagFilters()),
 
414
            this, SIGNAL(signalResetTagFilters()));
 
415
 
403
416
    connect(d->statusNavigateBar, SIGNAL(signalFirstItem()),
404
417
            d->view, SLOT(slotFirstItem()));
405
418
 
424
437
                           i18n("Exit preview mode"),
425
438
                           Key_Escape, this, SIGNAL(signalEscapePressed()),
426
439
                           false, true);
427
 
    
 
440
 
428
441
    d->accelerators->insert("Next Image Key_Space", i18n("Next Image"),
429
442
                           i18n("Next Image"),
430
443
                           Key_Space, this, SIGNAL(signalNextItem()),
431
444
                           false, true);
432
445
 
433
 
    d->accelerators->insert("Next Image SHIFT+Key_Space", i18n("Next Image"),
434
 
                           i18n("Next Image"),
435
 
                           SHIFT+Key_Space, this, SIGNAL(signalNextItem()),
 
446
    d->accelerators->insert("Previous Image SHIFT+Key_Space", i18n("Previous Image"),
 
447
                           i18n("Previous Image"),
 
448
                           SHIFT+Key_Space, this, SIGNAL(signalPrevItem()),
436
449
                           false, true);
437
450
 
438
451
    d->accelerators->insert("Previous Image Key_Backspace", i18n("Previous Image"),
487
500
    connect(d->themeMenuAction, SIGNAL(activated(const QString&)),
488
501
            this, SLOT(slotChangeTheme(const QString&)));
489
502
 
 
503
    connect(ThemeEngine::instance(), SIGNAL(signalThemeChanged()),
 
504
            this, SLOT(slotThemeChanged()));
 
505
 
490
506
    // -----------------------------------------------------------------
491
507
 
492
508
    d->backwardActionMenu = new KToolBarPopupAction(i18n("&Back"),
500
516
 
501
517
    connect(d->backwardActionMenu->popupMenu(), SIGNAL(aboutToShow()),
502
518
            this, SLOT(slotAboutToShowBackwardMenu()));
503
 
    
 
519
 
504
520
    connect(d->backwardActionMenu->popupMenu(), SIGNAL(activated(int)),
505
521
            d->view, SLOT(slotAlbumHistoryBack(int)));
506
522
 
512
528
                                    actionCollection(),
513
529
                                    "album_forward");
514
530
    d->forwardActionMenu->setEnabled(false);
515
 
    
 
531
 
516
532
    connect(d->forwardActionMenu->popupMenu(), SIGNAL(aboutToShow()),
517
533
            this, SLOT(slotAboutToShowForwardMenu()));
518
534
 
519
535
    connect(d->forwardActionMenu->popupMenu(), SIGNAL(activated(int)),
520
536
            d->view, SLOT(slotAlbumHistoryForward(int)));
521
537
 
522
 
    d->newAction = new KAction(i18n("&New Album..."),
 
538
    d->newAction = new KAction(i18n("&New..."),
523
539
                                   "albumfolder-new",
524
540
                                   KStdAccel::shortcut(KStdAccel::New),
525
541
                                   d->view,
568
584
    connect(d->recurseTagsAction, SIGNAL(toggled(bool)),
569
585
            this, SLOT(slotRecurseTags(bool)));
570
586
 
571
 
    d->deleteAction = new KAction(i18n("Delete Album"),
 
587
    d->deleteAction = new KAction(i18n("Delete"),
572
588
                                    "editdelete",
573
589
                                    0,
574
590
                                    d->view,
593
609
                                    actionCollection(),
594
610
                                    "album_importFolder");
595
611
 
596
 
    d->propsEditAction = new KAction( i18n("Album Properties..."),
 
612
    d->propsEditAction = new KAction( i18n("Properties..."),
597
613
                                    "albumfolder-properties",
598
614
                                    0,
599
615
                                    d->view,
619
635
                                    actionCollection(),
620
636
                                    "album_syncmetadata");
621
637
    d->syncAlbumMetadataAction->setWhatsThis(i18n("Updates all image metadata of the current "
622
 
                                                "album with digiKam database contents "
623
 
                                                "(image metadata will be over-written with data from the database)."));
 
638
                                                  "album with the contents of the digiKam database "
 
639
                                                  "(image metadata will be over-written with data from the database)."));
624
640
 
625
641
    d->openInKonquiAction = new KAction( i18n("Open in Konqueror"),
626
642
                                    "konqueror",
670
686
                                    SLOT(slotImageLightTable()),
671
687
                                    actionCollection(),
672
688
                                    "image_lighttable");
673
 
    d->imageLightTableAction->setWhatsThis(i18n("Put the selected items into the light table thumbbar."));
 
689
    d->imageLightTableAction->setWhatsThis(i18n("Place the selected items on the light table thumbbar."));
674
690
 
675
691
    d->imageAddLightTableAction = new KAction(i18n("Add to Light Table"),
676
692
                                    "lighttableadd",
688
704
                                    SLOT(slotImageRename()),
689
705
                                    actionCollection(),
690
706
                                    "image_rename");
691
 
    d->imageRenameAction->setWhatsThis(i18n("Rename the filename of the currently selected item."));
 
707
    d->imageRenameAction->setWhatsThis(i18n("Change the filename of the currently selected item."));
692
708
 
693
709
    // Pop up dialog to ask user whether to move to trash
694
710
    d->imageDeleteAction            = new KAction(i18n("Delete"),
747
763
    // -----------------------------------------------------------------
748
764
 
749
765
    QSignalMapper *exifOrientationMapper = new QSignalMapper( d->view );
750
 
    
 
766
 
751
767
    connect(exifOrientationMapper, SIGNAL(mapped(int) ),
752
768
            d->view, SLOT(slotImageExifOrientation(int)));
753
769
 
784
800
 
785
801
    connect(d->imageSetExifOrientation1Action, SIGNAL(activated()),
786
802
            exifOrientationMapper, SLOT(map()));
787
 
            
 
803
 
788
804
    connect(d->imageSetExifOrientation2Action, SIGNAL(activated()),
789
805
            exifOrientationMapper, SLOT(map()));
790
 
            
 
806
 
791
807
    connect(d->imageSetExifOrientation3Action, SIGNAL(activated()),
792
808
            exifOrientationMapper, SLOT(map()));
793
 
            
 
809
 
794
810
    connect(d->imageSetExifOrientation4Action, SIGNAL(activated()),
795
811
            exifOrientationMapper, SLOT(map()));
796
 
    
 
812
 
797
813
    connect(d->imageSetExifOrientation5Action, SIGNAL(activated()),
798
814
            exifOrientationMapper, SLOT(map()));
799
 
    
 
815
 
800
816
    connect(d->imageSetExifOrientation6Action, SIGNAL(activated()),
801
817
            exifOrientationMapper, SLOT(map()));
802
 
    
 
818
 
803
819
    connect(d->imageSetExifOrientation7Action, SIGNAL(activated()),
804
820
            exifOrientationMapper, SLOT(map()));
805
 
    
 
821
 
806
822
    connect(d->imageSetExifOrientation8Action, SIGNAL(activated()),
807
823
            exifOrientationMapper, SLOT(map()));
808
824
 
881
897
                                   actionCollection(), 
882
898
                                   "album_zoomfit2window");
883
899
 
884
 
#if KDE_IS_VERSION(3,2,0)
885
 
    d->fullScreenAction = KStdAction::fullScreen(this, SLOT(slotToggleFullScreen()),
886
 
                                                 actionCollection(), this, "full_screen");
887
 
#else
 
900
    // Do not use std KDE action for full screen because action text is too large for app. toolbar.
888
901
    d->fullScreenAction = new KToggleAction(i18n("Full Screen"),
889
902
                                   "window_fullscreen",
890
903
                                   CTRL+SHIFT+Key_F,
892
905
                                   SLOT(slotToggleFullScreen()),
893
906
                                   actionCollection(),
894
907
                                   "full_screen");
895
 
    d->fullScreenAction->setWhatsThis(i18n("Toggle the main window to full screen mode"));
896
 
#endif
 
908
    d->fullScreenAction->setWhatsThis(i18n("Switch the window to full screen mode"));
897
909
 
898
 
    d->slideShowAction = new KActionMenu(i18n("Slide Show"), "slideshow",
 
910
    d->slideShowAction = new KActionMenu(i18n("Slide"), "slideshow",
899
911
                                         actionCollection(), "slideshow");
900
912
 
901
913
    d->slideShowAction->setDelayed(false);
924
936
                                   actionCollection(),
925
937
                                   "app_exit");
926
938
 
 
939
    d->rawCameraListAction = new KAction(i18n("RAW camera supported"), 
 
940
                                   "kdcraw", 
 
941
                                   0, 
 
942
                                   this,
 
943
                                   SLOT(slotRawCameraList()),
 
944
                                   actionCollection(),
 
945
                                   "help_rawcameralist");
 
946
 
927
947
    d->kipiHelpAction = new KAction(i18n("Kipi Plugins Handbook"),
928
948
                                   "kipi",
929
949
                                   0,
937
957
                                   actionCollection(),
938
958
                                   "help_tipofday");
939
959
 
940
 
    d->donateMoneyAction = new KAction(i18n("Make a donation..."),
 
960
    d->donateMoneyAction = new KAction(i18n("Donate..."),
941
961
                                   0,
942
962
                                   0,
943
963
                                   this,
945
965
                                   actionCollection(),
946
966
                                   "help_donatemoney");
947
967
 
 
968
    d->contributeAction = new KAction(i18n("Contribute..."),
 
969
                                      0, 0, 
 
970
                                      this, SLOT(slotContribute()),
 
971
                                      actionCollection(),
 
972
                                      "help_contribute");
 
973
 
948
974
    new DLogoAction(actionCollection(), "logo_action" );
949
975
 
950
976
    // -- Rating actions ---------------------------------------------------------------
951
977
 
952
 
    d->rating0Star = new KAction(i18n("Assign Rating \"No Star\""), CTRL+Key_0,
 
978
    d->rating0Star = new KAction(i18n("Assign Rating \"No Stars\""), CTRL+Key_0,
953
979
                          d->view, SLOT(slotAssignRatingNoStar()),
954
980
                          actionCollection(), "ratenostar");
955
981
    d->rating1Star = new KAction(i18n("Assign Rating \"One Star\""), CTRL+Key_1,
972
998
 
973
999
    KAction* findAction = KStdAction::find(d->view, SLOT(slotNewQuickSearch()),
974
1000
                                           actionCollection(), "search_quick");
975
 
    findAction->setText(i18n("Quick Search..."));
 
1001
    findAction->setText(i18n("Search..."));
976
1002
    findAction->setIconSet(BarIcon("filefind"));
977
1003
 
978
1004
    KAction* advFindAction = KStdAction::find(d->view, SLOT(slotNewAdvancedSearch()),
1197
1223
void DigikamApp::slotTagSelected(bool val)
1198
1224
{
1199
1225
    Album *album = d->albumManager->currentAlbum();
 
1226
    if (!album) return;
1200
1227
    
1201
1228
    if(!val)
1202
1229
    {
1639
1666
    d->albumManager->setLibraryPath(d->albumSettings->getAlbumLibraryPath());
1640
1667
    d->albumManager->startScan();
1641
1668
 
 
1669
    if(d->albumSettings->getShowFolderTreeViewItemsCount())
 
1670
        d->albumManager->refresh();
 
1671
 
1642
1672
    d->view->applySettings();
1643
1673
    d->albumIconViewFilter->readSettings();
1644
1674
    
1727
1757
        d->view->hideSideBars();
1728
1758
 
1729
1759
        showFullScreen();
1730
 
 
1731
1760
        d->fullScreen = true;
1732
1761
    }
1733
1762
}
1751
1780
    KApplication::kApplication()->invokeHelp( QString(), "kipi-plugins" );
1752
1781
}
1753
1782
 
 
1783
void DigikamApp::slotRawCameraList()
 
1784
{
 
1785
    RawCameraDlg dlg(this);
 
1786
    dlg.exec();
 
1787
}
 
1788
 
1754
1789
void DigikamApp::loadPlugins()
1755
1790
{
1756
1791
    if(d->splashScreen)
1863
1898
void DigikamApp::loadCameras()
1864
1899
{
1865
1900
    d->cameraList->load();
1866
 
    
 
1901
 
1867
1902
    d->cameraMenuAction->popupMenu()->insertSeparator();
1868
 
    
 
1903
 
1869
1904
    d->cameraMenuAction->popupMenu()->insertItem(i18n("Browse Media"), d->cameraMediaList);
1870
 
    
 
1905
 
1871
1906
    d->cameraMenuAction->popupMenu()->insertSeparator();
1872
 
    
 
1907
 
1873
1908
    d->cameraMenuAction->insert(new KAction(i18n("Add Camera..."), 0,
1874
1909
                                          this, SLOT(slotSetupCamera()),
1875
1910
                                          actionCollection(),
1882
1917
        d->splashScreen->message(i18n("Loading themes"), AlignLeft, white);
1883
1918
 
1884
1919
    ThemeEngine::instance()->scanThemes();
 
1920
    d->themeMenuAction->setItems(ThemeEngine::instance()->themeNames());
 
1921
    slotThemeChanged();
 
1922
    ThemeEngine::instance()->slotChangeTheme(d->themeMenuAction->currentText());
 
1923
}
 
1924
 
 
1925
void DigikamApp::slotChangeTheme(const QString& theme)
 
1926
{
 
1927
    d->albumSettings->setCurrentTheme(theme);
 
1928
    ThemeEngine::instance()->slotChangeTheme(theme);
 
1929
}
 
1930
 
 
1931
void DigikamApp::slotThemeChanged()
 
1932
{
1885
1933
    QStringList themes(ThemeEngine::instance()->themeNames());
1886
 
 
1887
 
    d->themeMenuAction->setItems(themes);
1888
1934
    int index = themes.findIndex(d->albumSettings->getCurrentTheme());
1889
 
    
1890
1935
    if (index == -1)
1891
1936
        index = themes.findIndex(i18n("Default"));
1892
 
        
 
1937
 
1893
1938
    d->themeMenuAction->setCurrentItem(index);
1894
 
    ThemeEngine::instance()->slotChangeTheme(d->themeMenuAction->currentText());
1895
 
}
1896
 
 
1897
 
void DigikamApp::slotChangeTheme(const QString& theme)
1898
 
{
1899
 
    d->albumSettings->setCurrentTheme(theme);
1900
 
    ThemeEngine::instance()->slotChangeTheme(theme);
1901
1939
}
1902
1940
 
1903
1941
void DigikamApp::slotDatabaseRescan()
1904
1942
{
1905
1943
    ScanLib sLib;
1906
1944
    sLib.startScan();
 
1945
 
 
1946
    d->view->refreshView();
 
1947
 
 
1948
    if (ImageWindow::imagewindowCreated())
 
1949
        ImageWindow::imagewindow()->refreshView();
 
1950
 
 
1951
    if (LightTableWindow::lightTableWindowCreated())
 
1952
        LightTableWindow::lightTableWindow()->refreshView();
1907
1953
}
1908
1954
 
1909
1955
void DigikamApp::slotRebuildAllThumbs()
1935
1981
        return;
1936
1982
 
1937
1983
    BatchAlbumsSyncMetadata *syncMetadata = new BatchAlbumsSyncMetadata(this);
1938
 
    
 
1984
 
1939
1985
    connect(syncMetadata, SIGNAL(signalComplete()),
1940
1986
            this, SLOT(slotSyncAllPicturesMetadataDone()));
1941
1987
 
1952
1998
    KApplication::kApplication()->invokeBrowser("http://www.digikam.org/?q=donation");
1953
1999
}
1954
2000
 
 
2001
void DigikamApp::slotContribute()
 
2002
{
 
2003
    KApplication::kApplication()->invokeBrowser("http://www.digikam.org/?q=contrib");
 
2004
}
 
2005
 
1955
2006
void DigikamApp::slotRecurseAlbums(bool checked)
1956
2007
{
1957
2008
    AlbumLister::instance()->setRecurseAlbums(checked);