[Digikam-devel] extragear/graphics/digikam

Gilles Caulier caulier.gilles at gmail.com
Sat Nov 3 21:26:39 GMT 2007


SVN commit 732444 by cgilles:

digiKam from trunk (KDE4) : First very important improvement here depending of the new Database interface/schema dedicaced to 0.10.0 release.

A new setting in album configuration page have been added to host the database file used by digiKam in a dedicaced place.
Before, the SQlite3 database file (digikam3.db) used by digiKam to store all image informations like Tags, Rating, Comments, Date, etc... 
been store in the root album path. This solution introduce a big problem to use a root album on a network file system like NFS, because 
SQLite3 do not like it (look here for more information : http://www.sqlite.org/faq.html#q7)

The only issue for this problem is to store the databse file in a separate place...

This is want mean than with this commit, digiKam can use a remote root album...

There is a screenshot of the new Album config page :

http://digikam3rdparty.free.fr/Screenshots/digikamKDE4_13.png

The next pending important change to do will to be able to drive more than one root album path with digiKam 0.10.0... 

CCMAIL: digikam-devel at kde.org

CCBUGS: 122516
CCBUGS: 150938
BUG: 129437
BUG: 137694



 M  +72 -58    digikam/albumsettings.cpp  
 M  +3 -0      digikam/albumsettings.h  
 M  +1 -1      digikam/digikamapp.cpp  
 M  +3 -2      digikam/welcomepageview.cpp  
 M  +72 -12    utilities/setup/setupgeneral.cpp  
 M  +5 -1      utilities/setup/setupgeneral.h  


--- trunk/extragear/graphics/digikam/digikam/albumsettings.cpp #732443:732444
@@ -125,6 +125,7 @@
 
     // database settings
     QString                             albumLibraryPath;
+    QString                             databaseFilePath;
     QString                             imageFilefilter;
     QString                             movieFilefilter;
     QString                             audioFilefilter;
@@ -181,78 +182,78 @@
     d->albumCollectionNames.append(i18n("Miscellaneous"));
     d->albumCollectionNames.sort();
 
-    d->albumSortOrder       = AlbumSettings::ByFolder;
-    d->imageSortOrder       = AlbumSettings::ByIName;
-    d->itemRightClickAction = AlbumSettings::ShowPreview;
+    d->albumSortOrder           = AlbumSettings::ByFolder;
+    d->imageSortOrder           = AlbumSettings::ByIName;
+    d->itemRightClickAction     = AlbumSettings::ShowPreview;
 
-    d->defaultImageFilefilter = "*.jpg *.jpeg *.jpe "               // JPEG
-                                "*.jp2 *.jpx *.jpc *.pgx "          // JPEG-2000
-                                "*.tif *.tiff "                     // TIFF
-                                "*.png *.gif *.bmp *.xpm *.ppm *.pnm *.xcf *.pcx";
+    d->defaultImageFilefilter   = "*.jpg *.jpeg *.jpe "               // JPEG
+                                  "*.jp2 *.jpx *.jpc *.pgx "          // JPEG-2000
+                                  "*.tif *.tiff "                     // TIFF
+                                  "*.png *.gif *.bmp *.xpm *.ppm *.pnm *.xcf *.pcx";
 			 
-    d->defaultMovieFilefilter = "*.mpeg *.mpg *.mpo *.mpe "         // MPEG
-                                "*.avi *.mov *.wmf *.asf *.mp4";
+    d->defaultMovieFilefilter   = "*.mpeg *.mpg *.mpo *.mpe "         // MPEG
+                                  "*.avi *.mov *.wmf *.asf *.mp4";
 			 
-    d->defaultAudioFilefilter = "*.ogg *.mp3 *.wma *.wav";
+    d->defaultAudioFilefilter   = "*.ogg *.mp3 *.wma *.wav";
 
     // RAW files estentions supported by dcraw program and 
     // defines to digikam/libs/dcraw/rawfiles.h
-    d->defaultRawFilefilter   = QString(raw_file_extentions);
+    d->defaultRawFilefilter     = QString(raw_file_extentions);
 
-    d->imageFilefilter = d->defaultImageFilefilter;
-    d->movieFilefilter = d->defaultMovieFilefilter;
-    d->audioFilefilter = d->defaultAudioFilefilter;
-    d->rawFilefilter   = d->defaultRawFilefilter;
+    d->imageFilefilter          = d->defaultImageFilefilter;
+    d->movieFilefilter          = d->defaultMovieFilefilter;
+    d->audioFilefilter          = d->defaultAudioFilefilter;
+    d->rawFilefilter            = d->defaultRawFilefilter;
 
-    d->thumbnailSize      = ThumbnailSize::Medium;
-    d->treeThumbnailSize  = 32;
+    d->thumbnailSize            = ThumbnailSize::Medium;
+    d->treeThumbnailSize        = 32;
+ 
+    d->ratingFilterValue        = 0;
+    d->ratingFilterCond         = AlbumLister::GreaterEqualCondition;
 
-    d->ratingFilterValue  = 0;
-    d->ratingFilterCond   = AlbumLister::GreaterEqualCondition;
+    d->showToolTips             = true;
+    d->showSplash               = true;
+    d->useTrash                 = true;
+    d->showTrashDeleteDialog    = true;
+    d->sidebarApplyDirectly     = false;
 
-    d->showToolTips           = true;
-    d->showSplash             = true;
-    d->useTrash               = true;
-    d->showTrashDeleteDialog  = true;
-    d->sidebarApplyDirectly   = false;
+    d->iconShowName             = false;
+    d->iconShowSize             = false;
+    d->iconShowDate             = true;
+    d->iconShowModDate          = true;
+    d->iconShowComments         = true;
+    d->iconShowResolution       = false;
+    d->iconShowTags             = true;
+    d->iconShowRating           = true;
 
-    d->iconShowName           = false;
-    d->iconShowSize           = false;
-    d->iconShowDate           = true;
-    d->iconShowModDate        = true;
-    d->iconShowComments       = true;
-    d->iconShowResolution     = false;
-    d->iconShowTags           = true;
-    d->iconShowRating         = true;
+    d->tooltipShowFileName      = true;
+    d->tooltipShowFileDate      = false;
+    d->tooltipShowFileSize      = false;
+    d->tooltipShowImageType     = false;
+    d->tooltipShowImageDim      = true;
+    d->tooltipShowPhotoMake     = true;
+    d->tooltipShowPhotoDate     = true;
+    d->tooltipShowPhotoFocal    = true;
+    d->tooltipShowPhotoExpo     = true;
+    d->tooltipShowPhotoMode     = true;
+    d->tooltipShowPhotoFlash    = false;
+    d->tooltipShowPhotoWb       = false;
+    d->tooltipShowAlbumName     = false;
+    d->tooltipShowComments      = true;
+    d->tooltipShowTags          = true;
+    d->tooltipShowRating        = true;
 
-    d->tooltipShowFileName    = true;
-    d->tooltipShowFileDate    = false;
-    d->tooltipShowFileSize    = false;
-    d->tooltipShowImageType   = false;
-    d->tooltipShowImageDim    = true;
-    d->tooltipShowPhotoMake   = true;
-    d->tooltipShowPhotoDate   = true;
-    d->tooltipShowPhotoFocal  = true;
-    d->tooltipShowPhotoExpo   = true;
-    d->tooltipShowPhotoMode   = true;
-    d->tooltipShowPhotoFlash  = false;
-    d->tooltipShowPhotoWb     = false;
-    d->tooltipShowAlbumName   = false;
-    d->tooltipShowComments    = true;
-    d->tooltipShowTags        = true;
-    d->tooltipShowRating      = true;
+    d->exifRotate               = true;
+    d->exifSetOrientation       = true;
 
-    d->exifRotate             = true;
-    d->exifSetOrientation     = true;
+    d->saveTags                 = false;
+    d->savePhotographerId       = false;
+    d->saveCredits              = false;
 
-    d->saveTags               = false;
-    d->savePhotographerId     = false;
-    d->saveCredits            = false;
+    d->saveComments             = false;
+    d->saveDateTime             = false;
+    d->saveRating               = false;
 
-    d->saveComments           = false;
-    d->saveDateTime           = false;
-    d->saveRating             = false;
-
     d->previewLoadFullImageSize = false;
 }
 
