LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
7.96k stars 993 forks source link

Use native file dialogs everywhere #5240

Open Sawuare opened 4 years ago

Sawuare commented 4 years ago

Mainly for consistency with the rest of the interface, we currently use themed file dialogs everywhere, instead of native, but unlike native, they

@Wallacoloo once wrote:

we should use OS-native dialogs instead of custom-themed ones (because, say, the gtk file chooser includes previews for image types whereas custom dialogs don't, or because OS-native file choosers include user-bookmarked locations, whereas custom dialogs don't, ...).

That being said, switching to native file dialogs everywhere has some implications. Class VersionedSaveDialog has some added features that can't be implemented in native file dialogs:

  1. Increment/Decrement version number
  2. Save options

VersionedSaveDialog

No. 1 is useless, as users just manually change the filename, so it should be removed. I don't know what to do about No. 2, though. :thought_balloon:


Related: #3792, specifically: https://github.com/LMMS/lmms/issues/3792#issuecomment-439078098.

Spekular commented 4 years ago

I disagree w/ this issue. Will post a proper explanation when I have time to type it out.

Spekular commented 4 years ago

The save dialogue's looks match the rest of LMMS, which I quite like. Blender does themed load/save as well to great effect, with custom functionality (like super easy custom format filtering, import options, etc.). Not to mention, it lists system bookmarks (which, as far as i can remember, LMMS already does for me too?)

DomClark commented 4 years ago

Some arguments in favour of this issue:

superpaik commented 3 years ago

I've been thinking about this for a while (before reading this PR). To me the OS file dialogs are more functional (speeder -yes, open the downloads folder is like forever-, the ability to change directory by cut-and-paste, the recent folders in the drop-down directory list, etc.) but certainly the themed file dialogs can have some positive features, keep consistency between OSes, look-and-feel following LMMS theme, etc. How about a configuration setting in which the user can decide between OS or themed file dialog? In the same way that we have one with "Plugin Embeding"? So, let the user decide which one is best for her/him. And for the "added features" it can be explained in the manual that those can be lost if changed to the OS file dialog (I've never noticed the + - buttons -I've been using LMMS for two years now- and, in windows at least, the "save option" is not visible)

enp2s0 commented 3 years ago

I strongly disagree with having both, it's just pointless complexity having to maintain two effectively identical systems.

ifndefJOSH commented 2 years ago

I know this issue may be "stale" at this point, but I hope I can put my two-cents in. I disagree with having native dialogs but I do think that the VersionedSaveDialog is problematic for a couple of reasons:

However, I think there may be a happy medium: there is a far better file dialog the FileDialog class can inherit from in KF5 (kf5::kio). I feel the code changes would be minimal as I'm pretty sure it also inherits from QFileDialog and I know for a fact it inherits from QWidget (KF5 is built on top of Qt). It is not without its cons tho.

I'll list the cons first:

  1. Additional dependency: kf5::kio--although it should be a fairly small dependency, it is still a dependency. This is the biggest argument against this in my opinion.
    • It is a dependency that is built on top of a library LMMS already depends on (Qt).
  2. May need to change the existing LMMS code to fit it rather than the more generic QFileDialog.
  3. KDE isn't known for writing minimalist code.

Now the pros:

  1. Because it's built in Qt and inherits from a lot of the existing Qt infrastructure, the code change on the part of LMMS would be fairly minimal
  2. Respects the LMMS theming quite easily
  3. Copy/pasting paths
  4. Easier navigation and (in my opinion) more user friendly than the existing dialog
  5. Dependency is already installed on KDE systems, as well as any system that uses any KF5 software (Krita, KDEnlive, Kate Editor etc.)
    • Note that AppImages are self-contained though, so for Linux users it would be advantageous to get LMMS from their package manager to prevent duplicate dependencies

I think it comes down to a balancing act: how much work do we want to do for something that users may find insignificant overall?

EDIT: KF5's file dialog does not have a breadcrumb menu from what I can see...it's just a textbox/combobox where you can paste paths or select from recent/suggested file paths.

ifndefJOSH commented 2 years ago

For reference, this is what the dialog could look like (this screenshot is from KDEnlive, which uses KF5 and therefore the KF5 file dialog)

image

JohannesLorenz commented 2 years ago

I think the additional dependency is not a problem if we can set it as optional in CMake and then use #ifdefs to use or not use it?

ifndefJOSH commented 2 years ago

Update: this is the class I think we want it to inherit from:

https://api.kde.org/frameworks/kio/html/classKFileCustomDialog.html

jmfergeau commented 10 months ago

Please do it. I can't properly use LMMS because any access to the file dialog takes ages to react. Just single-clicking a file takes around 40-50 seconds to react!!

michaelgregorius commented 6 months ago

I agree with @superpaik that the simplest option for now would be to let the users choose via the preference. It could be a simple checkbox with the text "Use native file dialogs".

The implementation would likely be something like an interface for all the file operations with the following implementations:

Using QFileDialog has several advantages. It does not introduce any new dependencies. People can use the file dialogs that they are used to. For example I am using KDE and on my system it therefore opens a dialog that looks quite KDE-ish:

NativeFileDialogKDE

If somebody wants to experiment with this, e.g. on Windows, here's how to adjust the open file code:

void MainWindow::openProject()
{
    if( mayChangeProject(false) )
    {
        auto fileName = QFileDialog::getOpenFileName(this, tr("Open Project"),
                ConfigManager::inst()->userProjectsDir(), tr("LMMS (*.mmp *.mmpz)"));

        if (!fileName.isNull())
        {
            Song *song = Engine::getSong();

            song->stop();
            setCursor( Qt::WaitCursor );
            song->loadProject(fileName);
            setCursor( Qt::ArrowCursor );
        }
    }
}