Improve related splitter UX

* Prevent group pane from being hidden just by dragging. Introduce new View menu setting to hide the group pane.
* Replace the preview panel "close" icon with a "collapse down" icon making the intention clearer.
* Better organize the view menu
This commit is contained in:
Jonathan White 2024-09-22 21:23:54 -04:00
parent 8acc54225d
commit feafceca57
11 changed files with 52 additions and 3 deletions

View File

@ -141,6 +141,7 @@ Copyright: 2022 KeePassXC Team <team@keepassxc.org>
License: MIT License: MIT
Files: share/icons/application/scalable/actions/application-exit.svg Files: share/icons/application/scalable/actions/application-exit.svg
share/icons/application/scalable/actions/arrow-collapse-down.svg
share/icons/application/scalable/actions/attributes-copy.svg share/icons/application/scalable/actions/attributes-copy.svg
share/icons/application/scalable/actions/auto-type.svg share/icons/application/scalable/actions/auto-type.svg
share/icons/application/scalable/actions/bitwarden.svg share/icons/application/scalable/actions/bitwarden.svg

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.92,12.08L12,20L4.08,12.08L5.5,10.67L11,16.17V2H13V16.17L18.5,10.66L19.92,12.08M12,20H2V22H22V20H12Z" /></svg>

After

Width:  |  Height:  |  Size: 182 B

View File

@ -6,6 +6,7 @@
<file>application/256x256/apps/keepassxc.png</file> <file>application/256x256/apps/keepassxc.png</file>
<file>application/scalable/actions/application-exit.svg</file> <file>application/scalable/actions/application-exit.svg</file>
<file>application/scalable/actions/arrow-collapse-down.svg</file>
<file>application/scalable/actions/attributes-copy.svg</file> <file>application/scalable/actions/attributes-copy.svg</file>
<file>application/scalable/actions/auto-type.svg</file> <file>application/scalable/actions/auto-type.svg</file>
<file>application/scalable/actions/bitwarden.svg</file> <file>application/scalable/actions/bitwarden.svg</file>

View File

@ -6179,6 +6179,14 @@ Expect some bugs and minor issues, this version is meant for testing purposes.</
<source>Setup Remote Sync</source> <source>Setup Remote Sync</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Show Group Panel</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle Show Group Panel</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ManageDatabase</name> <name>ManageDatabase</name>

View File

@ -96,6 +96,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{Config::GUI_HideMenubar, {QS("GUI/HideMenubar"), Roaming, false}}, {Config::GUI_HideMenubar, {QS("GUI/HideMenubar"), Roaming, false}},
{Config::GUI_HideToolbar, {QS("GUI/HideToolbar"), Roaming, false}}, {Config::GUI_HideToolbar, {QS("GUI/HideToolbar"), Roaming, false}},
{Config::GUI_MovableToolbar, {QS("GUI/MovableToolbar"), Roaming, false}}, {Config::GUI_MovableToolbar, {QS("GUI/MovableToolbar"), Roaming, false}},
{Config::GUI_HideGroupPanel, {QS("GUI/HideGroupPanel"), Roaming, false}},
{Config::GUI_HidePreviewPanel, {QS("GUI/HidePreviewPanel"), Roaming, false}}, {Config::GUI_HidePreviewPanel, {QS("GUI/HidePreviewPanel"), Roaming, false}},
{Config::GUI_AlwaysOnTop, {QS("GUI/GUI_AlwaysOnTop"), Local, false}}, {Config::GUI_AlwaysOnTop, {QS("GUI/GUI_AlwaysOnTop"), Local, false}},
{Config::GUI_ToolButtonStyle, {QS("GUI/ToolButtonStyle"), Roaming, Qt::ToolButtonIconOnly}}, {Config::GUI_ToolButtonStyle, {QS("GUI/ToolButtonStyle"), Roaming, Qt::ToolButtonIconOnly}},

View File

