From: Felix Ernst Date: Sun, 15 Sep 2024 16:52:49 +0000 (+0200) Subject: Add phone UI X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/b9c04a701d093fe56c516f520fa16c8f6eb1e007 Add phone UI Previous to this commit launching Dolphin on phones (e.g. those running Plasma Mobile) would show Dolphin with its default user interface optimised for desktop usage. This commit changes this so instead a phone form factor optimised user interface is used. The differences to the default UI configuration are: -Toolbar at bottom -Icon-only toolbar -Different actions on the toolbar -Places panel hidden -Location bar at the top with a button to show places -Zoom slider hidden (pinch gestures to zoom still work) Through these changes Dolphin actually has a good user experience on phones by default. All the features were already there. Especially Steffen Hartleib's work to trigger selection mode on long press leads to great UX when dealing with multiple files. Still, this might be considered just a start towards making Dolphin great on phone form factors. Secondary windows that Dolphin might spawn are not yet adapted, but are usable on Plasma Mobile as they are anyway. --- diff --git a/src/dolphin.qrc b/src/dolphin.qrc index 55cae54b9..bd32ef734 100644 --- a/src/dolphin.qrc +++ b/src/dolphin.qrc @@ -1,5 +1,6 @@ dolphinui.rc +dolphinuiforphones.rc diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 7d62f52ed..36f0316c6 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -190,7 +191,8 @@ DolphinMainWindow::DolphinMainWindow() setupDockWidgets(); - setupGUI(Save | Create | ToolBar); + const bool usePhoneUi{KRuntimePlatform::runtimePlatform().contains(QLatin1String("phone"))}; + setupGUI(Save | Create | ToolBar, usePhoneUi ? QStringLiteral("dolphinuiforphones.rc") : QString() /* load the default dolphinui.rc file */); stateChanged(QStringLiteral("new_file")); QClipboard *clipboard = QApplication::clipboard(); @@ -201,6 +203,12 @@ DolphinMainWindow::DolphinMainWindow() if (firstRun) { menuBar()->setVisible(false); + + if (usePhoneUi) { + Q_ASSERT(qobject_cast(m_placesPanel->parent())); + m_placesPanel->parentWidget()->hide(); + GeneralSettings::setShowZoomSlider(false); + } } const bool showMenu = !menuBar()->isHidden(); diff --git a/src/dolphinuiforphones.rc b/src/dolphinuiforphones.rc new file mode 100644 index 000000000..ba5945cc3 --- /dev/null +++ b/src/dolphinuiforphones.rc @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Location Bar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Main Toolbar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +