Skip to content

Commit

Permalink
Improve related splitter UX
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
droidmonkey committed Oct 26, 2024
1 parent 8acc542 commit feafcec
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 3 deletions.
1 change: 1 addition & 0 deletions COPYING
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ Copyright: 2022 KeePassXC Team <[email protected]>
License: MIT

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/auto-type.svg
share/icons/application/scalable/actions/bitwarden.svg
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions share/icons/icons.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<file>application/256x256/apps/keepassxc.png</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/auto-type.svg</file>
<file>application/scalable/actions/bitwarden.svg</file>
Expand Down
8 changes: 8 additions & 0 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6179,6 +6179,14 @@ Expect some bugs and minor issues, this version is meant for testing purposes.</
<source>Setup Remote Sync…</source>
<translation type="unfinished"></translation>
</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>
<name>ManageDatabase</name>
Expand Down
1 change: 1 addition & 0 deletions src/core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{Config::GUI_HideMenubar, {QS("GUI/HideMenubar"), Roaming, false}},
{Config::GUI_HideToolbar, {QS("GUI/HideToolbar"), 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_AlwaysOnTop, {QS("GUI/GUI_AlwaysOnTop"), Local, false}},
{Config::GUI_ToolButtonStyle, {QS("GUI/ToolButtonStyle"), Roaming, Qt::ToolButtonIconOnly}},
Expand Down
1 change: 1 addition & 0 deletions src/core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class Config : public QObject
GUI_HideMenubar,
GUI_HideToolbar,
GUI_MovableToolbar,
GUI_HideGroupPanel,
GUI_HidePreviewPanel,
GUI_AlwaysOnTop,
GUI_ToolButtonStyle,
Expand Down
15 changes: 13 additions & 2 deletions src/gui/DatabaseWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
m_groupSplitter->setStretchFactor(0, 100);
m_groupSplitter->setStretchFactor(1, 0);
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 rightHandSideVBox = new QVBoxLayout();
Expand All @@ -140,12 +142,11 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
rightHandSideWidget->setLayout(rightHandSideVBox);
m_entryView = new EntryView(rightHandSideWidget);

m_mainSplitter->setChildrenCollapsible(true);
m_mainSplitter->setChildrenCollapsible(false);
m_mainSplitter->addWidget(m_groupSplitter);
m_mainSplitter->addWidget(rightHandSideWidget);
m_mainSplitter->setStretchFactor(0, 0);
m_mainSplitter->setStretchFactor(1, 100);
m_mainSplitter->setCollapsible(1, false);
m_mainSplitter->setSizes({1, 1});

m_previewSplitter->setOrientation(Qt::Vertical);
Expand Down Expand Up @@ -217,6 +218,7 @@ DatabaseWidget::DatabaseWidget(QSharedPointer<Database> db, QWidget* parent)
connect(m_databaseOpenWidget, SIGNAL(dialogFinished(bool)), SLOT(loadDatabase(bool)));
connect(this, SIGNAL(currentChanged(int)), SLOT(emitCurrentModeChanged()));
connect(this, SIGNAL(requestGlobalAutoType(const QString&)), parent, SLOT(performGlobalAutoType(const QString&)));
connect(config(), &Config::changed, this, &DatabaseWidget::onConfigChanged);
// clang-format on

connectDatabaseSignals();
Expand Down Expand Up @@ -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)
{
m_searchStringForAutoType = search;
Expand Down
1 change: 1 addition & 0 deletions src/gui/DatabaseWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ private slots:
// Database autoreload slots
void reloadDatabaseFile();
void restoreGroupEntryFocus(const QUuid& groupUuid, const QUuid& EntryUuid);
void onConfigChanged(Config::ConfigKey key);

private:
int addChildWidget(QWidget* w);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/EntryPreviewWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ EntryPreviewWidget::EntryPreviewWidget(QWidget* parent)

// Entry
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->togglePasswordButton->setIcon(icons()->onOffIcon("password-show", true));
m_ui->toggleEntryNotesButton->setIcon(icons()->onOffIcon("password-show", true));
Expand Down
6 changes: 6 additions & 0 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,11 @@ void MainWindow::initViewMenu()
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());
connect(m_ui->actionShowPreviewPanel, &QAction::toggled, this, [](bool checked) {
config()->set(Config::GUI_HidePreviewPanel, !checked);
Expand Down Expand Up @@ -2071,6 +2076,7 @@ void MainWindow::initActionCollection()
m_ui->actionShowMenubar,
#endif
m_ui->actionShowToolbar,
m_ui->actionShowGroupPanel,
m_ui->actionShowPreviewPanel,
m_ui->actionAllowScreenCapture,
m_ui->actionAlwaysOnTop,
Expand Down
18 changes: 18 additions & 0 deletions src/gui/MainWindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,13 @@
<addaction name="actionCompactMode"/>
<addaction name="actionAlwaysOnTop"/>
<addaction name="actionAllowScreenCapture"/>
<addaction name="separator"/>
<addaction name="actionShowPreviewPanel"/>
<addaction name="actionShowGroupPanel"/>
<addaction name="separator"/>
<addaction name="actionShowMenubar"/>
<addaction name="actionShowToolbar"/>
<addaction name="separator"/>
<addaction name="actionHideUsernames"/>
<addaction name="actionHidePasswords"/>
</widget>
Expand Down Expand Up @@ -1285,6 +1289,20 @@
<string>Import…</string>
</property>
</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>
<customwidgets>
<customwidget>
Expand Down

0 comments on commit feafcec

Please sign in to comment.