Bug 188959 - On first use, digiKam should not scan for images without user confirmation
Summary: On first use, digiKam should not scan for images without user confirmation
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Setup-FirstRun (show other bugs)
Version: 0.10.0
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-06 14:05 UTC by Syam
Modified: 2017-08-10 08:30 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.0.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Syam 2009-04-06 14:05:44 UTC
Version:           0.10.0-rc1 (using KDE 4.2.0)
OS:                Linux
Installed from:    Fedora RPMs

When I start digiKam for the first time, It asks for images and database directories, both set to 'home' by default.
I have symbolic links to my partitions (containing lots of images) in my home diretory.
digiKam gives no indication that it's going to scan my disks and after I click OK, it takes forever to finish the scan - with just the splash screen being displayed, and no (obvious) way of aborting the scan. I had to kill the application forcefully.

What's worse is that this happens all over again the next time I start digiKam. Since the directory info is already logged, there's no way to stop it, except to delete the files in ~/.kde/share/config/digiKam. For an average user who doesn't know this, digiKam is pretty hard to use.

This is what I suggest
1. After the initial directory configuration, ask the user if he/she wants to scan the disks with warning about the time taken (this is pretty standard everywhere, isn't it?)
2. OR - avoid the full directory scan. Ask the user to select directories to scan later (much like adding directories to Amarok collection).
Comment 1 Rex Dieter 2009-04-07 22:49:39 UTC
As for default dir, should probably default to
xdg-user-dir PICTURES
(and not home), at least.
Comment 2 Marcel Wiesweg 2009-04-11 17:26:39 UTC
Rex, we are trying to retrieve standard dirs with KGlobalSettings::picturesPath() or QDesktopServices::storageLocation(QDesktopServices::PicturesLocation).
Unfortunately this does not work on some distros (returns HOME)

Syam: Yes our first run dialog has quite a few weaknesses. Alas, writing dialogs is no great fun for me.
Comment 3 Rex Dieter 2009-04-12 00:33:33 UTC
Thanks for the clarification, I'll see if I can find out what's going wrong (at least on fedora anyway).
Comment 4 Syam 2009-04-12 04:08:25 UTC
Just a piece of information, I dont have a 'Pictures' folder in my home dir. I usually delete those directories immediately after I install Fedora.
Comment 5 caulier.gilles 2009-05-01 15:06:41 UTC
Marcel,

On new First Run Assistant, on last page, i can ask to user if he want to scan collection now, or later using "Tool/Scan for New Items". There is something special to do for DB viewpoint ?

Gilles
Comment 6 Andi Clemens 2009-05-01 15:15:14 UTC
(In reply to comment #0)
> 2. OR - avoid the full directory scan. Ask the user to select directories to
> scan later (much like adding directories to Amarok collection).

At least when digiKam is started, you can disable the scanning of the directories in the setup dialog. But this is not what you wanted of course.

Gilles,
maybe we should disable this option per default and ask in the assistant:

1. Scan now (first initial scan)
2. Scan on startup

So you can choose between those two options.

Andi
Comment 7 Marcel Wiesweg 2009-05-01 15:52:42 UTC
I agree with Andi.
There is no sense in starting for the first time without a collection scan - the app is empty and useless!
We should ask to scan now (with a warning that it may take a while), or offer to quit and scan when starting again.
(I also do not like the option to disable scanning on startup as well, I dont see any sense in that)
Comment 8 Andi Clemens 2009-05-01 17:02:34 UTC
?? Huh? I wrote my answer two hours ago, it has been added now? Well... I guess B.K.O. is on holiday, too :-)
Comment 9 caulier.gilles 2009-05-01 17:50:15 UTC
Marcel, Andi,

At first run, there is many possible cases:

1/ Collection is new. No DB version 3 or 4. DB need to be created at least.

2/ Collection come from digiKam < 0.10 : DB need to be converted at least. 

3/ Collection is already referenced with digiKam 0.10 : at least, DB is take as well.

For case 1/, if we don't scan at first run, No item will be visible.
For case 2/, if we don't scan at first run, Only items referenced to DB version 3 will be visible.
For case 3/, if we don't scan at first run, Only items referenced to DB version 4 will be visible.

Do you see any problems with these workflow ?

Gilles
Comment 10 Syam 2009-05-01 18:23:05 UTC
(In reply to comment #7)
> There is no sense in starting for the first time without a collection scan -
> the app is empty and useless!
It's still useless if it takes ages to scan a directory with large number of images, and no way to stop it. Not to mention that subsequent application startup will have the same behaviour, unless you delete the configuration files.

> We should ask to scan now (with a warning that it may take a while), or offer
> to quit and scan when starting again.
That'd be good.
Comment 11 Marcel Wiesweg 2009-05-01 20:03:56 UTC
Gilles:

Oh yes, look at AlbumManager::changeDatabase. It's similar. Even seven different cases to handled there :-(

For your cases:
1) Create an empty database with no album root is possible, but that's really pretty useless. But yes you can do that if someone really wants. Hm, maybe it's not possible because a dialog will pop up with the setupcollection page.
2) Conversion always includes a collection scan. No way around that. Convert&Scan or dont convert. That's because there are conversion steps first, then the scan, followed by more conversion steps, followed by dropping old tables.
3) If there is a digikam4.db already, we really need no full collection scan. In this case, it's not necessary to add album roots!
Comment 12 Arnd Baecker 2009-05-01 20:24:26 UTC
While not directly on-topic of the original bug report:
it might generally be useful to add a   
--no-scan option and a --scan-only dir1 dir2 ....option.

Best, Arnd
Comment 13 caulier.gilles 2009-05-01 20:58:47 UTC
To Marcel #11

Damned, it's complex.

I can provide a bool flag if user won't to scan at first startup, and pass it to AlbumManager::setDatabase() call from main.cpp. But, in AlbumManager, some code need to be added to manage all possible cases to drive this flag.

I think it's dangerous to not convert DB v3 and work. 

Also, What user can do if no items are displayed from iconview / folderview in case of no scan of unregistered collection. This is a non sence for me.

The message must be clear in Assistant. No scan can give an unsuitable interface.

Gilles
Comment 14 caulier.gilles 2009-05-02 12:06:14 UTC
Resume of IRC talk between me and Marcel yesterday evening to solve this file:

SOLUTION:
- After last page of assistant, scan is processed.
- We show progress dialog and we have a cancel button.
- User can stop scan when he want.
- DB considérations are preserved : DB conversion/creation are done just before to show progress dialog.
- If user stop scanning, it will begin again on next startup.

PROBLEM:
- if cancel button is pressed, dialog is closed, but scan continue in background.
- all debug message from scan process are still in the console.

TODO:
- ScanController::cancel() method is not implemented.
- Also missing to stop CollectionScanner in this case.

Gilles Caulier
Comment 15 Marcel Wiesweg 2009-05-02 15:21:02 UTC
SVN commit 962420 by mwiesweg:

Allow to cancel CollectionScanner and SchemaUpdate operations.
They will now query an observer to continue or cancel.

CCBUG: 188959

 M  +53 -3     collectionscanner.cpp  
 M  +11 -101   collectionscanner.h  
 M  +11 -4     collectionscannerobserver.h  
 M  +71 -13    schemaupdater.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=962420
Comment 16 Marcel Wiesweg 2009-05-02 15:21:06 UTC
SVN commit 962421 by mwiesweg:

Add methods to abort the schema update at first startup (includes the initial collection
scan for images imported from older db versions)
or cancel the complete scan at normal startup (including the scan at first startup
when starting with an empty database)

CCBUG: 188959

 M  +41 -0     scancontroller.cpp  
 M  +14 -2     scancontroller.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=962421
Comment 17 caulier.gilles 2009-05-02 16:25:52 UTC
SVN commit 962513 by cgilles:

more informations about first scan process, especially if user cancel this operation at the first run
CCBUGS: 188959

 M  +4 -3      startscanpage.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=962513
Comment 18 caulier.gilles 2009-05-02 16:47:26 UTC
Marcel,

Are you tried with a huge collection, without a DB 4 file ? If you press cancel,  scan continue again in background.

Gilles
Comment 19 caulier.gilles 2009-05-02 16:54:36 UTC
Marcel,

If you kill digiKam during First Scan (because progress dialog Cancel button do not stop this operation), at next session, digiKam restart again collection scanning. But in this case, Progress dialog is not used : Splashscreen appears instead... As there is no progress bar in splash, this can be very annoying, especially with huge collection. 

Gilles Caulier
Comment 20 Marcel Wiesweg 2009-05-03 17:11:21 UTC
> Are you tried with a huge collection, without a DB 4 file ? If you press
> cancel,  scan continue again in background.

