[Qt-creator] Disabling File Changed dialog

Thorbjørn Lindeijer thorbjorn.lindeijer at nokia.com
Tue Jul 7 12:22:11 CEST 2009


ext Henrik Abelsson wrote:
> Hey all,
> 
> I created a patch which adds an option to automatically reload changes. 
> It's implemented as global option for all files and projects at the 
> moment, similar to "Automatic reload of externally modified files" in 
> Visual Studio. It should silently reload unmodified files, but still 
> prompt you on files which have been modified but are unsaved.
> 
> The patch is here for review:
> 
> http://qt.gitorious.org/~abelsson/qt-creator/abelssons-clone/commit/b93560f4b4ff02b55175320c4ce7348d70e8c7b9
> 
> I'm still relatively new to this codebase, but quite enjoy hacking a bit 
> on it. Would any experienced trolls please let me know if I'm breaking 
> any fundamental design principles with this patch? :)

Well, you're not breaking any fundamental design principles, but I do 
have some comments. :)

It's not really nice that you have to do the "if (!isModified() && 
Core::EditorManager::instance()->alwaysReload())" check in every 
editor's modified() method. Personally, I think you could put this check 
in FileManager::checkForReload(), and use a temporary IFile::ReloadAll 
behaviour (as done in EditorManager::revertToSaved()), to make each 
unmodified editor reload without asking questions.

When the above works out, I think the option should probably move into 
FileManager instead of EditorManager, but it's not that important. I see 
the FileManager doesn't have its own settings yet.

An accessor like EditorManager::alwaysReload() should be const.

By not using a bool but an enum, you could make even more people happy. 
I've read requests for never asking for reload as well, so what about 
having a combo box showing three options?

  Reload externally modified files:
    * Always ask
    * Ask only with unsaved changes
    * Never reload

I'm not entirely sure whether these options are immediately clear 
though. And at the moment I don't think we should have a "Without 
asking" option, since I consider that quite dangerous. I'm not sure what 
the use-case is of editing a file in Qt Creator but then wanting those 
changes to be thrown away without asking.

That's all. Looking forward to a revised patch. :-)

Regards,
Bjørn

-- 
Thorbjørn Lindeijer
Software Engineer
Nokia, Qt Software




More information about the Qt-creator-old mailing list