@@ -262,9 +263,11 @@
 
     // ---------------------------------------------------------------------
 
-    KConfigGroup group = config->group("Album Settings");
+    KConfigGroup group  = config->group("Album Settings");
 
     d->albumLibraryPath = group.readEntry("Album Path", QString());
+    // NOTE: default database file path is root album library path, like 0.7.x-0.9.x series work.
+    d->databaseFilePath = group.readEntry("Database File Path", d->albumLibraryPath);
 
     QStringList collectionList = group.readEntry("Album Collections",QStringList());
     if (!collectionList.isEmpty())
@@ -372,6 +375,7 @@
     KConfigGroup group = config->group("Album Settings");
 
     group.writeEntry("Album Path", d->albumLibraryPath);
+    group.writeEntry("Database File Path", d->databaseFilePath);
     group.writeEntry("Album Collections", d->albumCollectionNames);
     group.writeEntry("Album Sort Order", (int)d->albumSortOrder);
     group.writeEntry("Image Sort Order", (int)d->imageSortOrder);
@@ -459,6 +463,16 @@
     d->albumLibraryPath = path;
 }
 
+QString AlbumSettings::getDatabaseFilePath() const
+{
+    return d->databaseFilePath;
+}
+
+void AlbumSettings::setDatabaseFilePath(const QString& path)
+{
+    d->databaseFilePath = path;
+}
+
 QString AlbumSettings::getAlbumLibraryPath() const
 {
     return d->albumLibraryPath;
--- trunk/extragear/graphics/digikam/digikam/albumsettings.h #732443:732444
@@ -74,6 +74,9 @@
     void setAlbumLibraryPath(const QString& path);
     QString getAlbumLibraryPath() const;
 
+    void setDatabaseFilePath(const QString& path);
+    QString getDatabaseFilePath() const;
+
     void setShowSplashScreen(bool val);
     bool getShowSplashScreen() const;
 
--- trunk/extragear/graphics/digikam/digikam/digikamapp.cpp #732443:732444
@@ -1795,7 +1795,7 @@
     //if(AlbumSettings::instance()->getAlbumLibraryPath() != AlbumManager::instance()->getLibraryPath())
       //  d->view->clearHistory();
 
-    if (AlbumManager::instance()->setDatabase(AlbumSettings::instance()->getAlbumLibraryPath(), false))
+    if (AlbumManager::instance()->setDatabase(AlbumSettings::instance()->getDatabaseFilePath(), false))
         AlbumManager::instance()->startScan();
 
     d->view->applySettings(AlbumSettings::instance());
--- trunk/extragear/graphics/digikam/digikam/welcomepageview.cpp #732443:732444
@@ -107,6 +107,7 @@
     newFeatures << i18n("XMP metadata support");
     newFeatures << i18n("A new camera interface");
     newFeatures << i18n("A new tool to capture photographs from Camera");
+    newFeatures << i18n("Storage of database file on a customized place");
     newFeatures << i18n("Supports the latest camera RAW files");
 
     QString featureItems;
@@ -147,8 +148,8 @@
     "help:/digikam/index.html",          // %2 : digiKam help:// Url
     "http://www.digikam.org",            // %3 : digiKam homepage Url
     "0.9.3",                             // %4 : prior digiKam version
-	featureItems,                        // %5 : prior KDE version
-	QString(),                           // %6 : generated list of new features
+    featureItems,                        // %5 : prior KDE version
+    QString(),                           // %6 : generated list of new features
     QString());                          // %7 : previous digiKam release.
     
     return info;
--- trunk/extragear/graphics/digikam/utilities/setup/setupgeneral.cpp #732443:732444
@@ -72,6 +72,7 @@
         iconShowRatingBox        = 0;
         rightClickActionComboBox = 0;
         previewLoadFullImageSize = 0;
+        databasePathEdit         = 0;
     }
 
     QLabel        *iconTreeThumbLabel;
@@ -90,6 +91,7 @@
     QComboBox     *rightClickActionComboBox;
 
     KUrlRequester *albumPathEdit;
+    KUrlRequester *databasePathEdit;
 
     KPageDialog   *mainDialog;
 };
@@ -104,26 +106,45 @@
 
     // --------------------------------------------------------
 
-    QGroupBox *albumPathBox = new QGroupBox(i18n("Album &Library Path"), this);
+    QGroupBox *albumPathBox = new QGroupBox(i18n("Album &Library"), this);
     QVBoxLayout *gLayout1   = new QVBoxLayout(albumPathBox);
 
+    QLabel *rootsPathLabel  = new QLabel(i18n("Root album path:"), albumPathBox);
+
     d->albumPathEdit = new KUrlRequester(albumPathBox);
     d->albumPathEdit->setMode(KFile::Directory | KFile::LocalOnly | KFile::ExistingOnly);    
     d->albumPathEdit->setToolTip(i18n("<p>Here you can set the main path to the digiKam album "
                                       "library in your computer."
-                                      "<p>Write access is required for this path and do not use a "
-                                      "remote path here, like an NFS mounted file system."));
+                                      "<p>Write access is required for this path."));
 
     connect(d->albumPathEdit, SIGNAL(urlSelected(const KUrl &)),
             this, SLOT(slotChangeAlbumPath(const KUrl &)));
 
     connect(d->albumPathEdit, SIGNAL(textChanged(const QString&)),
-            this, SLOT(slotPathEdited(const QString&)) );
+            this, SLOT(slotAlbumPathEdited(const QString&)) );
 
+    QLabel *databasePathLabel = new QLabel(i18n("Path to store database:"), albumPathBox);
+    d->databasePathEdit       = new KUrlRequester(albumPathBox);
+    d->databasePathEdit->setMode(KFile::Directory | KFile::LocalOnly);    
+
+    d->databasePathEdit->setToolTip(i18n("<p>Here you can set the path use to host to the digiKam database "
+                                         "in your computer. The database file is common for all roots album path. "
+                                         "<p>Write access is required for this path."
+                                         "<p>Do not use a remote path here, like an NFS mounted file system."));
+
+    connect(d->databasePathEdit, SIGNAL(urlSelected(const KUrl &)),
+            this, SLOT(slotChangeDatabsePath(const KUrl &)));
+
+    connect(d->databasePathEdit, SIGNAL(textChanged(const QString&)),
+            this, SLOT(slotDatabasePathEdited(const QString&)) );
+
+    gLayout1->addWidget(rootsPathLabel);
     gLayout1->addWidget(d->albumPathEdit);
+    gLayout1->addWidget(databasePathLabel);
+    gLayout1->addWidget(d->databasePathEdit);
     gLayout1->setSpacing(0);
     gLayout1->setMargin(KDialog::spacingHint());
-    
+   
     // --------------------------------------------------------
 
     QGroupBox *iconTextGroup = new QGroupBox(i18n("Thumbnail Information"), this);
@@ -232,6 +253,7 @@
     if (!settings) return;
 
     settings->setAlbumLibraryPath(d->albumPathEdit->url().path());
+    settings->setDatabaseFilePath(d->databasePathEdit->url().path());
 
     settings->setDefaultTreeIconSize(d->iconTreeThumbSize->currentText().toInt());
     settings->setIconShowName(d->iconShowNameBox->isChecked());
@@ -257,6 +279,7 @@
     if (!settings) return;
 
     d->albumPathEdit->setUrl(settings->getAlbumLibraryPath());
+    d->databasePathEdit->setUrl(settings->getDatabaseFilePath());
 
     if (settings->getDefaultTreeIconSize() == 16)
         d->iconTreeThumbSize->setCurrentIndex(0);
@@ -293,17 +316,28 @@
 
     if (!result.isEmpty() && !targetPath.isWritable()) 
     {
-        KMessageBox::information(0, i18n("No write access for this path.\n"
+        KMessageBox::information(0, i18n("No write access for this root album path.\n"
+                                         "Warning: image and metadata editing will not work."));
+    }
+}
+
+void SetupGeneral::slotChangeDatabasePath(const KUrl &result)
+{
+    QFileInfo targetPath(result.path());
+
+    if (!result.isEmpty() && !targetPath.isWritable()) 
+    {
+        KMessageBox::information(0, i18n("No write access for this path to store database.\n"
                                          "Warning: the caption and tag features will not work."));
     }
 }
 
-void SetupGeneral::slotPathEdited(const QString& newPath)
+void SetupGeneral::slotAlbumPathEdited(const QString& newPath)
 {
     if (newPath.isEmpty()) 
     {
-       d->mainDialog->enableButtonOk(false);
-       return;
+        d->mainDialog->enableButtonOk(false);
+        return;
     }
 
     if (!newPath.startsWith("/")) 
@@ -311,9 +345,35 @@
         d->albumPathEdit->setUrl(QDir::homePath() + '/' + newPath);
     }
 
-    QFileInfo targetPath(newPath);
-    QDir dir(newPath);
-    d->mainDialog->enableButtonOk(dir.exists() && dir.path() != QDir::homePath());
+    checkforOkButton();
 }
 
+void SetupGeneral::slotDatabasePathEdited(const QString& newPath)
+{
+    if (newPath.isEmpty()) 
+    {
+        d->mainDialog->enableButtonOk(false);
+        return;
+    }
+
+    if (!newPath.startsWith("/")) 
+    {
+        d->databasePathEdit->setUrl(QDir::homePath() + '/' + newPath);
+    }
+
+    checkforOkButton();
+}
+
+void SetupGeneral::checkforOkButton()
+{
+    QFileInfo albumPath(d->albumPathEdit->url().path());
+    QDir albumDir(d->albumPathEdit->url().path());
+    bool albumOk = albumDir.exists() && (albumDir.path() != QDir::homePath());
+    
+    QDir dbDir(d->databasePathEdit->url().path());
+    bool dbOk = dbDir.exists();
+
+    d->mainDialog->enableButtonOk(dbOk && albumOk);
+}
+
 }  // namespace Digikam
--- trunk/extragear/graphics/digikam/utilities/setup/setupgeneral.h #732443:732444
@@ -50,12 +50,16 @@
 private:
 
     void readSettings();
+    void checkforOkButton();
 
 private slots:
 
     void slotChangeAlbumPath(const KUrl&);
-    void slotPathEdited(const QString&);
+    void slotAlbumPathEdited(const QString&);
 
+    void slotChangeDatabasePath(const KUrl&);
+    void slotDatabasePathEdited(const QString&);
+
 private:
 
     SetupGeneralPriv* d;



More information about the Digikam-devel mailing list