@ -78,6 +78,7 @@ public:
GUI_HideMenubar, GUI_HideMenubar,
GUI_HideToolbar, GUI_HideToolbar,
GUI_MovableToolbar, GUI_MovableToolbar,
GUI_HideGroupPanel,
GUI_HidePreviewPanel, GUI_HidePreviewPanel,
GUI_AlwaysOnTop, GUI_AlwaysOnTop,
GUI_ToolButtonStyle, GUI_ToolButtonStyle,

View File

@ -128,6 +128,8 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
m_groupSplitter->setStretchFactor(0, 100); m_groupSplitter->setStretchFactor(0, 100);
m_groupSplitter->setStretchFactor(1, 0); m_groupSplitter->setStretchFactor(1, 0);
m_groupSplitter->setSizes({1, 1}); m_groupSplitter->setSizes({1, 1});
// Initial visibility based on config value
m_groupSplitter->setVisible(!config()->get(Config::GUI_HideGroupPanel).toBool());
auto rightHandSideWidget = new QWidget(m_mainSplitter); auto rightHandSideWidget = new QWidget(m_mainSplitter);
auto rightHandSideVBox = new QVBoxLayout(); auto rightHandSideVBox = new QVBoxLayout();
@ -140,12 +142,11 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
rightHandSideWidget->setLayout(rightHandSideVBox); rightHandSideWidget->setLayout(rightHandSideVBox);
m_entryView = new EntryView(rightHandSideWidget); m_entryView = new EntryView(rightHandSideWidget);
m_mainSplitter->setChildrenCollapsible(true); m_mainSplitter->setChildrenCollapsible(false);
m_mainSplitter->addWidget(m_groupSplitter); m_mainSplitter->addWidget(m_groupSplitter);
m_mainSplitter->addWidget(rightHandSideWidget); m_mainSplitter->addWidget(rightHandSideWidget);
m_mainSplitter->setStretchFactor(0, 0); m_mainSplitter->setStretchFactor(0, 0);
m_mainSplitter->setStretchFactor(1, 100); m_mainSplitter->setStretchFactor(1, 100);
m_mainSplitter->setCollapsible(1, false);
m_mainSplitter->setSizes({1, 1}); m_mainSplitter->setSizes({1, 1});
m_previewSplitter->setOrientation(Qt::Vertical); m_previewSplitter->setOrientation(Qt::Vertical);
@ -217,6 +218,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
connect(m_databaseOpenWidget, SIGNAL(dialogFinished(bool)), SLOT(loadDatabase(bool))); connect(m_databaseOpenWidget, SIGNAL(dialogFinished(bool)), SLOT(loadDatabase(bool)));
connect(this, SIGNAL(currentChanged(int)), SLOT(emitCurrentModeChanged())); connect(this, SIGNAL(currentChanged(int)), SLOT(emitCurrentModeChanged()));
connect(this, SIGNAL(requestGlobalAutoType(const QString&)), parent, SLOT(performGlobalAutoType(const QString&))); connect(this, SIGNAL(requestGlobalAutoType(const QString&)), parent, SLOT(performGlobalAutoType(const QString&)));
connect(config(), &Config::changed, this, &DatabaseWidget::onConfigChanged);
// clang-format on // clang-format on
connectDatabaseSignals(); connectDatabaseSignals();
@ -408,6 +410,15 @@ void DatabaseWidget::setSplitterSizes(const QHash<Config::ConfigKey, QList<int>>
} }
} }
void DatabaseWidget::onConfigChanged(Config::ConfigKey key)
{
if (key == Config::GUI_HideGroupPanel) {
// Toggle the group splitter visibility and reset the size
m_groupSplitter->setVisible(!config()->get(Config::GUI_HideGroupPanel).toBool());
setSplitterSizes({{Config::GUI_SplitterState, QList<int>({})}});
}
}
void DatabaseWidget::setSearchStringForAutoType(const QString& search) void DatabaseWidget::setSearchStringForAutoType(const QString& search)
{ {
m_searchStringForAutoType = search; m_searchStringForAutoType = search;

View File

@ -288,6 +288,7 @@ private slots:
// Database autoreload slots // Database autoreload slots
void reloadDatabaseFile(); void reloadDatabaseFile();
void restoreGroupEntryFocus(const QUuid& groupUuid, const QUuid& EntryUuid); void restoreGroupEntryFocus(const QUuid& groupUuid, const QUuid& EntryUuid);
void onConfigChanged(Config::ConfigKey key);
private: private:
int addChildWidget(QWidget* w); int addChildWidget(QWidget* w);

View File

@ -50,7 +50,7 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)
// Entry // Entry
m_ui->entryTotpButton->setIcon(icons()->icon("totp")); m_ui->entryTotpButton->setIcon(icons()->icon("totp"));
m_ui->entryCloseButton->setIcon(icons()->icon("dialog-close")); m_ui->entryCloseButton->setIcon(icons()->icon("arrow-collapse-down"));
m_ui->toggleUsernameButton->setIcon(icons()->onOffIcon("password-show", true)); m_ui->toggleUsernameButton->setIcon(icons()->onOffIcon("password-show", true));
m_ui->togglePasswordButton->setIcon(icons()->onOffIcon("password-show", true)); m_ui->togglePasswordButton->setIcon(icons()->onOffIcon("password-show", true));
m_ui->toggleEntryNotesButton->setIcon(icons()->onOffIcon("password-show", true)); m_ui->toggleEntryNotesButton->setIcon(icons()->onOffIcon("password-show", true));

View File

@ -1968,6 +1968,11 @@ void MainWindow::initViewMenu()
applySettingsChanges(); applySettingsChanges();
}); });
m_ui->actionShowGroupPanel->setChecked(!config()->get(Config::GUI_HideGroupPanel).toBool());
connect(m_ui->actionShowGroupPanel, &QAction::toggled, this, [](bool checked) {
config()->set(Config::GUI_HideGroupPanel, !checked);
});
m_ui->actionShowPreviewPanel->setChecked(!config()->get(Config::GUI_HidePreviewPanel).toBool()); m_ui->actionShowPreviewPanel->setChecked(!config()->get(Config::GUI_HidePreviewPanel).toBool());
connect(m_ui->actionShowPreviewPanel, &QAction::toggled, this, [](bool checked) { connect(m_ui->actionShowPreviewPanel, &QAction::toggled, this, [](bool checked) {
config()->set(Config::GUI_HidePreviewPanel, !checked); config()->set(Config::GUI_HidePreviewPanel, !checked);
@ -2071,6 +2076,7 @@ void MainWindow::initActionCollection()
m_ui->actionShowMenubar, m_ui->actionShowMenubar,
#endif #endif
m_ui->actionShowToolbar, m_ui->actionShowToolbar,
m_ui->actionShowGroupPanel,
m_ui->actionShowPreviewPanel, m_ui->actionShowPreviewPanel,
m_ui->actionAllowScreenCapture, m_ui->actionAllowScreenCapture,
m_ui->actionAlwaysOnTop, m_ui->actionAlwaysOnTop,

View File

@ -387,9 +387,13 @@
<addaction name="actionCompactMode"/> <addaction name="actionCompactMode"/>
<addaction name="actionAlwaysOnTop"/> <addaction name="actionAlwaysOnTop"/>
<addaction name="actionAllowScreenCapture"/> <addaction name="actionAllowScreenCapture"/>
<addaction name="separator"/>
<addaction name="actionShowPreviewPanel"/> <addaction name="actionShowPreviewPanel"/>
<addaction name="actionShowGroupPanel"/>
<addaction name="separator"/>
<addaction name="actionShowMenubar"/> <addaction name="actionShowMenubar"/>
<addaction name="actionShowToolbar"/> <addaction name="actionShowToolbar"/>
<addaction name="separator"/>
<addaction name="actionHideUsernames"/> <addaction name="actionHideUsernames"/>
<addaction name="actionHidePasswords"/> <addaction name="actionHidePasswords"/>
</widget> </widget>
@ -1285,6 +1289,20 @@
<string>Import…</string> <string>Import…</string>
</property> </property>
</action> </action>
<action name="actionShowGroupPanel">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Show Group Panel</string>
</property>
<property name="toolTip">
<string>Toggle Show Group Panel</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>