Yeah that's because the cancel button of DProgressDialog does nothing. There is a protected slotCancel() that checks for allowCancel, which is true per default, but then it just closes. It should emit a signal there, or how's that supposed to work?
Btw, was this with a DB 3 file, or just starting from an empty dir?

For comment #19: You can never keep a user from killing the app ;-) Perhaps the progress dialog should appear (and splash be hidden) after a longer amount of time, like 15-30s?
Comment 21 Syam 2009-05-03 17:56:07 UTC
(In reply to comment #20)
> Perhaps theprogress dialog should appear (and splash be hidden) 
> after a longer amount of
> time, like 15-30s?

Then won't the user be completely clueless for the 15-30s?
Comment 22 caulier.gilles 2009-05-03 18:07:56 UTC
To Marcel, #20,

Ok, a signal must be sent with Cancel button. I take a look.

From my test, DB v4 file have been removed before to restart digiKam. My collection is huge with full of RAW files (20Gb)

>Perhaps the progress dialog should appear (and splash be hidden) after a longer >amount of time, like 15-30s?

I think the progress dalog must be displayed at startup until initial scan is complete. I user cancel scan, at next session it must see progress dialog again.
Why ? because this process can take a while. Splash is not adapted for that.

If scan is complete, well at next session splash can be displayed, because we only check for new items. It's really faster.

This is want mean that a flag must be registered somewhere (rc file?) to check if initial scan is complete or not...

Gilles
Comment 23 caulier.gilles 2009-05-03 20:03:11 UTC
Marcel,

with my last commit #962987, now scancontroller handle cancel button, but it's not enough : scan continue with splashscreen open...

Gilles
Comment 24 Marcel Wiesweg 2009-05-03 21:27:27 UTC
SVN commit 963038 by mwiesweg:

Also try to abort initial scan on cancel (both methods are a no-op if not running)
Show progress dialog in spite of active splash when initial scan is not marked.

CCBUG: 188959

 M  +6 -2      scancontroller.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=963038
Comment 25 caulier.gilles 2009-05-03 22:20:58 UTC
Marcel,

It work better now. but it still a litlle problem.

After running assistant, initial scan start. I stay a little an press cancel. dialog is closed and splash appears, but not alone... the progress dialog is back again... and initial scan is back.

If i press Cancel again, initial scan is stoped and digiKam appears.

I stop digiKam and restart it. initial scan is back as espected. If i wait until scan is complete, closing and restarting digiKam, all start speedly...

Gilles
Comment 26 caulier.gilles 2009-05-31 11:11:42 UTC
MArcel,

Are you seen my previous message there ?

Gilles
Comment 27 Marcel Wiesweg 2009-05-31 17:25:17 UTC
Whenever you start digikam it will scan. If you cancel, it will scan the next time.(*) If you cancel again, it will scan the third time. I think that's ok because using digikam is useless without an initial scan.
The alternative is to quit if cancel is pressed in the first run assistant.
Comment 28 caulier.gilles 2009-05-31 18:41:38 UTC
Marcel,

No, you misunderstand me. Look below:

1/ "After running assistant, initial scan start. I stay a little bit and a press cancel. Dialog is closed and splash appears, but not alone... the progress dialog is back again... and initial scan is back."

This is appears on the first start of digiKam, the _same_ session in fact. I do not stop and restart yet digiKam. I think it's due of my DB path as already a DB v4 file with more than one root album set insinde.

2/ "If i press Cancel again, initial scan is stoped and digiKam appears."

Well, here now, it look  the good behavor. the problem is why user need to press 2 time on Cancel...

3/ "Now, I stop digiKam and restart it. initial scan is back as espected. If i wait until scan is complete, closing and restarting digiKam, all start speedly..."

For this one, of course all is fine...

Gilles
Comment 29 Marcel Wiesweg 2009-05-31 23:21:27 UTC
Ah.
I think the first scan is done from albummanager.cpp:674, the second one is done from digikamapp.cpp:167.
The second one is the regular call. I am thinking about removing the first call.
Comment 30 Marcel Wiesweg 2009-06-04 17:29:42 UTC
SVN commit 977533 by mwiesweg:

Remove call to collection scan. This branch is taken after running the first run wizard.
A second collection scan will be triggered afterwards from DigikamApp.
User need not press Cancel twice.

CCBUG: 188959

 M  +2 -1      albummanager.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=977533
Comment 31 caulier.gilles 2009-06-04 17:49:43 UTC
Thanks Marcel, Fixed now. I close this file...

Gilles Caulier